# Florida
<img src="https://github.com/wjbmattingly/florida/raw/main/images/florida.png" alt="florida logo" width="500" height="500">
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:
```bash
pip install florida
```
## Usage
```python
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
```python
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
```python
['structure['nested']['content']',
'structure['list'][0]['content']']
```
## License
Florida is released under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/wjbmattingly/florida",
"name": "florida",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "python utilities tools",
"author": "WJB Mattingly",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/80/e0/d614d5631ab576984ff9ff7955fe0dc7c5bde8a223a7ed1c998bed60ec64/florida-0.0.5.tar.gz",
"platform": null,
"description": "# Florida\n\n<img src=\"https://github.com/wjbmattingly/florida/raw/main/images/florida.png\" alt=\"florida logo\" width=\"500\" height=\"500\">\n\n\nWelcome 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.\n\n## Features\n\nAs of now, Florida includes the following feature:\n\n- `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.\n- `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.\n\n## Installation\n\nCurrently, Florida is not available on PyPI, so it can be installed by cloning the repository:\n\n```bash\npip install florida\n```\n\n## Usage\n\n```python\nfrom florida import dict2schema\n\n# Example dictionary\n# Example dictionary\nexample_dict = {\n 'key1': 'value1',\n 'key2': {\n 'subkey1': 'subvalue1',\n 'subkey2': {\n 'subsubkey1': 'subsubvalue1',\n \"list1\": [{\"test\": \"case\"}]\n },\n 'subkey3': 123,\n 'subkey4': [1, 2, 3]\n },\n 'key3': True\n}\n\n# Get the schema as a string\nprint(dict2schema(example_dict, indent=0))\n\n# Get the schema as a dictionary\n# print(dict2schema(example_dict, style=\"dict\"))\n```\n\n### Expected Output:\n```\nkey1 (str)\nkey2 (dict)\n subkey1 (str)\n subkey2 (dict)\n subsubkey1 (str)\n list1 (list)\n 0 (dict)\n test (str)\n subkey3 (int)\n subkey4 (list)\n 0 (int)\n 1 (int)\n 2 (int)\nkey3 (bool)\n```\n\n## Using target2index\n\n```python\nfrom florida import target2index\n\n# Example nested structure\nnested_structure = {\n 'item1': 'value1',\n 'nested': {\n 'item2': 'value2',\n 'content': 'some text',\n },\n 'list': [{'content': 'another text'}, {'item3': 'value3'}]\n}\n\n# Get the Python code to access 'content'\nprint(target2index('content', nested_structure))\n```\n\n### Expected Output\n\n```python\n['structure['nested']['content']',\n'structure['list'][0]['content']']\n\n```\n\n## License\nFlorida is released under the MIT License.\n",
"bugtrack_url": null,
"license": "",
"summary": "A collection of Python utilities to simplify coding tasks",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://github.com/wjbmattingly/florida"
},
"split_keywords": [
"python",
"utilities",
"tools"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "96d1d99743e8778e2a4295bc5f957b24ddf7dc86afc349a452709c7eb63b056d",
"md5": "21f5b5824846ec725630ce96cce2c900",
"sha256": "7f8812fa8891ae8413378801f073af33e50588fcc8058a3902ce1f567cb70ccc"
},
"downloads": -1,
"filename": "florida-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "21f5b5824846ec725630ce96cce2c900",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4802,
"upload_time": "2023-12-20T14:47:39",
"upload_time_iso_8601": "2023-12-20T14:47:39.110442Z",
"url": "https://files.pythonhosted.org/packages/96/d1/d99743e8778e2a4295bc5f957b24ddf7dc86afc349a452709c7eb63b056d/florida-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "80e0d614d5631ab576984ff9ff7955fe0dc7c5bde8a223a7ed1c998bed60ec64",
"md5": "a3129fd235b441ea38737d0bfe4b9879",
"sha256": "b6b84be80866c787feb9402fa7bc4f21f84ee316ce1e6d51292f774a61ad36af"
},
"downloads": -1,
"filename": "florida-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "a3129fd235b441ea38737d0bfe4b9879",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 3691,
"upload_time": "2023-12-20T14:47:41",
"upload_time_iso_8601": "2023-12-20T14:47:41.956017Z",
"url": "https://files.pythonhosted.org/packages/80/e0/d614d5631ab576984ff9ff7955fe0dc7c5bde8a223a7ed1c998bed60ec64/florida-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-20 14:47:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wjbmattingly",
"github_project": "florida",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "florida"
}