ConfigLoader#

class ConfigLoader(app, log=None)#

Bases: object

Abstract ConfigLoader.

Define the public API that will be used by the Application object, as well as some common logic.

Parameters:
  • app (Application) – Parent application that created this loader.

  • log (Logger) – Logger instance.

add(cv)#

Add key to configuration dictionnary.

Raises:

MultipleConfigKeyError – If the key is already present in the current configuration.

Parameters:

cv (ConfigValue)

Return type:

None

app: Application#

Parent application that created this loader.

It will be used to deal with exceptions, and to resolve/normalize the config once loaded.

apply_application_trait(cv)#

Apply config for Application.

Parameters:

cv (ConfigValue)

Return type:

None

clear()#

Empty the config.

Return type:

None

config: dict[str, ConfigValue]#

Configuration dictionnary mapping keys to ConfigValues.

It should be a flat dictionnary.

get_config(*args, apply_application_traits=True, resolve=True, **kwargs)#

Load and return a proper configuration dict.

This method clears the existing config, call load_config() to populate the config attribute, apply parameters to the root application, resolve/normalize the config and return it.

Parameters to be applied to the application before proper resolution of the whole configuration are detected in a simple manner. Only single level keys corresponding to an existing application trait are used.

Parameters:
Return type:

dict[str, ConfigValue]

load_config(*args, **kwargs)#

Populate the config attribute from a source.

Not implemented:

Parameters:
Return type:

Iterator[ConfigValue]

log: Logger#