Loaders¶
- class confz.loaders.Loader¶
Bases:
ABC
An abstract base class for all config loaders.
- classmethod update_dict_recursively(original_dict: Dict, update_dict: Dict)¶
Updates the original dict with the new data. Similar to dict.update(), but works with nested dicts.
- Parameters:
original_dict – The original dictionary to update in-place.
update_dict – The new data.
- Raises:
ConfZUpdateException – If dict keys contradict each other.
- classmethod transform_nested_dicts(dict_in: Dict[str, Any], separator: str = '.') Dict[str, Any] ¶
Transform dictionaries into nested dictionaries, using a separator in the keys as hint.
- Parameters:
dict_in – A dictionary with string-keys.
separator – The string used to separate dict keys. Default value will no longer be set in a future release.
- Returns:
The transformed dictionary, splitting keys at the separator and creating a new dictionary out of it.
- Raises:
ConfZUpdateException – If dict keys contradict each other.
- confz.loaders.register_loader(confz_source: Type[ConfZSource], loader: Type[Loader])¶
Register a
ConfZSource
with a specific loader. Can be used to extend ConfZ with own loaders.- Parameters:
confz_source – The
ConfZSource
sub-type.loader – The
Loader
sub-type.