cobald.daemon.config.mapping module

exception cobald.daemon.config.mapping.ConfigurationError(what: Any, where: str = None)[source]

Bases: Exception

class cobald.daemon.config.mapping.M

type of a mapping element, matching JSON/YAML

alias of TypeVar(‘M’, str, int, float, bool, dict, list)

class cobald.daemon.config.mapping.SectionPlugin(section: str, digest: Callable[[M], Any], requirements: PluginRequirements)[source]

Bases: Generic[M]

Plugin to digest a top-level configuration section

Parameters:
  • section – Name of the section to digest

  • digest – callable that receives the section

  • requirements – plugin requirements

property after
property before
digest
classmethod load(entry_point: EntryPoint) SectionPlugin[source]

Load a plugin from a pre-parsed entry point

Parses the following options:

required

If present implies required=True.

before=other

This plugin must be processed before other.

after=other

This plugin must be processed after other.

property required
requirements
section
class cobald.daemon.config.mapping.Translator[source]

Bases: object

Translator from a mapping to an initialised object hierarchy

construct(mapping: dict, **kwargs)[source]

Construct an object from a mapping

Parameters:
  • mapping – constructor definition, with __type__ and keyword arguments

  • kwargs – additional keyword arguments to pass to the constructor

static load_name(absolute_name: str)[source]

Load an object based on an absolute, dotted name

translate_hierarchy(structure: M, *, where: str = '', **construct_kwargs) M[source]
cobald.daemon.config.mapping.configure_logging(logging_mapping: dict)[source]
cobald.daemon.config.mapping.load_configuration(config_data: Dict[str, Any], plugins: Tuple[SectionPlugin] = ()) Dict[SectionPlugin, Any][source]

Load the configuration from a mapping, applying plugins to sections

Parameters:
  • config_data – the raw configuration without any plugins applied

  • plugins – all plugins that might apply, in order

Returns:

the output of all applied plugins