ncw


Namencw JSON
Version 0.4.3 PyPI version JSON
download
home_pageNone
SummaryNested collections wrapper
upload_time2025-07-24 19:16:30
maintainerNone
docs_urlNone
authorRainer Schwarzbach
requires_python>=3.10
licenseMIT No Attribution Copyright 2025 Rainer Schwarzbach Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords nested-collections
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ncw

_Nested collections wrapper_

Classes to access and/or modify data in nested collections (**dict** or **list** instances)
of **str**, **int**, **float**, **bool**, or `None`.


## Usage

Use the **Structure** class to access (deep) copies of substructures by either
a string comprised of the segments of the keys or indexes in the "path" addressing the
substructure or value in the nested collection, joined together by a separator character
(usually an ASCII dot: `.`), or a tuple of these path segments.

``` pycon
>>> serialized = '{"herbs": {"common": ["basil", "oregano", "parsley", "thyme"], "disputed": ["anise", "coriander"]}}'
>>>
>>> import json
>>> original_data = json.loads(serialized)
>>>
>>> from ncw import Structure
>>>
>>> readonly = Structure(original_data)
>>> readonly["herbs"]
{'common': ['basil', 'oregano', 'parsley', 'thyme'], 'disputed': ['anise', 'coriander']}
>>> readonly["herbs.common"]
['basil', 'oregano', 'parsley', 'thyme']
>>> readonly["herbs", "common"]
['basil', 'oregano', 'parsley', 'thyme']
>>> readonly["herbs", "common", 1]
'oregano'
>>> readonly["herbs.common.1"]
'oregano'
```

The **MutableStructure** class allows changes to the underlying data structure,
see the [documentation] for more details.

* * *
[documentation]: https://blackstream-x.gitlab.io/ncw

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ncw",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "nested-collections",
    "author": "Rainer Schwarzbach",
    "author_email": "Rainer Schwarzbach <rainer@blackstream.de>",
    "download_url": "https://files.pythonhosted.org/packages/71/17/8d08d25b58bdec6aea29bd8620a995200c18ff9576e0f3257edee96c6adb/ncw-0.4.3.tar.gz",
    "platform": null,
    "description": "# ncw\n\n_Nested collections wrapper_\n\nClasses to access and/or modify data in nested collections (**dict** or **list** instances)\nof **str**, **int**, **float**, **bool**, or `None`.\n\n\n## Usage\n\nUse the **Structure** class to access (deep) copies of substructures by either\na string comprised of the segments of the keys or indexes in the \"path\" addressing the\nsubstructure or value in the nested collection, joined together by a separator character\n(usually an ASCII dot: `.`), or a tuple of these path segments.\n\n``` pycon\n>>> serialized = '{\"herbs\": {\"common\": [\"basil\", \"oregano\", \"parsley\", \"thyme\"], \"disputed\": [\"anise\", \"coriander\"]}}'\n>>>\n>>> import json\n>>> original_data = json.loads(serialized)\n>>>\n>>> from ncw import Structure\n>>>\n>>> readonly = Structure(original_data)\n>>> readonly[\"herbs\"]\n{'common': ['basil', 'oregano', 'parsley', 'thyme'], 'disputed': ['anise', 'coriander']}\n>>> readonly[\"herbs.common\"]\n['basil', 'oregano', 'parsley', 'thyme']\n>>> readonly[\"herbs\", \"common\"]\n['basil', 'oregano', 'parsley', 'thyme']\n>>> readonly[\"herbs\", \"common\", 1]\n'oregano'\n>>> readonly[\"herbs.common.1\"]\n'oregano'\n```\n\nThe **MutableStructure** class allows changes to the underlying data structure,\nsee the [documentation] for more details.\n\n* * *\n[documentation]: https://blackstream-x.gitlab.io/ncw\n",
    "bugtrack_url": null,
    "license": "MIT No Attribution  Copyright 2025 Rainer Schwarzbach  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Nested collections wrapper",
    "version": "0.4.3",
    "project_urls": {
        "Bug Tracker": "https://gitlab.com/blackstream-x/ncw/-/issues",
        "CI": "https://gitlab.com/blackstream-x/ncw/-/pipelines",
        "Documentation": "https://blackstream-x.gitlab.io/ncw/",
        "Homepage": "https://gitlab.com/blackstream-x/ncw",
        "Repository": "https://gitlab.com/blackstream-x/ncw.git"
    },
    "split_keywords": [
        "nested-collections"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d8dc231500a5a914241c054d678008c0b2e01cb5c48d3f9a678ecb7a234f9b50",
                "md5": "ffece01c2f84f96215090de66fb366ac",
                "sha256": "315da591a0a4d456fe3bae0d9f61b4d75afdc96bf686115627c9886741295cc2"
            },
            "downloads": -1,
            "filename": "ncw-0.4.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ffece01c2f84f96215090de66fb366ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 10393,
            "upload_time": "2025-07-24T19:16:29",
            "upload_time_iso_8601": "2025-07-24T19:16:29.167248Z",
            "url": "https://files.pythonhosted.org/packages/d8/dc/231500a5a914241c054d678008c0b2e01cb5c48d3f9a678ecb7a234f9b50/ncw-0.4.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "71178d08d25b58bdec6aea29bd8620a995200c18ff9576e0f3257edee96c6adb",
                "md5": "4bdcc501ed6e0437d3f911c16a7aa318",
                "sha256": "b0c283134fead617a119178e85fab5dcc1474045c2886b5c520139f820fbf9e8"
            },
            "downloads": -1,
            "filename": "ncw-0.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4bdcc501ed6e0437d3f911c16a7aa318",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 8173,
            "upload_time": "2025-07-24T19:16:30",
            "upload_time_iso_8601": "2025-07-24T19:16:30.321993Z",
            "url": "https://files.pythonhosted.org/packages/71/17/8d08d25b58bdec6aea29bd8620a995200c18ff9576e0f3257edee96c6adb/ncw-0.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-24 19:16:30",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "blackstream-x",
    "gitlab_project": "ncw",
    "lcname": "ncw"
}
        
Elapsed time: 1.36058s