module documentation
This module contains methods and facade interfaces for various ConfigLoader implementations.
Constant | SUPPORTED |
Undocumented |
Function | _check |
Undocumented |
Function | _get |
Recursively scan for configuration files, load and merge them, and return them in the form of a config dictionary. |
Function | _load |
Load an individual config file using anyconfig as a backend. |
Function | _load |
Recursively load all configuration files, which satisfy a given list of glob patterns from a specific path. |
Function | _lookup |
Undocumented |
Function | _path |
Return a set of all configuration files from conf_path or its subdirectories, which satisfy a given list of glob patterns. |
Function | _remove |
Remove duplicates while preserving the order. |
Variable | _config |
Undocumented |
def _check_duplicate_keys(processed_files:
Dict[ Path, AbstractSet[ str]]
, filepath: Path
, conf: Dict[ str, Any]
):
(source)
¶
Undocumented
def _get_config_from_patterns(conf_paths:
Iterable[ str]
, patterns: Iterable[ str]
= None, ac_template: bool
= False, ac_context: Dict[ str, Any]
= None) -> Dict[ str, Any]
:
(source)
¶
Recursively scan for configuration files, load and merge them, and return them in the form of a config dictionary.
Parameters | |
confIterable[ | List of configuration paths to directories |
patterns:Iterable[ | Glob patterns to match. Files, which names match any of the specified patterns, will be processed. |
acbool | Boolean flag to indicate whether to use the ac_template
argument of the anyconfig.load method. Used in the context of
_load_config_file function. |
acDict[ | anyconfig context to pass to anyconfig.load method.
Used in the context of _load_config_file function. |
Returns | |
Dict[str , Any] |
|
Raises | |
ValueError | If 2 or more configuration files inside the same config path (or its subdirectories) contain the same top-level key. |
MissingConfigException | If no configuration files exist within a specified config path. |
BadConfigException | If configuration is poorly formatted and cannot be loaded. |
def _load_config_file(config_file:
Path
, ac_template: bool
= False, ac_context: Dict[ str, Any]
= None) -> Dict[ str, Any]
:
(source)
¶
Load an individual config file using anyconfig
as a backend.
Parameters | |
configPath | Path to a config file to process. |
acbool | Boolean flag to indicate whether to use the ac_template
argument of the anyconfig.load method. |
acDict[ | anyconfig context to pass to anyconfig.load method. |
Returns | |
Dict[ | Parsed configuration. |
Raises | |
BadConfigException | If configuration is poorly formatted and cannot be loaded. |
ParserError | If file is invalid and cannot be parsed. |
def _load_configs(config_filepaths:
List[ Path]
, ac_template: bool
, ac_context: Dict[ str, Any]
= None) -> Dict[ str, Any]
:
(source)
¶
Recursively load all configuration files, which satisfy a given list of glob patterns from a specific path.
Parameters | |
configList[ | Configuration files sorted in the order of precedence. |
acbool | Boolean flag to indicate whether to use the ac_template
argument of the anyconfig.load method. Used in the context of
_load_config_file function. |
acDict[ | anyconfig context to pass to anyconfig.load method.
Used in the context of _load_config_file function. |
Returns | |
Dict[ | Resulting configuration dictionary. |
Raises | |
ValueError | If 2 or more configuration files contain the same key(s). |
BadConfigException | If configuration is poorly formatted and cannot be loaded. |
def _lookup_config_filepaths(conf_path:
Path
, patterns: Iterable[ str]
, processed_files: Set[ Path]
, logger: Any
) -> List[ Path]
:
(source)
¶
Undocumented
Return a set of all configuration files from conf_path or its subdirectories, which satisfy a given list of glob patterns.
Parameters | |
confPath | Path to configuration directory. |
patterns:Iterable[ | List of glob patterns to match the filenames against. |
Returns | |
Set[ | A set of paths to configuration files. |