core.deepmerge#

Deep Merge.

Inspired by toumorokoshi/deepmerge. See “Credit” section of the polyconf README.

Module Contents#

Classes#

Strategy

A function that merges two sources.

Merger

Deep Merge.

Functions#

dict_strategy_merge

For keys that do not exist, use them directly. If the key exists in both dictionaries, attempt a value merge.

Data#

strategy_map

deep

API#

class core.deepmerge.Strategy#

Bases: typing.Protocol

A function that merges two sources.

__call__(merger: core.deepmerge.Merger, path: list[str], base: dict[str, Any], other: dict[str, Any]) dict[str, Any]#
core.deepmerge.dict_strategy_merge(merger: Merger, path: list[str], base: dict[str, Any], other: dict[str, Any]) dict[str, Any]#

For keys that do not exist, use them directly. If the key exists in both dictionaries, attempt a value merge.

core.deepmerge.strategy_map: dict[type, core.deepmerge.Strategy] = None#
class core.deepmerge.Merger#

Deep Merge.

merge(base: dict[str, Any], other: dict[str, Any]) dict[str, Any]#

Merge two dictionaries.

value_strategy(path: list[str], base: dict[str, Any], other: dict[str, Any]) dict[str, Any]#

Merge two values.

core.deepmerge.deep = None#