data_merge
Tools for merging data.
Attributes¶
COMPREHENSIVE
module-attribute
¶
COMPREHENSIVE = 'comprehensive'
Comprehensively merge the two data structures.
- Scalars are overwritten by the new values
- lists are merged and de-duplicated
- dicts are recursively merged
Functions¶
comprehensive_merge
¶
comprehensive_merge(left_val: T, right_val: T) -> T
Merges data comprehensively.
All arguments must be of the same type.
- Scalars are overwritten by the new values
- lists are merged and de-duplicated
- dicts are recursively merged
PARAMETER | DESCRIPTION |
---|---|
left_val
|
The item to merge into
TYPE:
|
right_val
|
The item to merge from
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
T
|
The merged data |
freeze_data
¶
freeze_data(obj: set | frozenset) -> frozenset
freeze_data(obj: tuple | list) -> tuple
freeze_data(
obj: dict | OrderedDict | immutabledict,
) -> immutabledict
freeze_data(obj: str) -> str
freeze_data(obj: int) -> int
freeze_data(obj: float) -> float
freeze_data(obj: bytes) -> bytes
freeze_data(obj: Any) -> Any
Check type and recursively return a new read-only object.
merge_iterables
¶
merge_iterables(iter1: Iterable, iter2: Iterable) -> set
nested_overwrite
¶
nested_overwrite(*dicts: dict) -> dict