Key-value Mapping supporting nesting and attribute-style access.
Note: This package is no longer actively developed. Consider using plain dicts or dataclasses for new projects.
Originally designed for the pepkit family projects.
pip install attmap
AttMapLike(abstract base)AttMap— dict-backed mapping with dot notation accessOrdAttMap— insertion-ordered (extendsOrderedDict)PathExAttMap— expands environment variables in path-like string valuesEchoAttMap— returns the key itself when a value is not set
Override _excl_from_repr in a subclass:
def _excl_from_repr(self, k, cls):
protected = ["reserved_metadata", "REZKEY"]
return k in protectedOverride __repr__ using the exclude_class_list argument to _render:
def __repr__(self):
return self._render(
self._simplify_keyvalue(self._data_for_repr(), self._new_empty_basic_map),
exclude_class_list="YacAttMap",
)Override _excl_classes_from_todict:
def _excl_classes_from_todict(self):
return (pandas.DataFrame, ClassToExclude)