diffsync.utils
Utility functions for DiffSync library.
- class diffsync.utils.OrderedDefaultDict(dict_type: Callable[[], V])
Bases:
OrderedDict
,Generic
[K
,V
]A combination of collections.OrderedDict and collections.DefaultDict behavior.
- __init__(dict_type: Callable[[], V]) None
Create a new OrderedDefaultDict.
- diffsync.utils.get_path(nested_dict: Dict, search_value: str) List | None
Find the path of keys in a dictionary, given a single unique value.
- diffsync.utils.intersection(lst1: List[T], lst2: List[T]) List[T]
Calculate the intersection of two lists, with ordering based on the first list.
- diffsync.utils.set_key(data: Dict, keys: List) None
Set a nested dictionary key given a list of keys.
- diffsync.utils.symmetric_difference(lst1: List[T], lst2: List[T]) List[T]
Calculate the symmetric difference of two lists.
- diffsync.utils.tree_string(data: Dict, root: str) str
String wrapper around _tree function to add header and provide tree view of a dictionary.