extended_data.containers.mappings

Extended mapping container built on Tier 1 primitives.

Module Contents

Classes

ExtendedDict

Dictionary wrapper with chainable primitive operations.

API

class extended_data.containers.mappings.ExtendedDict(initialdata: collections.abc.Mapping[str, Any] | None = None, **kwargs: Any)

Bases: collections.UserDict[str, typing.Any], extended_data.containers.data.ExtendedData

Dictionary wrapper with chainable primitive operations.

Initialization

Initialize the extended dictionary.

update(*args: Any, **kwargs: Any) Self

Update values while preserving extended nested containers.

setdefault(key: str, default: Any = None) Any

Insert a default while returning the promoted stored value.

deep_merge(*mappings: collections.abc.Mapping[str, Any]) extended_data.containers.mappings.ExtendedDict

Return a deeply merged copy.

flatten(*, separator: str = '.') extended_data.containers.mappings.ExtendedDict

Return a flattened copy.

filter(*, allowlist: list[str] | None = None, denylist: list[str] | None = None) extended_data.containers.sequences.ExtendedTuple[extended_data.containers.mappings.ExtendedDict]

Return accepted and rejected mapping entries.

compact() extended_data.containers.mappings.ExtendedDict

Return a copy without values considered empty.

deduplicate() extended_data.containers.mappings.ExtendedDict

Return a copy with nested duplicate list values removed.

unhump(*, drop_without_prefix: str | None = None) extended_data.containers.mappings.ExtendedDict

Return a copy with camelCase keys converted to snake_case.

all_values() extended_data.containers.sequences.ExtendedList[Any]

Return all values from the nested mapping.

split_by_type(*, primitive_only: bool = False) extended_data.containers.mappings.ExtendedDict

Return mapping entries grouped by value type name.

first_non_empty_value(*keys: str) Any

Return the first non-empty value for the provided keys.

first_non_empty_entry(*keys: str) extended_data.containers.mappings.ExtendedDict

Return the first non-empty keyed entry for the provided keys.

non_empty_entries(*keys: str) extended_data.containers.sequences.ExtendedList[extended_data.containers.mappings.ExtendedDict]

Return all non-empty keyed entries for the provided keys.

reconstruct_special_types(*, fail_silently: bool = False) extended_data.containers.mappings.ExtendedDict

Return a copy with string-like special values reconstructed.

to_export_safe(*, export_to_yaml: bool = False) Any

Return this mapping converted to export-safe primitive data.

wrap_for_export(allow_encoding: bool | str = True, **format_opts: Any) str

Return this mapping wrapped as an encoded export string.