docstrings
This commit is contained in:
parent
dcd6efd063
commit
f9fde44b3b
1 changed files with 25 additions and 0 deletions
|
@ -161,6 +161,14 @@ class BaseOption(BaseInformation):
|
||||||
object.__setattr__(self, name, value)
|
object.__setattr__(self, name, value)
|
||||||
|
|
||||||
def _impl_convert_consistencies(self, descr, load=False):
|
def _impl_convert_consistencies(self, descr, load=False):
|
||||||
|
"""during serialization process, many things have to be done.
|
||||||
|
one of them is the localisation of the options.
|
||||||
|
The paths are set once for all.
|
||||||
|
|
||||||
|
:type descr: :class:`tiramisu.option.OptionDescription`
|
||||||
|
:param load: `True` if we are at the init of the option description
|
||||||
|
:type load: bool
|
||||||
|
"""
|
||||||
if not load and self._consistencies is None:
|
if not load and self._consistencies is None:
|
||||||
self._state_consistencies = None
|
self._state_consistencies = None
|
||||||
elif load and self._state_consistencies is None:
|
elif load and self._state_consistencies is None:
|
||||||
|
@ -216,6 +224,11 @@ class BaseOption(BaseInformation):
|
||||||
self._state_requires = new_value
|
self._state_requires = new_value
|
||||||
|
|
||||||
def _impl_getstate(self, descr):
|
def _impl_getstate(self, descr):
|
||||||
|
"""the under the hood stuff that need to be done
|
||||||
|
before the serialization.
|
||||||
|
|
||||||
|
:param descr: the parent :class:`tiramisu.option.OptionDescription`
|
||||||
|
"""
|
||||||
self._stated = True
|
self._stated = True
|
||||||
self._impl_convert_consistencies(descr)
|
self._impl_convert_consistencies(descr)
|
||||||
self._impl_convert_requires(descr)
|
self._impl_convert_requires(descr)
|
||||||
|
@ -225,6 +238,14 @@ class BaseOption(BaseInformation):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __getstate__(self, stated=True):
|
def __getstate__(self, stated=True):
|
||||||
|
"""special method to enable the serialization with pickle
|
||||||
|
Usualy, a `__getstate__` method does'nt need any parameter,
|
||||||
|
but somme under the hood stuff need to be done before this action
|
||||||
|
|
||||||
|
:parameter stated: if stated is `True`, the serialization protocol
|
||||||
|
can be performed, not ready yet otherwise
|
||||||
|
:parameter type: bool
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
self._stated
|
self._stated
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -1070,8 +1091,12 @@ class OptionDescription(BaseOption):
|
||||||
option._impl_getstate(descr)
|
option._impl_getstate(descr)
|
||||||
|
|
||||||
def __getstate__(self):
|
def __getstate__(self):
|
||||||
|
"""special method to enable the serialization with pickle
|
||||||
|
"""
|
||||||
stated = True
|
stated = True
|
||||||
try:
|
try:
|
||||||
|
# the `_state` attribute is a flag that which tells us if
|
||||||
|
# the serialization can be performed
|
||||||
self._stated
|
self._stated
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# if cannot delete, _impl_getstate never launch
|
# if cannot delete, _impl_getstate never launch
|
||||||
|
|
Loading…
Reference in a new issue