b3j0f.conf.configurable.registry module

class b3j0f.conf.configurable.registry.Configurables(registry, values=None, *args, **kwargs)[source]

Bases: dict

With a ConfigurableTypes, it is in charge of a ConfigurableRegistry sub-configurables.

When a configurable is trying to be setted, the type is checked related to its ConfigurableRegistry ConfigurableTypes.

class b3j0f.conf.configurable.registry.ConfigurableTypes(registry, values=None, *args, **kwargs)[source]

Bases: dict

With a Configurables, it is in charge of a set of configurable type.

When a new type is setted but the old configurable value does not inherits from it, then the old value is removed automatically.

class b3j0f.conf.configurable.registry.ConfigurableRegistry(configurables=None, configurable_types=None, *args, **kwargs)[source]

Bases: b3j0f.conf.configurable.core.Configurable

Manage a set of configurables which are accessibles from self configurables.

Each configurable can be defined in conf parameters where names are like {name}_configurable={configurable_path, configurable_class, configurable}.

And a configurable configuration are in categories {NAME}_CONF.

Then all sub-configurables are accessibles from item accessors with name as item key.

CATEGORY = 'MANAGER'

default ConfigurableRegistry category name

CONFIGURABLE_SUFFIX = '_value'

configurable configuration suffix

CONFIGURABLE_TYPE_SUFFIX = '_type'

type config suffix

CONF_PATH = 'configuration/registry.conf'

default conf path

exception Error[source]

Bases: exceptions.Exception

handle ConfigurableRegistry errors

ConfigurableRegistry.apply_configuration(conf=None, conf_paths=None, drivers=None, logger=None, override=True, *args, **kwargs)[source]
ConfigurableRegistry.configurable_types

ConfigurableTypes which manages restriction of sub-configurable types.

ConfigurableRegistry.configurables

Configurable which manages sub-configurables.

static ConfigurableRegistry.get_configurable(configurable, *args, **kwargs)[source]

Get a configurable instance from a configurable class/path/instance and args, kwargs, None otherwise.

Parameters:configurable (str, class or Configurable) – configurable path, class or instance.
Returns:configurable instance or None if input configurable can not be solved such as a configurable.
static ConfigurableRegistry.get_configurable_category(name)[source]

Get generated sub-configurable category name.