Skip to content

data_merge

Tools for merging data.

FUNCTION DESCRIPTION
comprehensive_merge

Merges data comprehensively.

deep_merge

Merges dicts deeply.

merge_iterables

Merge and de-duplicate a bunch of lists into a single list.

Functions

comprehensive_merge

comprehensive_merge(*args: Any) -> Any

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
*args

Dicts to merge with the first one the base

TYPE: Any DEFAULT: ()

RETURNS DESCRIPTION
Any

The merged data

deep_merge

deep_merge(*dicts: dict) -> dict

Merges dicts deeply.

Pass the dictionaries to merge as parameters to the function.

PARAMETER DESCRIPTION
*dicts

Dicts to merge with the first one as the base

TYPE: dict DEFAULT: ()

RETURNS DESCRIPTION
dict

The merged dict

TYPE: dict

merge_iterables

merge_iterables(iter1: Iterable, iter2: Iterable) -> set

Merge and de-duplicate a bunch of lists into a single list.

Order is not guaranteed.

PARAMETER DESCRIPTION
iter1

An Iterable

TYPE: Iterable

iter2

An Iterable

TYPE: Iterable

RETURNS DESCRIPTION
set

The merged, de-duplicated sequence as a set