DictUtils

Utility class providing dictionary-related helper functions.

Currently includes support for performing deep merges between nested dictionaries, preserving shared structure and recursively merging child dictionaries.

Methods

deep_merge(source_dict, target_dict) staticmethod

Recursively merge the contents of target_dict into source_dict.

Unlike a shallow merge, this function walks nested dictionaries and merges them level-by-level. Non-dictionary values in target_dict overwrite values in source_dict. Dictionary values are merged recursively.

This is useful for combining

  • configuration dictionaries

  • JSON-like nested structures

  • partial updates

  • schema or settings overlays

If a key exists in both dictionaries

  • If both values are dictionaries - merge recursively.

  • Otherwise - value from target_dict replaces value in source_dict.

If a key exists only in target_dict

  • It is added to source_dict.

Parameters
  • source_dict (Dict[str, Any]) The base dictionary that will be updated in-place. Returned after merging.

  • target_dict (Dict[str, Any]) The dictionary whose keys and values are merged into source_dict.

Returns
  • Dict[str, Any] — The updated source_dict after merging.

·

©

2026

·

©

2026