cowbird.config

Module Contents

Functions

_load_config(path_or_dict: Union[str, cowbird.typedefs.ConfigDict], section: str, allow_missing: bool = False) → cowbird.typedefs.ConfigDict

Loads a file path or dictionary as YAML/JSON configuration.

get_all_configs(path_or_dict: Union[str, cowbird.typedefs.ConfigDict], section: str, allow_missing: bool = False) → List[cowbird.typedefs.ConfigDict]

Loads all configuration files specified by the path (if a directory),

_expand_all(config: cowbird.typedefs.ConfigDict) → cowbird.typedefs.ConfigDict

Applies environment variable expansion recursively to all applicable fields of a configuration definition.

Attributes

LOGGER

cowbird.config.LOGGER[source]
exception cowbird.config.ConfigError[source]

Bases: RuntimeError

Generic error during configuration loading.

Initialize self. See help(type(self)) for accurate signature.

cowbird.config._load_config(path_or_dict: Union[str, cowbird.typedefs.ConfigDict], section: str, allow_missing: bool = False)cowbird.typedefs.ConfigDict[source]

Loads a file path or dictionary as YAML/JSON configuration.

cowbird.config.get_all_configs(path_or_dict: Union[str, cowbird.typedefs.ConfigDict], section: str, allow_missing: bool = False)List[cowbird.typedefs.ConfigDict][source]

Loads all configuration files specified by the path (if a directory), a single configuration (if a file) or directly returns the specified dictionary section (if a configuration dictionary). :returns:

  • list of configurations loaded if input was a directory path

  • list of single configuration if input was a file path

  • list of single configuration if input was a JSON dict

  • empty list if none of the other cases where matched

Note

Order of file loading will be resolved by alphabetically sorted filename if specifying a directory path.

cowbird.config._expand_all(config: cowbird.typedefs.ConfigDict)cowbird.typedefs.ConfigDict[source]

Applies environment variable expansion recursively to all applicable fields of a configuration definition.