remove pickle dump/load support
This commit is contained in:
@ -260,58 +260,8 @@ class OptionDescription(BaseOption, StorageOptionDescription):
|
||||
raise ValueError(_('group_type: {0}'
|
||||
' not allowed').format(group_type))
|
||||
|
||||
def _impl_getstate(self, descr=None):
|
||||
"""enables us to export into a dict
|
||||
:param descr: parent :class:`tiramisu.option.OptionDescription`
|
||||
"""
|
||||
if descr is None:
|
||||
self.impl_build_cache_option()
|
||||
descr = self
|
||||
super(OptionDescription, self)._impl_getstate(descr)
|
||||
self._state_group_type = str(self._group_type)
|
||||
for option in self._impl_getchildren():
|
||||
option._impl_getstate(descr)
|
||||
|
||||
def __getstate__(self):
|
||||
"""special method to enable the serialization with pickle
|
||||
"""
|
||||
stated = True
|
||||
try:
|
||||
# the `_state` attribute is a flag that which tells us if
|
||||
# the serialization can be performed
|
||||
self._stated
|
||||
except AttributeError:
|
||||
# if cannot delete, _impl_getstate never launch
|
||||
# launch it recursivement
|
||||
# _stated prevent __getstate__ launch more than one time
|
||||
# _stated is delete, if re-serialize, re-lauch _impl_getstate
|
||||
self._impl_getstate()
|
||||
stated = False
|
||||
return super(OptionDescription, self).__getstate__(stated)
|
||||
|
||||
def _impl_setstate(self, descr=None):
|
||||
"""enables us to import from a dict
|
||||
:param descr: parent :class:`tiramisu.option.OptionDescription`
|
||||
"""
|
||||
if descr is None:
|
||||
self._cache_consistencies = None
|
||||
self.impl_build_cache_option()
|
||||
descr = self
|
||||
self._group_type = getattr(groups, self._state_group_type)
|
||||
if isinstance(self._group_type, groups.MasterGroupType):
|
||||
MasterSlaves(self.impl_getname(), self.impl_getchildren(),
|
||||
validate=False)
|
||||
del(self._state_group_type)
|
||||
super(OptionDescription, self)._impl_setstate(descr)
|
||||
for option in self._impl_getchildren(dyn=False):
|
||||
option._impl_setstate(descr)
|
||||
|
||||
def __setstate__(self, state):
|
||||
super(OptionDescription, self).__setstate__(state)
|
||||
try:
|
||||
self._stated
|
||||
except AttributeError:
|
||||
self._impl_setstate()
|
||||
raise NotImplementedError()
|
||||
|
||||
def _impl_get_suffixes(self, context):
|
||||
callback, callback_params = self.impl_get_callback()
|
||||
|
Reference in New Issue
Block a user