b3j0f.conf.params module

class b3j0f.conf.params.Configuration(*categories)[source]

Bases: object

Manage conf such as a list of Categories.

The order of categories permit to ensure param overriding.

ERRORS = 'ERRORS'

category name which contains errors

FOREIGNS = 'FOREIGN'

category name which contains not local parameters

VALUES = 'VALUES'

category name which contains local parameter values

add_param_list(name, content)[source]

Add a list of parameters to self.

add_unified_category(name, copy=False, new_content=None)[source]

Add a unified category to self and add new_content if not None.

clean()[source]

Clean this params in setting value to None.

copy(cleaned=False)[source]

Copy this Configuration.

Parameters:cleaned (bool) – copy this element without parameter values.
get(category_name, default=None)[source]
get_unified_category(name, copy=False)[source]

Add a category with input name which takes all params provided by other categories.

Parameters:
  • name (str) – new category name.
  • copy (bool) – copy self params (default False).
put(category)[source]

Put a category and return the previous one if exist.

setdefault(category_name, category)[source]
unify(copy=False)[source]

Get a conf which contains only two categories:

  • VALUES where params are all self params where values are not

    exceptions.contains all values

  • ERRORS where params are all self params where values are

    exceptions

Parameters:copy (bool) – copy self params (default False).
Returns:two categories named respectivelly VALUES and ERRORS and contain respectivelly self param values and parsing errors.
Return type:Configuration
update(conf)[source]

Update this content with input conf.

class b3j0f.conf.params.Category(name, *params)[source]

Bases: object

Parameter category which contains a dictionary of params.

clean()[source]

Clean this params in setting value to None.

copy(name=None, cleaned=False)[source]

Copy this Category.

Parameters:cleaned (bool) – copy this element without parameter values.
get(param_name, default=None)[source]
put(param)[source]

Put a param and return the previous one if exist

setdefault(param_name, param)[source]
class b3j0f.conf.params.Parameter(name, parser=None, value=None, critical=False, local=True, asitem=None)[source]

Bases: object

Parameter identified among a category by its name.

Provide a value (None by default) and a parser (str by default).

static array(item_type=<type 'str'>)[source]

Get an array from an input value where items are separated by ‘,’.

static bool(value)[source]
clean()[source]

Clean this param in removing values

copy(name=None, cleaned=False)[source]
static path(value)[source]
value