diffsync.utils

Utility functions for DiffSync library.

class diffsync.utils.OrderedDefaultDict(dict_type)

Bases: collections.OrderedDict

A combination of collections.OrderedDict and collections.DefaultDict behavior.

__init__(dict_type)

Create a new OrderedDefaultDict.

diffsync.utils.get_path(nested_dict: Dict, search_value: str) Optional[List]

Find the path of keys in a dictionary, given a single unique value.

diffsync.utils.intersection(lst1, lst2) List

Calculate the intersection of two lists, with ordering based on the first list.

diffsync.utils.set_key(data: Dict, keys: List)

Set a nested dictionary key given a list of keys.

diffsync.utils.symmetric_difference(lst1, lst2) List

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.