diff --git a/tiramisu/option.py b/tiramisu/option.py index eca61e2..df0ef2c 100644 --- a/tiramisu/option.py +++ b/tiramisu/option.py @@ -161,6 +161,14 @@ class BaseOption(BaseInformation): object.__setattr__(self, name, value) 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: self._state_consistencies = None elif load and self._state_consistencies is None: @@ -216,6 +224,11 @@ class BaseOption(BaseInformation): self._state_requires = new_value 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._impl_convert_consistencies(descr) self._impl_convert_requires(descr) @@ -225,6 +238,14 @@ class BaseOption(BaseInformation): pass 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: self._stated except AttributeError: @@ -1070,8 +1091,12 @@ class OptionDescription(BaseOption): 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