makefile and docstrings

This commit is contained in:
gwen
2013-09-02 15:06:55 +02:00
parent f379a0fc0a
commit 7dd9394b84
4 changed files with 93 additions and 78 deletions

View File

@ -92,9 +92,21 @@ class BaseInformation(object):
class BaseOption(BaseInformation):
"""This abstract base class stands for attribute access
in options that have to be set only once, it is of course done in the
__setattr__ method
"""
__slots__ = ('_readonly',)
def __setattr__(self, name, value):
"""set once and only once some attributes in the option,
like `_name`. `_name` cannot be changed one the option and
pushed in the :class:`tiramisu.option.OptionDescription`.
if the attribute `_readonly` is set to `True`, the option is
"frozen" (which has noting to do with the high level "freeze"
propertie or "read_only" property)
"""
is_readonly = False
# never change _name
if name == '_name':
@ -102,7 +114,7 @@ class BaseOption(BaseInformation):
self._name
#so _name is already set
is_readonly = True
except:
except AttributeError:
pass
try:
if self._readonly is True:
@ -988,6 +1000,9 @@ class OptionDescription(BaseOption):
return value
def impl_export(self, descr=None):
"""enables us to export into a dict
:param descr: parent :class:`tiramisu.option.OptionDescription`
"""
if descr is None:
descr = self
export = super(OptionDescription, self).impl_export(descr)