makeflatt


Namemakeflatt JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/jaswdr/makeflatt
SummarySimple library to make your dictionary flatten
upload_time2022-12-19 13:03:35
maintainer
docs_urlNone
authorJonathan Schweder
requires_python>=3.8.1,<3.12
licenseMIT
keywords makeflatt dict dictionaries flatten
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MakeFlatt
> Simple library to make your dictionary flatten in Python

[![PyPI version](https://badge.fury.io/py/makeflatt.svg)](https://badge.fury.io/py/makeflatt)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/makeflatt)
[![Unit Tests](https://github.com/jaswdr/makeflatt/actions/workflows/unit-tests.yml/badge.svg?branch=master)](https://github.com/jaswdr/makeflatt/actions/workflows/unit-tests.yml)
![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)
![PyPI - License](https://img.shields.io/pypi/l/makeflatt)


### Installation

```bash
pip install makeflatt
```

### Usage

Quick start:

```python
>>> from makeflatt import FlattMaker
>>> mf = FlattMaker()
>>> mf.apply({"a": {"b": {"c": "test"}}})
{'a.b.c': 'test'}
```

Make nested structured flatten:

```python
>>> mf.apply({"a": {"b": ["b1", "b2", "b3"]}})
{'a.b.0': 'b1', 'a.b.1': 'b2', 'a.b.2': 'b3'}
```

If you don't wan't to expand nested lists you can set `include_lists` to `False`:

```python
>>> mf.apply({"a": {"b": ["b1", "b2", "b3"]}}, include_lists=False)
{'a.b': ['b1', 'b2', 'b3']}
```

You can also change the separator and define your own:

```python
>>> mf = FlattMaker(sep=":")
>>> mf.apply({"a": {"b": ["b1", "b2", "b3"]}})
{'a:b:0': 'b1', 'a:b:1': 'b2', 'a:b:2': 'b3'}
```

### License

MakeFlatt is released under the MIT Licence. See the bundled LICENSE file for details.

### Development

Check the [CONTRIBUTING](CONTRIBUTING.md) file.

### Versioning

This package attempts to use semantic versioning. API changes are indicated by the major version, non-breaking improvements by the minor, and bug fixes in the revision.

It is recommended that you pin your targets to greater or equal to the current version and less than the next major version.

### Maintainer

Created and maitained by Jonathan Schweder (@jaswdr)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jaswdr/makeflatt",
    "name": "makeflatt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.1,<3.12",
    "maintainer_email": "",
    "keywords": "makeflatt,dict,dictionaries,flatten",
    "author": "Jonathan Schweder",
    "author_email": "jonathanschweder@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8e/ba/70be3905af2492cfaf80141d91819df17eae19c50501e295c2bcec3f6eef/makeflatt-1.0.4.tar.gz",
    "platform": null,
    "description": "# MakeFlatt\n> Simple library to make your dictionary flatten in Python\n\n[![PyPI version](https://badge.fury.io/py/makeflatt.svg)](https://badge.fury.io/py/makeflatt)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/makeflatt)\n[![Unit Tests](https://github.com/jaswdr/makeflatt/actions/workflows/unit-tests.yml/badge.svg?branch=master)](https://github.com/jaswdr/makeflatt/actions/workflows/unit-tests.yml)\n![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)\n![PyPI - License](https://img.shields.io/pypi/l/makeflatt)\n\n\n### Installation\n\n```bash\npip install makeflatt\n```\n\n### Usage\n\nQuick start:\n\n```python\n>>> from makeflatt import FlattMaker\n>>> mf = FlattMaker()\n>>> mf.apply({\"a\": {\"b\": {\"c\": \"test\"}}})\n{'a.b.c': 'test'}\n```\n\nMake nested structured flatten:\n\n```python\n>>> mf.apply({\"a\": {\"b\": [\"b1\", \"b2\", \"b3\"]}})\n{'a.b.0': 'b1', 'a.b.1': 'b2', 'a.b.2': 'b3'}\n```\n\nIf you don't wan't to expand nested lists you can set `include_lists` to `False`:\n\n```python\n>>> mf.apply({\"a\": {\"b\": [\"b1\", \"b2\", \"b3\"]}}, include_lists=False)\n{'a.b': ['b1', 'b2', 'b3']}\n```\n\nYou can also change the separator and define your own:\n\n```python\n>>> mf = FlattMaker(sep=\":\")\n>>> mf.apply({\"a\": {\"b\": [\"b1\", \"b2\", \"b3\"]}})\n{'a:b:0': 'b1', 'a:b:1': 'b2', 'a:b:2': 'b3'}\n```\n\n### License\n\nMakeFlatt is released under the MIT Licence. See the bundled LICENSE file for details.\n\n### Development\n\nCheck the [CONTRIBUTING](CONTRIBUTING.md) file.\n\n### Versioning\n\nThis package attempts to use semantic versioning. API changes are indicated by the major version, non-breaking improvements by the minor, and bug fixes in the revision.\n\nIt is recommended that you pin your targets to greater or equal to the current version and less than the next major version.\n\n### Maintainer\n\nCreated and maitained by Jonathan Schweder (@jaswdr)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple library to make your dictionary flatten",
    "version": "1.0.4",
    "split_keywords": [
        "makeflatt",
        "dict",
        "dictionaries",
        "flatten"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "5d4fb669d1a37b0d4dbc8160748338b1",
                "sha256": "3f76931c4d804cfd8eeff956c836346632c977f291e7628e899a0c6454fd39ce"
            },
            "downloads": -1,
            "filename": "makeflatt-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5d4fb669d1a37b0d4dbc8160748338b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<3.12",
            "size": 3457,
            "upload_time": "2022-12-19T13:03:33",
            "upload_time_iso_8601": "2022-12-19T13:03:33.786238Z",
            "url": "https://files.pythonhosted.org/packages/ea/60/657994e7b9507924b02f8cfdafa7b5b6d199d3d6edff37e025989d01a094/makeflatt-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "124a0d5ebcc110539f37077872d73016",
                "sha256": "25b2b4533ec01a5841f23b53431baa83713a090f09e548b633923e33f47c8896"
            },
            "downloads": -1,
            "filename": "makeflatt-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "124a0d5ebcc110539f37077872d73016",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<3.12",
            "size": 3375,
            "upload_time": "2022-12-19T13:03:35",
            "upload_time_iso_8601": "2022-12-19T13:03:35.151171Z",
            "url": "https://files.pythonhosted.org/packages/8e/ba/70be3905af2492cfaf80141d91819df17eae19c50501e295c2bcec3f6eef/makeflatt-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-19 13:03:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "jaswdr",
    "github_project": "makeflatt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "makeflatt"
}
        
Elapsed time: 0.02299s