Metadata-Version: 2.3
Name: ncw
Version: 0.4.4
Summary: Nested collections wrapper
Keywords: nested-collections
Author: Rainer Schwarzbach
Author-email: Rainer Schwarzbach <rainer@blackstream.de>
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.
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Intended Audience :: Developers
Requires-Dist: tomli>=1.1.0 ; python_full_version < '3.11'
Requires-Python: >=3.10
Project-URL: Bug Tracker, https://gitlab.com/blackstream-x/ncw/-/issues
Project-URL: CI, https://gitlab.com/blackstream-x/ncw/-/pipelines
Project-URL: Documentation, https://blackstream-x.gitlab.io/ncw/
Project-URL: Homepage, https://gitlab.com/blackstream-x/ncw
Project-URL: Repository, https://gitlab.com/blackstream-x/ncw.git
Description-Content-Type: text/markdown

# 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
