asgardpy.config.operations module¶
Main AsgardpyConfig Operations Module
- asgardpy.config.operations.deep_update(d, u)[source]¶
Recursively update a nested dictionary.
Just like in Gammapy, taken from: https://stackoverflow.com/a/3233356/19802442
- asgardpy.config.operations.get_model_template(spec_model_tag)[source]¶
Read a particular template model yaml filename to create an AsgardpyConfig object.
- asgardpy.config.operations.recursive_merge_dicts(base_config, extra_config)[source]¶
Recursively merge two dictionaries. Entries in extra_config override entries in base_config. The built-in update function cannot be used for hierarchical dicts.
Also for the case when there is a list of dicts involved, one has to be more careful. The extra_config may have longer list of dicts as compared with the base_config, in which case, the extra items are simply added to the merged final list.
Combined here are 2 options from SO.
See: http://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth/3233356#3233356 and also https://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth/18394648#18394648