Z0Z-tools 2.2.2__tar.gz → 2.2.3__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.
- {z0z_tools-2.2.2/Z0Z_tools.egg-info → z0z_tools-2.2.3}/PKG-INFO +10 -1
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/README.md +7 -0
- z0z_tools-2.2.3/Z0Z_tools/__init__.py +11 -0
- z0z_tools-2.2.3/Z0Z_tools/functionsNeedAHome.py +236 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3/Z0Z_tools.egg-info}/PKG-INFO +10 -1
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/Z0Z_tools.egg-info/SOURCES.txt +1 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/Z0Z_tools.egg-info/requires.txt +2 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/dicttoolz.c +1693 -1427
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/dicttoolz.pyx +42 -36
- z0z_tools-2.2.3/humpy_cytoolz/tests/test_dicttoolz.py +447 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/_theTypes.py +6 -13
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/curried/__init__.py +1 -1
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/dicttoolz.py +193 -169
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/itertoolz.py +20 -28
- z0z_tools-2.2.3/humpy_toolz/sandbox/__init__.py +7 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/sandbox/core.py +2 -1
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/sandbox/parallel.py +1 -1
- z0z_tools-2.2.3/humpy_toolz/sandbox/tests/__init__.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/sandbox/tests/test_core.py +1 -1
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/sandbox/tests/test_parallel.py +1 -1
- z0z_tools-2.2.3/humpy_toolz/tests/__init__.py +0 -0
- z0z_tools-2.2.3/humpy_toolz/tests/test_dicttoolz.py +447 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_functoolz.py +2 -2
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/pyproject.toml +5 -8
- z0z_tools-2.2.2/Z0Z_tools/__init__.py +0 -7
- z0z_tools-2.2.2/humpy_cytoolz/tests/test_dicttoolz.py +0 -440
- z0z_tools-2.2.2/humpy_toolz/sandbox/__init__.py +0 -6
- z0z_tools-2.2.2/humpy_toolz/sandbox/tests/__init__.py +0 -1
- z0z_tools-2.2.2/humpy_toolz/tests/__init__.py +0 -1
- z0z_tools-2.2.2/humpy_toolz/tests/test_dicttoolz.py +0 -827
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/LICENSE +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/LICENSE-Rocklin +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/LICENSE-Welch +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/Z0Z_tools/py.typed +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/Z0Z_tools.egg-info/dependency_links.txt +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/Z0Z_tools.egg-info/top_level.txt +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/__init__.pxd +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/__init__.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/__init__.pyi +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/_signatures.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/_signatures.pyi +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/_theTypes.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/cpython.pxd +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/curried/__init__.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/curried/exceptions.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/curried/exceptions.pyi +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/curried/operator.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/dicttoolz.pxd +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/dicttoolz.pyi +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/functoolz.c +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/functoolz.pxd +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/functoolz.pyi +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/functoolz.pyx +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/itertoolz.c +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/itertoolz.pxd +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/itertoolz.pyi +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/itertoolz.pyx +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/py.typed +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/recipes.c +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/recipes.pxd +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/recipes.pyi +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/recipes.pyx +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/__init__.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/dev_skip_test.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_curried.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_curried_toolzlike.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_dev_skip_test.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_docstrings.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_doctests.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_embedded_sigs.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_functoolz.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_inspect_args.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_itertoolz.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_none_safe.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_recipes.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_serialization.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_signatures.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_stubs.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_tlz.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/tests/test_utils.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/utils.c +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/utils.pxd +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/utils.pyi +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_cytoolz/utils.pyx +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_tlz/__init__.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_tlz/_build_tlz.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/__init__.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/_signatures.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/curried/exceptions.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/curried/operator.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/functoolz.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/py.typed +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/recipes.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_curried.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_curried_doctests.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_inspect_args.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_itertoolz.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_package.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_recipes.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_serialization.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_signatures.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_tlz.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/tests/test_utils.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/humpy_toolz/utils.py +0 -0
- {z0z_tools-2.2.2 → z0z_tools-2.2.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Z0Z_tools
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: Typing, documenting, and improving toolz and cytoolz.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License-Expression: CC-BY-NC-4.0
|
|
@@ -35,6 +35,8 @@ Provides-Extra: development
|
|
|
35
35
|
Requires-Dist: astToolkit; extra == "development"
|
|
36
36
|
Requires-Dist: hunterMakesPy; extra == "development"
|
|
37
37
|
Requires-Dist: pytest-cov; extra == "development"
|
|
38
|
+
Requires-Dist: cython>=3.0; extra == "development"
|
|
39
|
+
Requires-Dist: setuptools>=74.1.0; extra == "development"
|
|
38
40
|
Provides-Extra: testing
|
|
39
41
|
Requires-Dist: pytest; extra == "testing"
|
|
40
42
|
Dynamic: license-file
|
|
@@ -90,6 +92,13 @@ from humpy_cytoolz.curried import operator
|
|
|
90
92
|
pip install Z0Z_tools
|
|
91
93
|
```
|
|
92
94
|
|
|
95
|
+
## Sources
|
|
96
|
+
|
|
97
|
+
1. [toolz](https://github.com/pytoolz/toolz)
|
|
98
|
+
2. [cytoolz](https://github.com/pytoolz/cytoolz)
|
|
99
|
+
3. [toolz-stubs](https://github.com/mgrinshpon/toolz-stubs)
|
|
100
|
+
4. [cytoolz-stubs](https://github.com/OutSquareCapital/cytoolz-stubs)
|
|
101
|
+
|
|
93
102
|
## My recovery
|
|
94
103
|
|
|
95
104
|
[](https://HunterThinks.com/support)
|
|
@@ -49,6 +49,13 @@ from humpy_cytoolz.curried import operator
|
|
|
49
49
|
pip install Z0Z_tools
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
## Sources
|
|
53
|
+
|
|
54
|
+
1. [toolz](https://github.com/pytoolz/toolz)
|
|
55
|
+
2. [cytoolz](https://github.com/pytoolz/cytoolz)
|
|
56
|
+
3. [toolz-stubs](https://github.com/mgrinshpon/toolz-stubs)
|
|
57
|
+
4. [cytoolz-stubs](https://github.com/OutSquareCapital/cytoolz-stubs)
|
|
58
|
+
|
|
52
59
|
## My recovery
|
|
53
60
|
|
|
54
61
|
[](https://HunterThinks.com/support)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Filesystem helpers for Z0Z_tools.
|
|
2
|
+
|
|
3
|
+
The repository also distributes the top-level `humpy_toolz`, `humpy_cytoolz`, and `humpy_tlz`
|
|
4
|
+
packages.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from Z0Z_tools.functionsNeedAHome import (
|
|
10
|
+
between吗 as between吗, consecutive吗 as consecutive吗, DOTitems as DOTitems, DOTkeys as DOTkeys, DOTvalues as DOTvalues, exclude as exclude,
|
|
11
|
+
reverseLookup as reverseLookup, thisHasThat吗 as thisHasThat吗, thisNotHaveThat吗 as thisNotHaveThat吗)
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# ruff: noqa: DOC201, D100, D103
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from collections.abc import Hashable, Sequence
|
|
5
|
+
from humpy_cytoolz import curry as syntacticCurry
|
|
6
|
+
from hunterMakesPy import Ordinals
|
|
7
|
+
from more_itertools import extract
|
|
8
|
+
from operator import eq
|
|
9
|
+
from typing import TYPE_CHECKING, TypeVar
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from collections.abc import Container, Iterable, Iterator, Mapping
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
小于 = TypeVar("小于", bound=Ordinals)
|
|
16
|
+
个 = TypeVar("个")
|
|
17
|
+
文件 = TypeVar("文件", bound=Hashable)
|
|
18
|
+
文义 = TypeVar("文义")
|
|
19
|
+
|
|
20
|
+
#======== Boolean antecedents ================================================
|
|
21
|
+
|
|
22
|
+
@syntacticCurry
|
|
23
|
+
def between吗(floor: 小于, ceiling: 小于, comparand: 小于) -> bool:
|
|
24
|
+
"""Inclusive `floor <= comparand <= ceiling`."""
|
|
25
|
+
return floor <= comparand <= ceiling
|
|
26
|
+
|
|
27
|
+
def consecutive吗(flatContainer: Sequence[int]) -> bool:
|
|
28
|
+
"""Are the integers in `flatContainer` consecutive, either ascending or descending?"""
|
|
29
|
+
difference: int = flatContainer[-1] - flatContainer[0]
|
|
30
|
+
direction: int = (difference > 0) - (difference < 0)
|
|
31
|
+
ImaRangeOfInt = range(flatContainer[0], flatContainer[-1] + direction, direction)
|
|
32
|
+
return (abs(difference) == (len(flatContainer) - 1)) and (all(map(eq, flatContainer, ImaRangeOfInt)))
|
|
33
|
+
|
|
34
|
+
@syntacticCurry
|
|
35
|
+
def thisHasThat吗(this: Container[个], that: 个) -> bool:
|
|
36
|
+
"""You can test whether `that` is present in `this`.
|
|
37
|
+
|
|
38
|
+
You can use `thisHasThat` in an `if` statement, or you can pass `thisHasThat` as a
|
|
39
|
+
predicate to a filtering utility described in the module docstring.
|
|
40
|
+
|
|
41
|
+
Parameters
|
|
42
|
+
----------
|
|
43
|
+
this : Container[个]
|
|
44
|
+
Container to search.
|
|
45
|
+
that : 个
|
|
46
|
+
Value to find.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
thatIsPresent : bool
|
|
51
|
+
`True` if `that in this`.
|
|
52
|
+
|
|
53
|
+
References
|
|
54
|
+
----------
|
|
55
|
+
[1] `operator.contains` (Python documentation)
|
|
56
|
+
https://docs.python.org/3/library/operator.html#operator.contains
|
|
57
|
+
|
|
58
|
+
"""
|
|
59
|
+
return that in this
|
|
60
|
+
|
|
61
|
+
@syntacticCurry
|
|
62
|
+
def thisNotHaveThat吗(this: Container[个], that: 个) -> bool:
|
|
63
|
+
return not thisHasThat吗(this, that)
|
|
64
|
+
|
|
65
|
+
#======== Filtering functions ================================================
|
|
66
|
+
|
|
67
|
+
def exclude(flatContainer: Sequence[个], indices: Iterable[int]) -> Iterator[个]:
|
|
68
|
+
"""Yield items from `flatContainer` whose positions are not in `indices`."""
|
|
69
|
+
lengthIterable: int = len(flatContainer)
|
|
70
|
+
|
|
71
|
+
def normalizeIndex(index: int) -> int:
|
|
72
|
+
if index < 0:
|
|
73
|
+
index = (index + lengthIterable) % lengthIterable
|
|
74
|
+
return index
|
|
75
|
+
indicesInclude: list[int] = sorted(set(range(lengthIterable)).difference(map(normalizeIndex, indices)))
|
|
76
|
+
return extract(flatContainer, indicesInclude)
|
|
77
|
+
|
|
78
|
+
#======== Disaggregation and deconstruction functions ================================================
|
|
79
|
+
|
|
80
|
+
def DOTitems(dictionary: Mapping[文件, 文义], /) -> Iterator[tuple[文件, 文义]]:
|
|
81
|
+
"""Create an `Iterator` of key-value pairs from a mapping.
|
|
82
|
+
|
|
83
|
+
You can use this function to convert `dictionary.items()` into an `Iterator` that you can
|
|
84
|
+
pass to functions requiring iterators rather than views. The function is analogous to
|
|
85
|
+
`dict.items()` [1] but returns an `Iterator` instead of a dictionary view.
|
|
86
|
+
|
|
87
|
+
Parameters
|
|
88
|
+
----------
|
|
89
|
+
dictionary : Mapping[文件, 文义]
|
|
90
|
+
Source mapping from which to extract key-value pairs.
|
|
91
|
+
|
|
92
|
+
Returns
|
|
93
|
+
-------
|
|
94
|
+
aRiverOfItems : Iterator[tuple[文件, 文义]]
|
|
95
|
+
`Iterator` yielding each `(key, value)` pair from `dictionary`.
|
|
96
|
+
|
|
97
|
+
Examples
|
|
98
|
+
--------
|
|
99
|
+
The function is used to initialize iteration queues from filtered dictionaries.
|
|
100
|
+
|
|
101
|
+
dequePileLeaf: deque[tuple[Pile, Leaf]] = deque(sorted(DOTitems(valfilter(mappingHasKey(dictionaryConditionalLeafPredecessors),
|
|
102
|
+
leavesPinned))))
|
|
103
|
+
|
|
104
|
+
The function is used to create sorted item sequences for triple-wise processing.
|
|
105
|
+
|
|
106
|
+
piles3consecutive: deque[tuple[tuple[Pile, LeafSpace], tuple[Pile, LeafSpace], tuple[Pile, LeafSpace]]] = deque(triplewise(sorted(DOTitems(permutationSpace))))
|
|
107
|
+
|
|
108
|
+
References
|
|
109
|
+
----------
|
|
110
|
+
[1] Mapping.items() - Python documentation
|
|
111
|
+
https://docs.python.org/3/library/stdtypes.html#dict.items
|
|
112
|
+
|
|
113
|
+
"""
|
|
114
|
+
return iter(dictionary.items())
|
|
115
|
+
|
|
116
|
+
def DOTkeys(dictionary: Mapping[个, Any], /) -> Iterator[个]:
|
|
117
|
+
"""Create an `Iterator` of keys from a mapping.
|
|
118
|
+
|
|
119
|
+
You can use this function to convert `dictionary.keys()` into an `Iterator` that you can
|
|
120
|
+
pass to functions requiring iterators rather than views. The function is analogous to
|
|
121
|
+
`dict.keys()` [1] but returns an `Iterator` instead of a dictionary view.
|
|
122
|
+
|
|
123
|
+
Parameters
|
|
124
|
+
----------
|
|
125
|
+
dictionary : Mapping[个, Any]
|
|
126
|
+
Source mapping from which to extract keys.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
aRiverOfKeys : Iterator[个]
|
|
131
|
+
`Iterator` yielding each key from `dictionary`.
|
|
132
|
+
|
|
133
|
+
Examples
|
|
134
|
+
--------
|
|
135
|
+
The function is used to extract keys for dictionary dissociation.
|
|
136
|
+
|
|
137
|
+
return (leavesPinned, dissociatePiles(permutationSpace, *DOTkeys(leavesPinned)))
|
|
138
|
+
|
|
139
|
+
The function is used to identify leaves with singleton domains.
|
|
140
|
+
|
|
141
|
+
leavesWithDomainOf1: set[Leaf] = set(DOTkeys(valfilter((1).__eq__, leafAndItsDomainSize))).difference(leavesPinned.values()).difference([state.leavesTotal])
|
|
142
|
+
|
|
143
|
+
References
|
|
144
|
+
----------
|
|
145
|
+
[1] Mapping.keys() - Python documentation
|
|
146
|
+
https://docs.python.org/3/library/stdtypes.html#dict.keys
|
|
147
|
+
|
|
148
|
+
"""
|
|
149
|
+
return iter(dictionary.keys())
|
|
150
|
+
|
|
151
|
+
def DOTvalues(dictionary: Mapping[Any, 个], /) -> Iterator[个]:
|
|
152
|
+
"""Create an `Iterator` of values from a mapping.
|
|
153
|
+
|
|
154
|
+
You can use this function to convert `dictionary.values()` into an `Iterator` that you can
|
|
155
|
+
pass to functions requiring iterators rather than views. The function is analogous to
|
|
156
|
+
`dict.values()` [1] but returns an `Iterator` instead of a dictionary view.
|
|
157
|
+
|
|
158
|
+
Parameters
|
|
159
|
+
----------
|
|
160
|
+
dictionary : Mapping[Any, 个]
|
|
161
|
+
Source mapping from which to extract values.
|
|
162
|
+
|
|
163
|
+
Returns
|
|
164
|
+
-------
|
|
165
|
+
aRiverOfValues : Iterator[个]
|
|
166
|
+
`Iterator` yielding each value from `dictionary`.
|
|
167
|
+
|
|
168
|
+
Examples
|
|
169
|
+
--------
|
|
170
|
+
The function is used to extract leaf domains for anti-option computation.
|
|
171
|
+
|
|
172
|
+
if not (permutationSpace := _reducePileRangesOfLeaves(state, permutationSpace, deque(pilesUndetermined.items()), makeLeafAntiOptions(state.leavesTotal, DOTvalues(leavesPinned)))):
|
|
173
|
+
|
|
174
|
+
The function is used to count leaf occurrences across domains.
|
|
175
|
+
|
|
176
|
+
leafAndItsDomainSize: Counter[Leaf] = Counter(chain(chain.from_iterable(map(getIteratorOfLeaves, DOTvalues(pilesUndetermined))), DOTvalues(leavesPinned)))
|
|
177
|
+
|
|
178
|
+
The function is used to extract folding sequences from pinned leaves.
|
|
179
|
+
|
|
180
|
+
folding = tuple(DOTvalues(extractPinnedLeaves(permutationSpace)))
|
|
181
|
+
|
|
182
|
+
References
|
|
183
|
+
----------
|
|
184
|
+
[1] Mapping.values() - Python documentation
|
|
185
|
+
https://docs.python.org/3/library/stdtypes.html#dict.values
|
|
186
|
+
|
|
187
|
+
"""
|
|
188
|
+
return iter(dictionary.values())
|
|
189
|
+
|
|
190
|
+
def reverseLookup(dictionary: dict[文件, 文义], keyValue: 文义) -> 文件 | None:
|
|
191
|
+
"""Find the key in a dictionary that maps to a specified value.
|
|
192
|
+
|
|
193
|
+
You can use this function to perform reverse dictionary lookup: given a value, find the
|
|
194
|
+
key that maps to that value. The function iterates through `dictionary.items()` [1] and
|
|
195
|
+
returns the first key where `dictionary[key] == keyValue`. When no matching key exists,
|
|
196
|
+
the function returns `None`.
|
|
197
|
+
|
|
198
|
+
Parameters
|
|
199
|
+
----------
|
|
200
|
+
dictionary : dict[文件, 文义]
|
|
201
|
+
Dictionary to search for `keyValue`.
|
|
202
|
+
keyValue : 文义
|
|
203
|
+
Value to locate in `dictionary.values()`.
|
|
204
|
+
|
|
205
|
+
Returns
|
|
206
|
+
-------
|
|
207
|
+
keyOrNone : 文件 | None
|
|
208
|
+
The key that maps to `keyValue`, or `None` when no key maps to `keyValue`.
|
|
209
|
+
|
|
210
|
+
Examples
|
|
211
|
+
--------
|
|
212
|
+
The function is used to find which pile contains a specific leaf.
|
|
213
|
+
|
|
214
|
+
pileOfLeaf一零: Pile = raiseIfNone(reverseLookup(state.permutationSpace, leaf一零))
|
|
215
|
+
pileOfLeaf首零一: Pile = raiseIfNone(reverseLookup(state.permutationSpace, leaf首零一))
|
|
216
|
+
|
|
217
|
+
Important
|
|
218
|
+
---------
|
|
219
|
+
The function assumes all values in `dictionary` are distinct. When multiple keys map to
|
|
220
|
+
`keyValue`, the function returns an arbitrary matching key (whichever appears first during
|
|
221
|
+
iteration). The function is not efficient for membership testing: use `keyValue in dictionary.values()`
|
|
222
|
+
instead. When you expect a key to exist, combine with `raiseIfNone` [2] rather than checking
|
|
223
|
+
for `None`.
|
|
224
|
+
|
|
225
|
+
References
|
|
226
|
+
----------
|
|
227
|
+
[1] dict.items() - Python documentation
|
|
228
|
+
https://docs.python.org/3/library/stdtypes.html#dict.items
|
|
229
|
+
[2] hunterMakesPy.raiseIfNone - Context7
|
|
230
|
+
https://context7.com/hunterhogan/huntermakespy
|
|
231
|
+
|
|
232
|
+
"""
|
|
233
|
+
for key, value in dictionary.items():
|
|
234
|
+
if value == keyValue:
|
|
235
|
+
return key
|
|
236
|
+
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Z0Z_tools
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: Typing, documenting, and improving toolz and cytoolz.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License-Expression: CC-BY-NC-4.0
|
|
@@ -35,6 +35,8 @@ Provides-Extra: development
|
|
|
35
35
|
Requires-Dist: astToolkit; extra == "development"
|
|
36
36
|
Requires-Dist: hunterMakesPy; extra == "development"
|
|
37
37
|
Requires-Dist: pytest-cov; extra == "development"
|
|
38
|
+
Requires-Dist: cython>=3.0; extra == "development"
|
|
39
|
+
Requires-Dist: setuptools>=74.1.0; extra == "development"
|
|
38
40
|
Provides-Extra: testing
|
|
39
41
|
Requires-Dist: pytest; extra == "testing"
|
|
40
42
|
Dynamic: license-file
|
|
@@ -90,6 +92,13 @@ from humpy_cytoolz.curried import operator
|
|
|
90
92
|
pip install Z0Z_tools
|
|
91
93
|
```
|
|
92
94
|
|
|
95
|
+
## Sources
|
|
96
|
+
|
|
97
|
+
1. [toolz](https://github.com/pytoolz/toolz)
|
|
98
|
+
2. [cytoolz](https://github.com/pytoolz/cytoolz)
|
|
99
|
+
3. [toolz-stubs](https://github.com/mgrinshpon/toolz-stubs)
|
|
100
|
+
4. [cytoolz-stubs](https://github.com/OutSquareCapital/cytoolz-stubs)
|
|
101
|
+
|
|
93
102
|
## My recovery
|
|
94
103
|
|
|
95
104
|
[](https://HunterThinks.com/support)
|