nestednop


Namenestednop JSON
Version 0.1 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/nestednop
SummaryEditing deeply nested dicts/lists becomes the easiest thing in the world...
upload_time2022-10-13 02:40:58
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords list dict python nested
VCS
bugtrack_url
requirements cprinter flatten_any_dict_iterable_or_whatsoever useful_functions_easier_life
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
## Library to update nested dicts and lists



You can change the values in a flattened version of your dict that NestedNop creates for you. After you editing, NestedNop updates the original structure automatically.



```python

pip install nestednop 

```



```python

    dictoriginal=data={'level1': {'t1': {'s1': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9},

                   's2': {'col1': 1, 'col2': 5, 'col3': 4, 'col4': 8},

                   's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},

                   's4': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9}},

            't2': {'s1': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9},

                   's2': {'col1': 1, 'col2': 5, 'col3': 4, 'col4': 8},

                   's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},

                   's4': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9}},

            't3': {'s1': {'col1': 1, 'col2': 2, 'col3': 3, 'col4': 4},

                   's2': {'col1': 5, 'col2': 6, 'col3': 7, 'col4': 8},

                   's3': {'col1': 9, 'col2': 10, 'col3': 11, 'col4': 12},

                   's4': {'col1': 13, 'col2': 14, 'col3': 15, 'col4': 16}}},

    'level2': {'t1': {'s1': {'col1': 5, 'col2': 4, 'col3': 9, 'col4': 9},

                   's2': {'col1': 1, 'col2': 5, 'col3': 4, 'col4': 5},

                   's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 13},

                   's4': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 20}},

            't2': {'s1': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9},

                   's2': {'col1': 1, 'col2': 5, 'col3': 4, 'col4': 8},

                   's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},

                   's4': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9}},

            't3': {'s1': {'col1': 1, 'col2': 2, 'col3': 3, 'col4': 4},

                   's2': {'col1': 5, 'col2': 6, 'col3': 7, 'col4': 8},

                   's3': {'col1': 9, 'col2': 10, 'col3': 11, 'col4': 12},

                   's4': {'col1': 13, 'col2': 14, 'col3': 15, 'col4': 16}}}}



    from nestednop import NestedNop

    nest=NestedNop(dictoriginal)

    for key, item in nest.iterable_flat.items():

        if item['get_value']() == 4 and key[-1] == 'col3':

            item['set_value'](400000000000000)



    updatediter = nest.get_updated_iterable()





    updatediter

    {'level1': {'t1': {'s1': {'col1': 5,

        'col2': 4,

        'col3': 400000000000000,

        'col4': 9},

       's2': {'col1': 1, 'col2': 5, 'col3': 400000000000000, 'col4': 8},

       's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},

       's4': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9}},

      't2': {'s1': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9},

       's2': {'col1': 1, 'col2': 5, 'col3': 400000000000000, 'col4': 8},

       's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},

       's4': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9}},

      't3': {'s1': {'col1': 1, 'col2': 2, 'col3': 3, 'col4': 4},

       's2': {'col1': 5, 'col2': 6, 'col3': 7, 'col4': 8},

       's3': {'col1': 9, 'col2': 10, 'col3': 11, 'col4': 12},

       's4': {'col1': 13, 'col2': 14, 'col3': 15, 'col4': 16}}},

     'level2': {'t1': {'s1': {'col1': 5, 'col2': 4, 'col3': 9, 'col4': 9},

       's2': {'col1': 1, 'col2': 5, 'col3': 400000000000000, 'col4': 5},

       's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 13},

       's4': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 20}},

      't2': {'s1': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9},

       's2': {'col1': 1, 'col2': 5, 'col3': 400000000000000, 'col4': 8},

       's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},

       's4': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9}},

      't3': {'s1': {'col1': 1, 'col2': 2, 'col3': 3, 'col4': 4},

       's2': {'col1': 5, 'col2': 6, 'col3': 7, 'col4': 8},

       's3': {'col1': 9, 'col2': 10, 'col3': 11, 'col4': 12},

       's4': {'col1': 13, 'col2': 14, 'col3': 15, 'col4': 16}}}}

```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/nestednop",
    "name": "nestednop",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "list,dict,python,nested",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/df/5c/8c3505b8a8d11540e47e90a93631357ef6d6e7c1d1b8be0fcaef46317689/nestednop-0.1.tar.gz",
    "platform": null,
    "description": "\n## Library to update nested dicts and lists\n\n\n\nYou can change the values in a flattened version of your dict that NestedNop creates for you. After you editing, NestedNop updates the original structure automatically.\n\n\n\n```python\n\npip install nestednop \n\n```\n\n\n\n```python\n\n    dictoriginal=data={'level1': {'t1': {'s1': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9},\n\n                   's2': {'col1': 1, 'col2': 5, 'col3': 4, 'col4': 8},\n\n                   's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},\n\n                   's4': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9}},\n\n            't2': {'s1': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9},\n\n                   's2': {'col1': 1, 'col2': 5, 'col3': 4, 'col4': 8},\n\n                   's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},\n\n                   's4': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9}},\n\n            't3': {'s1': {'col1': 1, 'col2': 2, 'col3': 3, 'col4': 4},\n\n                   's2': {'col1': 5, 'col2': 6, 'col3': 7, 'col4': 8},\n\n                   's3': {'col1': 9, 'col2': 10, 'col3': 11, 'col4': 12},\n\n                   's4': {'col1': 13, 'col2': 14, 'col3': 15, 'col4': 16}}},\n\n    'level2': {'t1': {'s1': {'col1': 5, 'col2': 4, 'col3': 9, 'col4': 9},\n\n                   's2': {'col1': 1, 'col2': 5, 'col3': 4, 'col4': 5},\n\n                   's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 13},\n\n                   's4': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 20}},\n\n            't2': {'s1': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9},\n\n                   's2': {'col1': 1, 'col2': 5, 'col3': 4, 'col4': 8},\n\n                   's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},\n\n                   's4': {'col1': 5, 'col2': 4, 'col3': 4, 'col4': 9}},\n\n            't3': {'s1': {'col1': 1, 'col2': 2, 'col3': 3, 'col4': 4},\n\n                   's2': {'col1': 5, 'col2': 6, 'col3': 7, 'col4': 8},\n\n                   's3': {'col1': 9, 'col2': 10, 'col3': 11, 'col4': 12},\n\n                   's4': {'col1': 13, 'col2': 14, 'col3': 15, 'col4': 16}}}}\n\n\n\n    from nestednop import NestedNop\n\n    nest=NestedNop(dictoriginal)\n\n    for key, item in nest.iterable_flat.items():\n\n        if item['get_value']() == 4 and key[-1] == 'col3':\n\n            item['set_value'](400000000000000)\n\n\n\n    updatediter = nest.get_updated_iterable()\n\n\n\n\n\n    updatediter\n\n    {'level1': {'t1': {'s1': {'col1': 5,\n\n        'col2': 4,\n\n        'col3': 400000000000000,\n\n        'col4': 9},\n\n       's2': {'col1': 1, 'col2': 5, 'col3': 400000000000000, 'col4': 8},\n\n       's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},\n\n       's4': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9}},\n\n      't2': {'s1': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9},\n\n       's2': {'col1': 1, 'col2': 5, 'col3': 400000000000000, 'col4': 8},\n\n       's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},\n\n       's4': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9}},\n\n      't3': {'s1': {'col1': 1, 'col2': 2, 'col3': 3, 'col4': 4},\n\n       's2': {'col1': 5, 'col2': 6, 'col3': 7, 'col4': 8},\n\n       's3': {'col1': 9, 'col2': 10, 'col3': 11, 'col4': 12},\n\n       's4': {'col1': 13, 'col2': 14, 'col3': 15, 'col4': 16}}},\n\n     'level2': {'t1': {'s1': {'col1': 5, 'col2': 4, 'col3': 9, 'col4': 9},\n\n       's2': {'col1': 1, 'col2': 5, 'col3': 400000000000000, 'col4': 5},\n\n       's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 13},\n\n       's4': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 20}},\n\n      't2': {'s1': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9},\n\n       's2': {'col1': 1, 'col2': 5, 'col3': 400000000000000, 'col4': 8},\n\n       's3': {'col1': 11, 'col2': 8, 'col3': 2, 'col4': 9},\n\n       's4': {'col1': 5, 'col2': 4, 'col3': 400000000000000, 'col4': 9}},\n\n      't3': {'s1': {'col1': 1, 'col2': 2, 'col3': 3, 'col4': 4},\n\n       's2': {'col1': 5, 'col2': 6, 'col3': 7, 'col4': 8},\n\n       's3': {'col1': 9, 'col2': 10, 'col3': 11, 'col4': 12},\n\n       's4': {'col1': 13, 'col2': 14, 'col3': 15, 'col4': 16}}}}\n\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Editing deeply nested dicts/lists becomes the easiest thing in the world...",
    "version": "0.1",
    "split_keywords": [
        "list",
        "dict",
        "python",
        "nested"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "e59566f97e168f67d44aafd43582d558",
                "sha256": "64183e486ee3ac4bf0350d26a0163986a4a73bb8d65b98ebc6f97c3e753c66a2"
            },
            "downloads": -1,
            "filename": "nestednop-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e59566f97e168f67d44aafd43582d558",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6810,
            "upload_time": "2022-10-13T02:40:56",
            "upload_time_iso_8601": "2022-10-13T02:40:56.086695Z",
            "url": "https://files.pythonhosted.org/packages/06/99/f98ec0bf31a3593d12878f46ed4fe56bf59beb2b92db4a4608ece398b747/nestednop-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "b2d603395ae19fdb90a81917641daf48",
                "sha256": "f98b6ec8575898255ed03b80794a03492f100689f3e21051f42d2f16033cea47"
            },
            "downloads": -1,
            "filename": "nestednop-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b2d603395ae19fdb90a81917641daf48",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5730,
            "upload_time": "2022-10-13T02:40:58",
            "upload_time_iso_8601": "2022-10-13T02:40:58.492858Z",
            "url": "https://files.pythonhosted.org/packages/df/5c/8c3505b8a8d11540e47e90a93631357ef6d6e7c1d1b8be0fcaef46317689/nestednop-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-10-13 02:40:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hansalemaos",
    "github_project": "nestednop",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "cprinter",
            "specs": []
        },
        {
            "name": "flatten_any_dict_iterable_or_whatsoever",
            "specs": []
        },
        {
            "name": "useful_functions_easier_life",
            "specs": []
        }
    ],
    "lcname": "nestednop"
}
        
Elapsed time: 0.02929s