io_tools.postproc_toml_dict

io_tools.postproc_toml_dict.merge_config_with_default(cfg_inp, cfg_def, match_key={})[source]

Merge a TOML config dict with a default TOML dict. The default dict dictates the structure of the input:

  • Only sections and keys in the default are allowed in the input
  • All sections listed in match_key must be lists of dicts in the default and can be lists of dicts or dicts in the config

The dicts allows for the following extensions:

  • Mandatory inputs for all calculations indicated by “<no default>”
  • None indicated by “<none>”. Also works inside lists
  • References within the dictionary indicated by “<section.key>”
Parameters:
cfg_inpdict

The input config dict

cfg_defdict

The default config dict

match_keydict, optional

A dictionary that contains section/key pairs to map entries in listed sections between the input and default config.

Returns:
dict

The merged config dict