# Flatten Nested
A Python package for flattening nested data structures including lists, tuples, dictionaries, and sets.
## Installation
```bash
pip install flatten-nested
```
## Usage
```python
from flatten_nested import flatten
# Flatten a nested list
nested_list = [1, [2, 3, [4, 5]], 6]
flattened = flatten(nested_list)
print(flattened) # [1, 2, 3, 4, 5, 6]
# Flatten a nested dictionary
nested_dict = {'a': 1, 'b': {'c': 2, 'd': {'e': 3}}}
flattened = flatten(nested_dict)
print(flattened) # [('a', 1), ('b.c', 2), ('b.d.e', 3)]
# Flatten with depth limit
nested = [1, [2, [3, [4]]]]
flattened = flatten(nested, depth=1)
print(flattened) # [1, 2, [3, [4]]]
```
## Features
- Supports lists, tuples, dictionaries, and sets
- Optional depth limit for partial flattening
- Customizable dictionary key handling
- Configurable separator for nested dictionary keys
- Type hints for better IDE support
- Comprehensive test suite
- Exception handling for unsupported types
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/sathishpatel415/flatten_nested",
"name": "flatten-nested",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "flatten, nested, list, dict, tuple, set",
"author": "Sathish Kumar K",
"author_email": "sathishpatel415@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/46/74/66158f2ca43d5fa5ac28a8b786bed83e756625330a6e92c47db836e51fa6/flatten_nested-0.1.1.tar.gz",
"platform": null,
"description": "# Flatten Nested\n\nA Python package for flattening nested data structures including lists, tuples, dictionaries, and sets.\n\n## Installation\n\n```bash\npip install flatten-nested\n```\n\n## Usage\n\n```python\nfrom flatten_nested import flatten\n\n# Flatten a nested list\nnested_list = [1, [2, 3, [4, 5]], 6]\nflattened = flatten(nested_list)\nprint(flattened) # [1, 2, 3, 4, 5, 6]\n\n# Flatten a nested dictionary\nnested_dict = {'a': 1, 'b': {'c': 2, 'd': {'e': 3}}}\nflattened = flatten(nested_dict)\nprint(flattened) # [('a', 1), ('b.c', 2), ('b.d.e', 3)]\n\n# Flatten with depth limit\nnested = [1, [2, [3, [4]]]]\nflattened = flatten(nested, depth=1)\nprint(flattened) # [1, 2, [3, [4]]]\n```\n\n## Features\n\n- Supports lists, tuples, dictionaries, and sets\n- Optional depth limit for partial flattening\n- Customizable dictionary key handling\n- Configurable separator for nested dictionary keys\n- Type hints for better IDE support\n- Comprehensive test suite\n- Exception handling for unsupported types\n\n## License\n\nThis project is licensed under the MIT License.",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python package to flatten nested data structures",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://github.com/sathishpatel415/flatten_nested#readme",
"Homepage": "https://github.com/sathishpatel415/flatten_nested",
"Repository": "https://github.com/sathishpatel415/flatten_nested"
},
"split_keywords": [
"flatten",
" nested",
" list",
" dict",
" tuple",
" set"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fcffe1765a02f70fb570c24fc3df982e91351255c98159f6a6b66c4c1ae04213",
"md5": "8e8e19905be578296a5483e9fe28845c",
"sha256": "02593d59a1a9521463999cc29ff4834a4a6babaa7bd5437bbce2187696e1cae1"
},
"downloads": -1,
"filename": "flatten_nested-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e8e19905be578296a5483e9fe28845c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 5141,
"upload_time": "2024-11-25T10:23:59",
"upload_time_iso_8601": "2024-11-25T10:23:59.694170Z",
"url": "https://files.pythonhosted.org/packages/fc/ff/e1765a02f70fb570c24fc3df982e91351255c98159f6a6b66c4c1ae04213/flatten_nested-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "467466158f2ca43d5fa5ac28a8b786bed83e756625330a6e92c47db836e51fa6",
"md5": "de938e858304a1b5c7e7bd27f6b0ca8d",
"sha256": "e42c8e74a21ad7f8262c5dbfe9fc1792fed978a592e249fdb8c5a45cc2190678"
},
"downloads": -1,
"filename": "flatten_nested-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "de938e858304a1b5c7e7bd27f6b0ca8d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 4017,
"upload_time": "2024-11-25T10:24:00",
"upload_time_iso_8601": "2024-11-25T10:24:00.756127Z",
"url": "https://files.pythonhosted.org/packages/46/74/66158f2ca43d5fa5ac28a8b786bed83e756625330a6e92c47db836e51fa6/flatten_nested-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-25 10:24:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sathishpatel415",
"github_project": "flatten_nested",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "flatten-nested"
}