new api documentation

This commit is contained in:
gwen
2013-05-21 18:42:56 +02:00
parent 480ed190aa
commit 0e6032dd88
10 changed files with 93 additions and 105 deletions

View File

@ -115,6 +115,7 @@ def calculate(name, callback, params, tcparams):
:param callback: callback name
:param params: in the callback's arity, the unnamed parameters
:params tcparams: in the callback's arity, the named parameters
:param tcparams: in the callback's arity, the named parameters
"""
return callback(*params, **tcparams)

View File

@ -416,7 +416,8 @@ class SubConfig(BaseInformation):
return context_descr.impl_get_path_by_opt(descr)
class ConfigCommon(SubConfig):
class CommonConfig(SubConfig):
"abstract base class for the Config and the MetaConfig"
__slots__ = ('_impl_values', '_impl_settings', '_impl_meta')
def _impl_build_all_paths(self):
@ -457,7 +458,7 @@ class ConfigCommon(SubConfig):
# ____________________________________________________________
class Config(ConfigCommon):
class Config(CommonConfig):
"main configuration management entry"
__slots__ = tuple()
@ -483,7 +484,7 @@ class Config(ConfigCommon):
self.cfgimpl_get_settings().reset_cache(only_expired=only_expired)
class MetaConfig(ConfigCommon):
class MetaConfig(CommonConfig):
__slots__ = ('_impl_children',)
def __init__(self, children, meta=True):
@ -492,7 +493,7 @@ class MetaConfig(ConfigCommon):
self._impl_descr = None
if meta:
for child in children:
if not isinstance(child, ConfigCommon):
if not isinstance(child, CommonConfig):
raise ValueError(_("metaconfig's children must be Config, not {0}"
"".format(type(child))))
if self._impl_descr is None:
@ -575,6 +576,7 @@ def mandatory_warnings(config):
where no value has been set
:returns: generator of mandatory Option's path
"""
#if value in cache, properties are not calculated
config.cfgimpl_reset_cache(only=('values',))

View File

@ -22,7 +22,7 @@
# Exceptions for an Option
class PropertiesOptionError(AttributeError):
"attempt to access to an option with a property that is'nt allowed"
"attempt to access to an option with a property that is not allowed"
def __init__(self, msg, proptype):
self.proptype = proptype
super(PropertiesOptionError, self).__init__(msg)

View File

@ -145,6 +145,7 @@ populate_multitypes()
class Property(object):
"a property is responsible of the option's value access rules"
__slots__ = ('_setting', '_properties', '_opt')
def __init__(self, setting, prop, opt=None):