Skip to main content

Dictoat

Dictoat is a Python utility designed to simplify accessing data stored in dictionaries. It converts dictionaries into Python objects, allowing for more intuitive access to data via attributes instead of dictionary keys. This is ideal for projects where readability and ease of access to complex data structures are essential.

Installation

You can easily install Dictoat using pip:

pip install dictoat

or via git:

git clone https://github.com/niCodeLine/dictoat.git

or just copy-paste it into your code.

Usage

To use Dictoat, simply import the Dictoat class in your Python project and pass a dictionary as an argument. For example:

from dictoat import Dictoat

# Example of using Dictoat
apple_dict = {"flavor": "sweet", "colors": ["red", "green"],"dimentions": {"weigh": 185, "radius": 5}}
apple = Dictoat(apple_dict)

# Accessing the data
print(apple.flavor_)
print(apple.dimentions_.radius_)
print(apple.colors_)

The output would show:

sweet
5
["red", "green"]

Or a more complete example:

from dictoat import Dictoat

pokedex_dict = {
    "total_pokemons": 2,
    "region": "Kanto",
    "Pokemons": {
        "Pikachu": {
            "type": "Electric",
            "abilities": ["Static", "Lightning Rod"],
            "stats": {
                "hp": 35,
                "attack": 55,
                "defense": 40
            }
        },
        "Squirtle": {
            "type": "Water",
            "abilities": ["Torrent", "Rain Dish"],
            "stats": {
                "hp": 44,
                "attack": 48,
                "defense": 65
            },
            "evolutions": ["Wartortle", "Blastoise"]
        }
    }
}

pokedex = Dictoat(pokedex_dict)

# Accessing the data
print("Total Pokémon in Pokedex:", pokedex.total_pokemons_)
print("Pokedex Region:", pokedex.region_)

print("Pikachu Type:", pokedex.Pokemons_.Pikachu_.type_)
print("Pikachu Abilities:", pokedex.Pokemons_.Pikachu_.abilities_)
print("Pikachu HP:", pokedex.Pokemons_.Pikachu_.stats_.hp_)

print("Squirtle Type:", pokedex.Pokemons_.Squirtle_.type_)
print("Squirtle Abilities:", pokedex.Pokemons_.Squirtle_.abilities_)
print("Squirtle Defense:", pokedex.Pokemons_.Squirtle_.stats_.defense_)
print("Squirtle Evolutions:", pokedex.Pokemons_.Squirtle_.evolutions_)

With its output being:

Total Pokémon in Pokedex: 2
Pokedex Region: Kanto

Pikachu Type: Electric
Pikachu Abilities: ['Static', 'Lightning Rod']
Pikachu HP: 35

Squirtle Type: Water
Squirtle Abilities: ['Torrent', 'Rain Dish']
Squirtle Defense: 65
Squirtle Evolutions: ['Wartortle', 'Blastoise']

Features

  • Simple Conversion: Converts any dictionary into an object for easier access.
  • Deep Nesting Support: Supports nested dictionaries, creating sub-objects for each level.

Contributions

Contributions are welcome! If you have improvements or fixes, please send a pull request or open an issue in the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contact

Nico Spok - nicospok@hotmail.com GitHub: niCodeLine

Metadata

Release files for dictoat 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dictoat 1.0.2
File Size Uploaded Provenance Actions
dictoat-1.0.2.tar.gz 3.7 kB Without provenance Details for dictoat-1.0.2.tar.gz

Release files / dictoat-1.0.2.tar.gz

Download URL dictoat-1.0.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e4d41f2e98d0498a43a2661cb2069a7aea345648189f3f63fcf7256173381fbb
BLAKE2b-256 checksum
How to use checksums
ca513828ab1a5a472b80da2d05d599cddc39adf8a7a2600756e63f83c80df157
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Security for dictoat 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page