Skip to main content

Allows to manage dictionaries and config files as class attributes

Project description

levdict

This module allows to handle dictionaries keys as attributes. It has four classes:

  • LevDict: The base class, it acts as a dictionary but with the added feature of treating consists of a main class LevDict, which allows to treat dictionaries as attributes.
  • LevDictJson: Derived from LevDict, reads and writes json files
  • LevDictToml: Derived from LevDict, reads and writes toml files (depends on toml)
  • LevDictYaml: Derived from LevDict, reads and writes yaml files (depends on pyyaml)

and three derived classes that allow using respectively toml, json and yaml for configuration purposes.

Installation

The module is currently in production.

python -m pip install levdict

LevDict basic usage

d = LevDict(name="John", surname="Doe")
surname = d.surname
surname = d["surname"]
d.name = "Peter"
d.update(name="Albert")
d.surname="Hall"

More in the examples folder.

Project Tree Structure

    .
├── LICENSE
├── Makefile
├── Pipfile
├── Pipfile.lock
├── README.md
├── examples
│   ├── example1.py
│   ├── example2.ini
│   ├── example2.py
│   ├── example3.py
│   ├── example3.toml
│   ├── example3_mod.toml
│   ├── example4.json
│   └── example4.py
├── pyproject.toml
├── scripts
│   └── levmake.py
├── src
│   └── levdict
│       ├── __init__.py
│       ├── levdict_base.py
│       ├── levdict_json.py
│       ├── levdict_toml.py
│       └── levdict_yaml.py
└── tests
    ├── __init__.py
    ├── examples
    │   ├── example.toml
    │   ├── example1.json
    │   ├── example1.toml
    │   ├── example1.yaml
    │   └── example1_mod.toml
    ├── test_basic.py
    └── test_levdict.py

7 directories, 28 files

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

levdict-2023.4.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

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

levdict-2023.4-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file levdict-2023.4.tar.gz.

File metadata

  • Download URL: levdict-2023.4.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for levdict-2023.4.tar.gz
Algorithm Hash digest
SHA256 cef645e235214a212f6de6d8f05d481961320dcfde4d923c9fa2f3e73ff861a5
MD5 0313b07b1ac8466d3217e859c240dee6
BLAKE2b-256 1c59243d3be54b89bd60a095ba5b13f353cbc14deae14d8adca00e36f29b2ce8

See more details on using hashes here.

File details

Details for the file levdict-2023.4-py3-none-any.whl.

File metadata

  • Download URL: levdict-2023.4-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for levdict-2023.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e1de6bd3b383304045220af42a00eab58dc0a4bcf687c2c3c945ad91271351c4
MD5 1343cad3ca66f21d9f1d6dfe02808ad5
BLAKE2b-256 0dc4d0789d8932acb34108b1511fbb5eda90053935bab02af3eab3efb2e32fd5

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