iqm.pulse.base_utils.merge_dicts

Contents

iqm.pulse.base_utils.merge_dicts#

iqm.pulse.base_utils.merge_dicts(A, B, path=(), merge_nones=True)#

Merge two dictionaries recursively, leaving the originals unchanged.

Parameters:
  • A (dict[str, Any]) – Dictionary.

  • B (dict[str, Any]) – Another dictionary.

  • path (tuple[str, ...]) – Current path into the nested dictionaries, for error reporting.

  • merge_nones (bool) – Whether to also merge None and empty Sized values from B to A.

Returns:

Copy of A, with the contents of B merged in (and taking precedence) recursively.

Return type:

dict[str, Any]