Skip to main content

A collection of Python utilities to simplify coding tasks

Project description

Florida

florida logo

Welcome to Florida, a Python utility library designed to simplify and enhance your coding experience. Florida is built with the goal of providing easy-to-use, efficient tools to aid developers in various tasks, making coding more intuitive and productive.

Features

As of now, Florida includes the following feature:

  • dict2schema: A function that generates a schema of a dictionary's organization, showing each key and the type of its value. The schema can be returned as a string or as a nested dictionary.
  • target2index: A function that takes in a nested dictionary or list and a target key or index, and returns Python code snippets to access instances of that key or index. It's useful for navigating complex nested structures.

Installation

Currently, Florida is not available on PyPI, so it can be installed by cloning the repository:

pip install florida

Usage

from florida import dict2schema

# Example dictionary
# Example dictionary
example_dict = {
    'key1': 'value1',
    'key2': {
        'subkey1': 'subvalue1',
        'subkey2': {
            'subsubkey1': 'subsubvalue1',
            "list1": [{"test": "case"}]
        },
        'subkey3': 123,
        'subkey4': [1, 2, 3]
    },
    'key3': True
}

# Get the schema as a string
print(dict2schema(example_dict, indent=0))

# Get the schema as a dictionary
# print(dict2schema(example_dict, style="dict"))

Expected Output:

key1 (str)
key2 (dict)
    subkey1 (str)
    subkey2 (dict)
        subsubkey1 (str)
        list1 (list)
            0 (dict)
                test (str)
    subkey3 (int)
    subkey4 (list)
        0 (int)
        1 (int)
        2 (int)
key3 (bool)

Using target2index

from florida import target2index

# Example nested structure
nested_structure = {
    'item1': 'value1',
    'nested': {
        'item2': 'value2',
        'content': 'some text',
    },
    'list': [{'content': 'another text'}, {'item3': 'value3'}]
}

# Get the Python code to access 'content'
print(target2index('content', nested_structure))

Expected Output

['structure['nested']['content']',
'structure['list'][0]['content']']

License

Florida is released under the MIT License.

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

florida-0.0.6.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

florida-0.0.6-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file florida-0.0.6.tar.gz.

File metadata

  • Download URL: florida-0.0.6.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for florida-0.0.6.tar.gz
Algorithm Hash digest
SHA256 7bf3dea5bc765c282ef040eb1f0657e0b63928e8b8538e8070f0bb9cdd3489d5
MD5 5569c5eafc3262802d5d2bddc444a958
BLAKE2b-256 845672d923251d657587c8c72145c7976bec46b089deab469ddcdf7f86e2d304

See more details on using hashes here.

File details

Details for the file florida-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: florida-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for florida-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c09c812b5b55b452024d825bf5348189dbd78d832ed39af5f3c04874cf3eaa24
MD5 6e92b8784761113461d60a4aaafd52bb
BLAKE2b-256 74e207f2310107d139a7ecc93c6531b09f3a3236fa9409dbcebe5c3ae131c3bb

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