nvflare.fuel.utils.dict_utils module

augment(to_dict: dict, from_dict: dict, from_override_to=False) str[source]

Augments the to_dict with the content from the from_dict.

  • Items in from_dict but not in to_dict are added to the to_dict

  • Items in both from_dict and to_dict must be ether dicts or list of dicts,

and augment will be done on these items recursively - Non-dict/list items in both from_dict and to_dict are considered conflicts.

Parameters:
  • to_dict – the dict to be augmented

  • from_dict – content to augment the to_dict

  • from_override_to – content in from_dict overrides content in to_dict when conflict happens

Returns:

An error message if any; empty str if success.

Note

The content of the to_dict is updated

extract_first_level_primitive(d)[source]
merge_dict(dict1, dict2)[source]
update(d, u)[source]
update_configs_with_envs(configs, env)[source]