Skip to main content

Multiple access patterns for key-value reference

Project description

attmap

Run pytests

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.

Install

pip install attmap

Class hierarchy

  • AttMapLike (abstract base)
    • AttMap — dict-backed mapping with dot notation access
      • OrdAttMap — insertion-ordered (extends OrderedDict)
        • PathExAttMap — expands environment variables in path-like string values
          • EchoAttMap — returns the key itself when a value is not set

Customizing subclasses

Excluding keys from text representation

Override _excl_from_repr in a subclass:

def _excl_from_repr(self, k, cls):
    protected = ["reserved_metadata", "REZKEY"]
    return k in protected

Excluding class name from repr

Override __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",
    )

Excluding classes from to_dict conversion

Override _excl_classes_from_todict:

def _excl_classes_from_todict(self):
    return (pandas.DataFrame, ClassToExclude)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

attmap-0.14.0.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

attmap-0.14.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file attmap-0.14.0.tar.gz.

File metadata

  • Download URL: attmap-0.14.0.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for attmap-0.14.0.tar.gz
Algorithm Hash digest
SHA256 ea9538fadc0d4c17f467f3a6ec508eb18460a16fb2a641c855ad5fdc2ae2b3be
MD5 7233cd2361f105ed0a9e2faf932d24da
BLAKE2b-256 157f6c92a6d49976ee58522a43d2d19e43f1b17cf4343c300b0d5fa7ea15adfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for attmap-0.14.0.tar.gz:

Publisher: python-publish.yml on pepkit/attmap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file attmap-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: attmap-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for attmap-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6899b57149228f35571873db591637c662eadbf9570496c168b8e3daaf36914d
MD5 c114f2c2b2de1daf41bdc1024f09fab7
BLAKE2b-256 aac2340a273067a82e6bcaf25781655c5bc9ea23063869c23bc898bd7944fc44

See more details on using hashes here.

Provenance

The following attestation bundles were made for attmap-0.14.0-py3-none-any.whl:

Publisher: python-publish.yml on pepkit/attmap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page