Skip to main content

No project description provided

Project description

CLassAttributeModelGenerator

Given a nested dict create a hierarchical object model.

Optionally provide models in YAML or JSON format.

Some would say this is just a dict-wrapper.

Example: Loading a nested dict

    >>> data = dict(obj=dict(foo="bar", spam="eggs", a_list=[1,2,3]))
    >>> data
    {'obj': {'foo': 'bar', 'spam': 'eggs', 'a_list': [1, 2, 3]}}
    >>> x = clamg.unpack(data)
    >>> x
    <clamg(obj=<obj(foo=bar, spam=eggs, a_list=[1, 2, 3])>)>
    >>> x.obj.foo
    'bar'

Example: Loading YAML

    >>> SAMPLE_YAML = """\
    ... obj:
    ...   yaml: yes
    ...   foo: bar
    ...   spam: eggs
    ...   a_list:
    ...     - 1
    ...     - 2
    ...     - 3
    ... """
    >>> clamg.loads(SAMPLE_YAML)
    <clamg(obj=<obj(yaml=True, foo=bar, spam=eggs, a_list=[1, 2, 3])>)>

Example: Loading JSON

    >>> SAMPLE_JSON = '{"obj": {"json": "yes", "foo": "bar", "spam": "eggs", "a_list": [1,2,3]}}'
    >>> clamg.loads(SAMPLE_JSON)
    <clamg(obj=<obj(json=yes, foo=bar, spam=eggs, a_list=[1, 2, 3])>)>

It has occasionally proven useful when working with deeply nested structures.

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

clamg-0.3.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

clamg-0.3.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file clamg-0.3.1.tar.gz.

File metadata

  • Download URL: clamg-0.3.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for clamg-0.3.1.tar.gz
Algorithm Hash digest
SHA256 19716fa7eba8364dd282b69fbe7de7da42b1ca80238a1873d8a2ef3db70013e0
MD5 1d446a0088fcd3753062beffb85d62e2
BLAKE2b-256 40c0518e8297917d53e1a9545b1a1f2be4c6c0e0bc5ea9847861a7c2bd737b4d

See more details on using hashes here.

File details

Details for the file clamg-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: clamg-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for clamg-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9743ab76fc375492586784f28c5b3b7ad9d686e84ec820ebe122c938d2c0778d
MD5 480dbd7e3f4170bd77b440a1ad68ef15
BLAKE2b-256 9e88dbd9dd3d36217136d880e93f2354f5cfbd47c406aa6f7cdba1de66b47183

See more details on using hashes here.

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