b3j0f.conf.driver.core module

class b3j0f.conf.driver.core.MetaConfDriver(name, bases, attrs)[source]

Bases: type

ConfDriver meta class which register all driver in a global set of drivers.

class b3j0f.conf.driver.core.ConfDriver[source]

Bases: object

Base class for managing conf.

CONF_FILE = 'CONF_FILE'
exists(conf_path)[source]

True if conf_path exist related to this driver behaviour.

get_conf(conf_path, logger, conf=None, override=True)[source]

Parse a configuration_files with input conf and returns parameters and errors by param name.

Parameters:
  • conf_path (str) – conf file to parse and from get parameters.
  • conf (Configuration) – conf to fill with conf_path values and conf param names.
  • logger (Logger) – logger to use in order to trace information/error.
  • override (bool) – if True (by default), override self configuration.
static get_driver(path)[source]

Add a conf driver by its path definition.

Parameters:path (str) – driver path to add. Must be a full path from a known package/module.
static get_drivers()[source]

Get global defined drivers.

handle(conf_path, logger)[source]

True iif input conf_path can be handled by self.

Returns:True iif input conf_path can be handled by self.
Return type:bool
set_conf(conf_path, conf, logger)[source]

Set input conf in input conf_path.

Parameters:
  • conf_path (str) – conf file to parse and from get parameters.
  • conf (Configuration) – conf to write to conf_path.
  • logger (Logger) – used to log info/errors