Skip to main content

ImplicitDict base class that turns a subclass into a dict indexing attributes, making [de]serialization easy for complex typing-annotated data types.

Project description

implicitdict

This library primarily provides the ImplicitDict base class which enables the inheriting class to implicitly be treated like a dict with entries corresponding to the fields of the inheriting class. Simple example:

class MyData(ImplicitDict):
    foo: str
    bar: int = 0
    baz: Optional[float]

data: MyData = ImplicitDict.parse({'foo': 'asdf', 'bar': 1}, MyData)
assert json.dumps(data) == '{"foo": "asdf", "bar": 1}'

See class documentation for ImplicitDict and test_normal_usage.py for more information.

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

implicitdict-2.3.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

implicitdict-2.3.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file implicitdict-2.3.0.tar.gz.

File metadata

  • Download URL: implicitdict-2.3.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for implicitdict-2.3.0.tar.gz
Algorithm Hash digest
SHA256 7d7bc8c0e688cfcd16788fd762cf5e438c0380b023e14de3061d8a952d2fe65e
MD5 89ac7f62c93a9c983014cb4d29a1d1ad
BLAKE2b-256 cffdc45a898b594dd486d28265ebcc4aab7a0aedb5528d4f83c0596166594806

See more details on using hashes here.

File details

Details for the file implicitdict-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: implicitdict-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for implicitdict-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8861d017bef318353f6eb71d2bed782d938ee74cb202f5fcdf64176f937c7be8
MD5 ecafb4c9f7d7a28763bbbd825b5f7669
BLAKE2b-256 3c930d57f0e1a65f4bbe2c846b50dda0c6e367ddcefe6cfac14fd1a594bf9e66

See more details on using hashes here.

Supported by

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