CLI Utils
elva.utils
Module with utility functionality for ELVA's command line interface.
Functions:
-
update_none_only
–Update a key in a dictionary only if present or holding value
None
. -
get_params_from_file
–Get metdata from file as parameter mapping.
-
get_params_from_configs
–Get parameters defined in configuration files.
-
gather_context_information
–Update the user-defined parameters with parameters from files.
Attributes:
-
FILE_SUFFIX
–ELVA file type annotation.
-
LOG_SUFFIX
–Log file type annotation.
FILE_SUFFIX = '.y'
module-attribute
ELVA file type annotation.
LOG_SUFFIX = '.log'
module-attribute
Log file type annotation.
update_none_only(d, key, value)
Update a key in a dictionary only if present or holding value None
.
Parameters:
-
d
(dict
) –mapping object to update.
-
key
(str
) –key to update in the mapping
d
. -
value
(Any
) –value to insert for
key
.
Source code in src/elva/utils.py
get_params_from_file(file)
Get metdata from file as parameter mapping.
Parameters:
-
file
(Path
) –path where the ELVA SQLite database is stored.
Returns:
-
dict
–parameter mapping stored in the ELVA SQLite database.
Source code in src/elva/utils.py
get_params_from_configs(configs)
Get parameters defined in configuration files.
Parameters:
Returns:
-
dict
–parameter mapping from all configuration files.
-
dict
–The value from the highest priority configuration overwrites all other parameter values.
Source code in src/elva/utils.py
gather_context_information(ctx, file=None, app=None)
Update the user-defined parameters with parameters from files.
Parameters:
-
ctx
(Context
) –object holding the parameter mapping to be updated.
-
file
(None | Path
, default:None
) –path to an ELVA SQLite database.
-
app
(None | str
, default:None
) –parameters from the same named section in the configuration files.