Config subpackage melusine.config

TODO : ADD DESCRIPTION OF THE SUBPACKAGE

List of submodules

Config melusine.config.config

class melusine.config.config.MelusineConfig[source]

Bases: object

The MelusineConfig class acts as a dict containing configurations. The configurations can be changed dynamically using the switch_config function.

copy()[source]

Copy the config dict

has_key(k)[source]

Checks if given key exists in the config dict

items()[source]

Returns the items of the config dict

keys()[source]

Returns the keys of the config dict

load_melusine_conf() None[source]

Load the melusine configurations. The default configurations are loaded first (the one present in the melusine package). Custom configurations may overwrite the default ones. Custom configuration should be specified in YML and JSON files and placed in a directory. The directory path should be set as the value of the MELUSINE_CONFIG_DIR environment variable. Returns ——- conf: dict

Loaded config dict

values()[source]

Returns the values of the config dict

melusine.config.config.config_deprecation_warnings(config_dict: Dict[str, Any]) None[source]

Raise Deprecation Warning when using deprecated configs

melusine.config.config.load_conf_from_path(config_dir_path: str) Dict[str, Any][source]

Given a directory path Parameters ———- config_dir_path: str

Path to a directory containing YML or JSON conf files

conf: dict

Loaded config dict

melusine.config.config.switch_config(new_config)[source]

Function to change the Melusine configuration using a dict.

Parameters
new_config: dict

Dict containing the new config

melusine.config.config.update_nested_dict(base_dict: dict, update_dict: dict) dict[source]

Update a (possibly) nested dictionary using another (possibly) nested dictionary. Ex:

base_dict = {“A”: {“a”: “0”}} u = {“A”: {“b”: “42”}} update_dict = update_nested_dict(d, u) # Output : {“A”: {“a”: “0”, “b”: “42”}}

Parameters
base_dict: Mapping

Base dict to be updated

update_dict: Mapping

Update dict to merge into d

Returns
base_dict: Mapping

Updated dict