vcorelib.dict
index
/home/vkottler/src/vkottler/workspace/vcorelib/vcorelib/dict/__init__.py

Dictionary manipulation utilities.

 
Package Contents
       
cache
codec
config
env

 
Classes
       
enum.Enum(builtins.object)
MergeStrategy

 
class MergeStrategy(enum.Enum)
    MergeStrategy(*values)
 
An enumeration describing strategies for combining various data structures.
 
 
Method resolution order:
MergeStrategy
enum.Enum
builtins.object

Data and other attributes defined here:
RECURSIVE = <MergeStrategy.RECURSIVE: 1>
UPDATE = <MergeStrategy.UPDATE: 2>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Methods inherited from enum.EnumType:
__contains__(value) from enum.EnumType
Return True if `value` is in `cls`.
 
`value` is in `cls` if:
1) `value` is a member of `cls`, or
2) `value` is the value of one of the `cls`'s members.
__getitem__(name) from enum.EnumType
Return the member matching `name`.
__iter__() from enum.EnumType
Return members in definition order.
__len__() from enum.EnumType
Return the number of members (no aliases)

Readonly properties inherited from enum.EnumType:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.

 
Functions
       
consume(data: Dict[Any, Any], key: Any, default: Any = None) -> Any
Attempt to obtain dictionary data via key, removing the data if it was
present.
limited(data: Dict[Any, Any], key: Any, value: Any = None) -> Iterator[NoneType]
Ensure that dictionary data is only temporarily added.
merge(dict_a: Dict[Any, Any], dict_b: Dict[Any, Any], path: List[str] = None, expect_overwrite: bool = False, logger: Union[logging.Logger, logging.LoggerAdapter[Any]] = None, strategy: vcorelib.dict.MergeStrategy = <MergeStrategy.RECURSIVE: 1>) -> Dict[Any, Any]
Combine two dictionaries based on a provided merge strategy.
merge_dicts(dicts: List[Dict[Any, Any]], expect_overwrite: bool = False, logger: Union[logging.Logger, logging.LoggerAdapter[Any]] = None, strategy: vcorelib.dict.MergeStrategy = <MergeStrategy.RECURSIVE: 1>) -> Dict[Any, Any]
Merge a list of dictionary data into a single set (mutates the first
element).
merge_recursive(dict_a: Dict[Any, Any], dict_b: Dict[Any, Any], path: List[str] = None, expect_overwrite: bool = False, logger: Union[logging.Logger, logging.LoggerAdapter[Any]] = None, strategy: vcorelib.dict.MergeStrategy = <MergeStrategy.RECURSIVE: 1>) -> Dict[Any, Any]
Combine two dictionaries recursively, prefers dict_a in a conflict. For
values of the same key that are lists, the lists are combined. Otherwise
the resulting dictionary is cleanly merged.
set_if_not(data: Dict[Any, Any], key: Any, value: Any = None) -> Any
Set a value in a dictionary if one wasn't already set and return the value
that ends up at that key.

 
Data
        GenericDict = typing.Dict[typing.Any, typing.Any]
GenericStrDict = typing.Dict[str, typing.Any]
LoggerType = typing.Union[logging.Logger, logging.LoggerAdapter[typing.Any]]