doc: migrated to sphinx

This commit is contained in:
gwen
2012-11-20 17:14:58 +01:00
parent 60ef6cc2b4
commit 79cf82e328
45 changed files with 426 additions and 4118 deletions

View File

@ -270,7 +270,7 @@ class Config(object):
(typically called by the __setattr__)
:param who: is an owner's name
who is **not necessarily** a owner, because it cannot be a list
who is **not necessarily** a owner, because it cannot be a list
:type who: string
"""
child = getattr(self._cfgimpl_descr, name)
@ -292,7 +292,7 @@ class Config(object):
def set(self, **kwargs):
"""
"do what I mean"-interface to option setting. Searches all paths
do what I mean"-interface to option setting. Searches all paths
starting from that config for matches of the optional arguments
and sets the found option if the match is not ambiguous.
:param kwargs: dict of name strings to values.
@ -321,8 +321,8 @@ class Config(object):
def get(self, name):
"""
same as a find_first() method in a config that has identical names
that is : Returns the first item of an option named 'name'
same as a `find_first()` method in a config that has identical names:
it returns the first item of an option named `name`
much like the attribute access way, except that
the search for the option is performed recursively in the whole
@ -397,7 +397,8 @@ class Config(object):
return not self == other
# ______________________________________________________________________
def __iter__(self):
"iteration only on Options (not OptionDescriptions)"
"""Pythonesque way of parsing group's ordered options.
iteration only on Options (not OptionDescriptions)"""
for child in self._cfgimpl_descr._children:
if isinstance(child, Option):
try:
@ -406,7 +407,10 @@ class Config(object):
pass # option with properties
def iter_groups(self, group_type=None):
"iteration on OptionDescriptions"
"""iteration on groups objects only.
All groups are returned if `group_type` is `None`, otherwise the groups
can be filtered by categories (families, or whatever).
"""
if group_type == None:
groups = group_types
else:

View File

@ -85,20 +85,33 @@ class Multi(list):
#
class Option(HiddenBaseType, DisabledBaseType):
"""
Abstract base class for configuration option's
reminder: an Option object is **not** a container for the value
Abstract base class for configuration option's.
Reminder: an Option object is **not** a container for the value
"""
"freeze means: cannot modify the value of an Option once set"
#freeze means: cannot modify the value of an Option once set
_frozen = False
"if an Option has been frozen, shall return the default value"
#if an Option has been frozen, shall return the default value
_force_default_on_freeze = False
def __init__(self, name, doc, default=None, default_multi=None,
requires=None, mandatory=False, multi=False, callback=None,
callback_params=None, validator=None, validator_args={}):
"""
:param default: ['bla', 'bla', 'bla']
:param name: the option's name
:param doc: the option's description
:param default: specifies the default value of the option,
for a multi : ['bla', 'bla', 'bla']
:param default_multi: 'bla' (used in case of a reset to default only at
a given index)
a given index)
:param requires: is a list of names of options located anywhere
in the configuration.
:param multi: if true, the option's value is a list
:param callback: the name of a function. If set, the function's output
is responsible of the option's value
:param callback_params: the callback's parameter
:param validator: the name of a function wich stands for a custom
validation of the value
:param validator_args: the validator's parameters
"""
self._name = name
self.doc = doc
@ -224,9 +237,9 @@ class Option(HiddenBaseType, DisabledBaseType):
def setowner(self, config, owner):
"""
:param config: *must* be only the **parent** config
(not the toplevel config)
:param owner: is a **real* owner, that is a name or a list
which is allowable here
(not the toplevel config)
:param owner: is a **real** owner, that is a name or a list
which is allowable here
"""
name = self._name
if not type(owner) == str:
@ -246,7 +259,7 @@ class Option(HiddenBaseType, DisabledBaseType):
def is_default_owner(self, config):
"""
:param config: *must* be only the **parent** config
(not the toplevel config)
(not the toplevel config)
:return: boolean
"""
return self.getowner(config) == 'default'