Config
Module functions for working with configuration files.
reconcile_config_args
Reconcile command line arguments with the default configuration.
Command line arguments take precedence over the default configuration. If a partial configuration file is specified (with '-c' or '--config-file') the defaults are over-ridden by these values (internally the configuration dictionary is updated with these values). Any other command line arguments take precedence over both the default and those supplied in a configuration file (again the dictionary is updated).
The final configuration is validated before processing begins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Namespace
|
Command line arguments passed into LayOpt. |
required |
default_config
|
dict[str, Any]
|
Dictionary containing the default configuration for the package. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The configuration dictionary. |
Source code in src/layopt/config.py
merge_mappings
Merge two mappings (dictionaries), with priority given to the second mapping.
map1 is updated with values from map2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
map1
|
MutableMapping
|
First mapping to merge, with secondary priority. |
required |
map2
|
MutableMapping
|
Second mapping to merge, with primary priority. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Merged dictionary. |