nested-mapping 0.10.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. nested_mapping-0.10.2/LICENSE +21 -0
  2. nested_mapping-0.10.2/PKG-INFO +43 -0
  3. nested_mapping-0.10.2/README.md +16 -0
  4. nested_mapping-0.10.2/pyproject.toml +42 -0
  5. nested_mapping-0.10.2/setup.cfg +4 -0
  6. nested_mapping-0.10.2/src/nested_mapping/__init__.py +2 -0
  7. nested_mapping-0.10.2/src/nested_mapping/class_wrapper.py +53 -0
  8. nested_mapping-0.10.2/src/nested_mapping/ipython.py +3 -0
  9. nested_mapping-0.10.2/src/nested_mapping/nested_mapping.py +611 -0
  10. nested_mapping-0.10.2/src/nested_mapping/nested_mapping_access.py +47 -0
  11. nested_mapping-0.10.2/src/nested_mapping/tools/__init__.py +4 -0
  12. nested_mapping-0.10.2/src/nested_mapping/tools/filter.py +34 -0
  13. nested_mapping-0.10.2/src/nested_mapping/tools/map.py +166 -0
  14. nested_mapping-0.10.2/src/nested_mapping/tools/match.py +128 -0
  15. nested_mapping-0.10.2/src/nested_mapping/tools/reorder_key.py +9 -0
  16. nested_mapping-0.10.2/src/nested_mapping/typing.py +41 -0
  17. nested_mapping-0.10.2/src/nested_mapping/visitor.py +65 -0
  18. nested_mapping-0.10.2/src/nested_mapping.egg-info/PKG-INFO +43 -0
  19. nested_mapping-0.10.2/src/nested_mapping.egg-info/SOURCES.txt +26 -0
  20. nested_mapping-0.10.2/src/nested_mapping.egg-info/dependency_links.txt +1 -0
  21. nested_mapping-0.10.2/src/nested_mapping.egg-info/requires.txt +7 -0
  22. nested_mapping-0.10.2/src/nested_mapping.egg-info/top_level.txt +1 -0
  23. nested_mapping-0.10.2/tests/test_filter.py +44 -0
  24. nested_mapping-0.10.2/tests/test_map.py +229 -0
  25. nested_mapping-0.10.2/tests/test_match.py +73 -0
  26. nested_mapping-0.10.2/tests/test_nested_mapping.py +526 -0
  27. nested_mapping-0.10.2/tests/test_nested_mapping_update.py +86 -0
  28. nested_mapping-0.10.2/tests/test_visitor.py +32 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Gonchar Maxim, Tsegelnik Nikita
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.4
2
+ Name: nested-mapping
3
+ Version: 0.10.2
4
+ Summary: Package to work with nested dictionaries supporing list/set as keys
5
+ Author-email: DAGModelling Team <dagflow@jinr.ru>
6
+ Maintainer-email: DAGModelling Team <dagflow@jinr.ru>
7
+ License-Expression: MIT
8
+ Project-URL: Bug Tracker, https://github.com/dagflow-team/nested-mapping/issues
9
+ Project-URL: DAGModelling Team, https://github.com/dagflow-team
10
+ Project-URL: documentation, https://github.com/dagflow-team/nested-mapping/wiki
11
+ Project-URL: homepage, https://github.com/dagflow-team/nested-mapping
12
+ Project-URL: repository, https://github.com/dagflow-team/nested-mapping
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: numpy
21
+ Requires-Dist: ordered-set
22
+ Provides-Extra: test
23
+ Requires-Dist: coverage; extra == "test"
24
+ Requires-Dist: pytest; extra == "test"
25
+ Requires-Dist: pytest-cov; extra == "test"
26
+ Dynamic: license-file
27
+
28
+ # Summary
29
+
30
+ [![python](https://img.shields.io/badge/python-3.11-purple.svg)](https://www.python.org/)
31
+ [![pipeline](https://git.jinr.ru/dagflow-team/nested-mapping/badges/master/pipeline.svg)](https://git.jinr.ru/dagflow-team/nested-mapping/commits/master)
32
+ [![coverage report](https://git.jinr.ru/dagflow-team/nested-mapping/badges/master/coverage.svg)](https://git.jinr.ru/dagflow-team/nested-mapping/-/commits/master)
33
+ <!--- Uncomment here after adding docs!
34
+ [![pages](https://img.shields.io/badge/pages-link-white.svg)](http://dagflow-team.pages.jinr.ru/nested-mapping)
35
+ -->
36
+
37
+ A package to work with nested dictionaries.
38
+
39
+ # Repositories
40
+
41
+ - Development/CI: https://git.jinr.ru/dagflow-team/nested-mapping
42
+ - Contact/pypi/mirror: https://github.com/dagflow-team/nested-mapping
43
+ - PYPI: https://pypi.org/project/nested-mapping
@@ -0,0 +1,16 @@
1
+ # Summary
2
+
3
+ [![python](https://img.shields.io/badge/python-3.11-purple.svg)](https://www.python.org/)
4
+ [![pipeline](https://git.jinr.ru/dagflow-team/nested-mapping/badges/master/pipeline.svg)](https://git.jinr.ru/dagflow-team/nested-mapping/commits/master)
5
+ [![coverage report](https://git.jinr.ru/dagflow-team/nested-mapping/badges/master/coverage.svg)](https://git.jinr.ru/dagflow-team/nested-mapping/-/commits/master)
6
+ <!--- Uncomment here after adding docs!
7
+ [![pages](https://img.shields.io/badge/pages-link-white.svg)](http://dagflow-team.pages.jinr.ru/nested-mapping)
8
+ -->
9
+
10
+ A package to work with nested dictionaries.
11
+
12
+ # Repositories
13
+
14
+ - Development/CI: https://git.jinr.ru/dagflow-team/nested-mapping
15
+ - Contact/pypi/mirror: https://github.com/dagflow-team/nested-mapping
16
+ - PYPI: https://pypi.org/project/nested-mapping
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+
4
+ requires = [ "packaging", "setuptools", "wheel" ]
5
+
6
+ [project]
7
+ name = "nested-mapping"
8
+ version = "0.10.2"
9
+ description = "Package to work with nested dictionaries supporing list/set as keys"
10
+ readme = "README.md"
11
+ license = "MIT"
12
+ maintainers = [ { name = "DAGModelling Team", email = "dagflow@jinr.ru" } ]
13
+ authors = [ { name = "DAGModelling Team", email = "dagflow@jinr.ru" } ]
14
+ requires-python = ">=3.11"
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3 :: Only",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ ]
21
+ dependencies = [ "numpy", "ordered-set" ]
22
+
23
+ optional-dependencies.test = [ "coverage", "pytest", "pytest-cov" ]
24
+ urls."Bug Tracker" = "https://github.com/dagflow-team/nested-mapping/issues"
25
+ urls."DAGModelling Team" = "https://github.com/dagflow-team"
26
+ urls.documentation = "https://github.com/dagflow-team/nested-mapping/wiki"
27
+ urls.homepage = "https://github.com/dagflow-team/nested-mapping"
28
+ urls.repository = "https://github.com/dagflow-team/nested-mapping"
29
+
30
+ [tool.setuptools.packages.find]
31
+ where = [ "src" ]
32
+ exclude = [
33
+ "tests*",
34
+ ]
35
+
36
+ [tool.black]
37
+ line-length = 100
38
+
39
+ [tool.isort]
40
+ profile = "black"
41
+ line_length = 100
42
+ multi_line_output = 5
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ from .nested_mapping import NestedMapping, walkitems, walkkeys, walkvalues
2
+ from .nested_mapping_access import NestedMappingAccess
@@ -0,0 +1,53 @@
1
+ from typing import Any
2
+
3
+
4
+ class ClassWrapper:
5
+ __slots__ = ("_object", "_types", "_wrapper_class")
6
+ _object: Any
7
+ _types: Any
8
+ _wrapper_class: Any
9
+
10
+ def __init__(self, obj, *, types=None):
11
+ self._object = obj
12
+ self._types = type(obj) if types is None else types
13
+ self._wrapper_class = type(self)
14
+
15
+ @property
16
+ def object(self) -> Any:
17
+ return self._object
18
+
19
+ def __str__(self) -> str:
20
+ return str(self._object)
21
+
22
+ def __repr__(self) -> str:
23
+ return repr(self._object)
24
+
25
+ def __dir__(self) -> list[str]:
26
+ return dir(self._object)
27
+
28
+ def __len__(self) -> int:
29
+ return len(self._object)
30
+
31
+ def __bool__(self) -> bool:
32
+ return bool(self._object)
33
+
34
+ def __contains__(self, v) -> bool:
35
+ return v in self._object
36
+
37
+ def __eq__(self, other) -> bool:
38
+ if isinstance(other, ClassWrapper):
39
+ return self._object == other._object
40
+
41
+ return self._object == other
42
+
43
+ def _wrap(self, obj, **kwargs) -> Any:
44
+ if isinstance(obj, ClassWrapper):
45
+ return obj
46
+
47
+ if isinstance(obj, self._types):
48
+ return self._wrapper_class(obj, **kwargs)
49
+
50
+ return obj
51
+
52
+ def _wrap_(self, obj, **kwargs) -> Any:
53
+ return self._wrapper_class(obj, **kwargs)
@@ -0,0 +1,3 @@
1
+ def repr_pretty(self, p, cycle):
2
+ """Pretty repr for IPython. To be used as __repr__ method"""
3
+ p.text("..." if cycle else str(self))