hunterMakesPy 0.6.0__tar.gz → 0.7.1__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 (123) hide show
  1. {huntermakespy-0.6.0/hunterMakesPy.egg-info → huntermakespy-0.7.1}/PKG-INFO +6 -107
  2. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/README.md +2 -96
  3. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/dataStructures.py +14 -31
  4. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/filesystemToolkit.py +72 -76
  5. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/parseParameters.py +9 -6
  6. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/tests/conftest.py +4 -4
  7. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/tests/test_coping.py +1 -1
  8. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/tests/test_dataStructures.py +12 -19
  9. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/tests/test_filesystemToolkit.py +2 -2
  10. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/tests/test_parseParameters.py +2 -1
  11. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/tests/test_theTypes.py +0 -76
  12. {huntermakespy-0.6.0 → huntermakespy-0.7.1/hunterMakesPy.egg-info}/PKG-INFO +6 -107
  13. huntermakespy-0.7.1/hunterMakesPy.egg-info/SOURCES.txt +25 -0
  14. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy.egg-info/requires.txt +0 -4
  15. huntermakespy-0.7.1/hunterMakesPy.egg-info/top_level.txt +1 -0
  16. huntermakespy-0.7.1/pyproject.toml +79 -0
  17. huntermakespy-0.6.0/humpy_cytoolz/Notice_of_Copyright.txt +0 -32
  18. huntermakespy-0.6.0/humpy_cytoolz/__init__.pxd +0 -19
  19. huntermakespy-0.6.0/humpy_cytoolz/__init__.py +0 -25
  20. huntermakespy-0.6.0/humpy_cytoolz/__init__.pyi +0 -24
  21. huntermakespy-0.6.0/humpy_cytoolz/_signatures.py +0 -12
  22. huntermakespy-0.6.0/humpy_cytoolz/_signatures.pyi +0 -27
  23. huntermakespy-0.6.0/humpy_cytoolz/cpython.pxd +0 -11
  24. huntermakespy-0.6.0/humpy_cytoolz/curried/__init__.py +0 -78
  25. huntermakespy-0.6.0/humpy_cytoolz/curried/exceptions.py +0 -13
  26. huntermakespy-0.6.0/humpy_cytoolz/curried/exceptions.pyi +0 -30
  27. huntermakespy-0.6.0/humpy_cytoolz/curried/operator.py +0 -7
  28. huntermakespy-0.6.0/humpy_cytoolz/dicttoolz.c +0 -17659
  29. huntermakespy-0.6.0/humpy_cytoolz/dicttoolz.pxd +0 -51
  30. huntermakespy-0.6.0/humpy_cytoolz/dicttoolz.pyi +0 -126
  31. huntermakespy-0.6.0/humpy_cytoolz/dicttoolz.pyx +0 -974
  32. huntermakespy-0.6.0/humpy_cytoolz/functoolz.c +0 -29204
  33. huntermakespy-0.6.0/humpy_cytoolz/functoolz.pxd +0 -67
  34. huntermakespy-0.6.0/humpy_cytoolz/functoolz.pyi +0 -402
  35. huntermakespy-0.6.0/humpy_cytoolz/functoolz.pyx +0 -919
  36. huntermakespy-0.6.0/humpy_cytoolz/itertoolz.c +0 -53819
  37. huntermakespy-0.6.0/humpy_cytoolz/itertoolz.pxd +0 -282
  38. huntermakespy-0.6.0/humpy_cytoolz/itertoolz.pyi +0 -298
  39. huntermakespy-0.6.0/humpy_cytoolz/itertoolz.pyx +0 -1864
  40. huntermakespy-0.6.0/humpy_cytoolz/recipes.c +0 -11453
  41. huntermakespy-0.6.0/humpy_cytoolz/recipes.pxd +0 -5
  42. huntermakespy-0.6.0/humpy_cytoolz/recipes.pyi +0 -35
  43. huntermakespy-0.6.0/humpy_cytoolz/recipes.pyx +0 -67
  44. huntermakespy-0.6.0/humpy_cytoolz/tests/__init__.py +0 -1
  45. huntermakespy-0.6.0/humpy_cytoolz/tests/dev_skip_test.py +0 -29
  46. huntermakespy-0.6.0/humpy_cytoolz/tests/test_curried.py +0 -89
  47. huntermakespy-0.6.0/humpy_cytoolz/tests/test_curried_toolzlike.py +0 -30
  48. huntermakespy-0.6.0/humpy_cytoolz/tests/test_dev_skip_test.py +0 -18
  49. huntermakespy-0.6.0/humpy_cytoolz/tests/test_dicttoolz.py +0 -436
  50. huntermakespy-0.6.0/humpy_cytoolz/tests/test_docstrings.py +0 -52
  51. huntermakespy-0.6.0/humpy_cytoolz/tests/test_doctests.py +0 -16
  52. huntermakespy-0.6.0/humpy_cytoolz/tests/test_embedded_sigs.py +0 -67
  53. huntermakespy-0.6.0/humpy_cytoolz/tests/test_functoolz.py +0 -627
  54. huntermakespy-0.6.0/humpy_cytoolz/tests/test_inspect_args.py +0 -439
  55. huntermakespy-0.6.0/humpy_cytoolz/tests/test_itertoolz.py +0 -415
  56. huntermakespy-0.6.0/humpy_cytoolz/tests/test_none_safe.py +0 -243
  57. huntermakespy-0.6.0/humpy_cytoolz/tests/test_recipes.py +0 -16
  58. huntermakespy-0.6.0/humpy_cytoolz/tests/test_serialization.py +0 -138
  59. huntermakespy-0.6.0/humpy_cytoolz/tests/test_signatures.py +0 -74
  60. huntermakespy-0.6.0/humpy_cytoolz/tests/test_stubs.py +0 -0
  61. huntermakespy-0.6.0/humpy_cytoolz/tests/test_tlz.py +0 -48
  62. huntermakespy-0.6.0/humpy_cytoolz/tests/test_utils.py +0 -13
  63. huntermakespy-0.6.0/humpy_cytoolz/utils.c +0 -9069
  64. huntermakespy-0.6.0/humpy_cytoolz/utils.pxd +0 -1
  65. huntermakespy-0.6.0/humpy_cytoolz/utils.pyi +0 -11
  66. huntermakespy-0.6.0/humpy_cytoolz/utils.pyx +0 -60
  67. huntermakespy-0.6.0/humpy_tlz/__init__.py +0 -9
  68. huntermakespy-0.6.0/humpy_tlz/_build_tlz.py +0 -82
  69. huntermakespy-0.6.0/humpy_toolz/Notice_of_Copyright.txt +0 -32
  70. huntermakespy-0.6.0/humpy_toolz/__init__.py +0 -22
  71. huntermakespy-0.6.0/humpy_toolz/__init__.pyi +0 -29
  72. huntermakespy-0.6.0/humpy_toolz/_signatures.py +0 -458
  73. huntermakespy-0.6.0/humpy_toolz/curried/__init__.py +0 -78
  74. huntermakespy-0.6.0/humpy_toolz/curried/__init__.pyi +0 -1478
  75. huntermakespy-0.6.0/humpy_toolz/curried/exceptions.py +0 -13
  76. huntermakespy-0.6.0/humpy_toolz/curried/exceptions.pyi +0 -91
  77. huntermakespy-0.6.0/humpy_toolz/curried/operator.py +0 -8
  78. huntermakespy-0.6.0/humpy_toolz/curried/operator.pyi +0 -248
  79. huntermakespy-0.6.0/humpy_toolz/dicttoolz.py +0 -865
  80. huntermakespy-0.6.0/humpy_toolz/functoolz.py +0 -834
  81. huntermakespy-0.6.0/humpy_toolz/functoolz.pyi +0 -386
  82. huntermakespy-0.6.0/humpy_toolz/itertoolz.py +0 -1180
  83. huntermakespy-0.6.0/humpy_toolz/py.typed +0 -0
  84. huntermakespy-0.6.0/humpy_toolz/recipes.py +0 -43
  85. huntermakespy-0.6.0/humpy_toolz/recipes.pyi +0 -14
  86. huntermakespy-0.6.0/humpy_toolz/sandbox/__init__.py +0 -3
  87. huntermakespy-0.6.0/humpy_toolz/sandbox/__init__.pyi +0 -4
  88. huntermakespy-0.6.0/humpy_toolz/sandbox/core.py +0 -121
  89. huntermakespy-0.6.0/humpy_toolz/sandbox/core.pyi +0 -54
  90. huntermakespy-0.6.0/humpy_toolz/sandbox/parallel.py +0 -70
  91. huntermakespy-0.6.0/humpy_toolz/sandbox/parallel.pyi +0 -20
  92. huntermakespy-0.6.0/humpy_toolz/sandbox/tests/__init__.py +0 -1
  93. huntermakespy-0.6.0/humpy_toolz/sandbox/tests/test_core.py +0 -82
  94. huntermakespy-0.6.0/humpy_toolz/sandbox/tests/test_parallel.py +0 -22
  95. huntermakespy-0.6.0/humpy_toolz/tests/__init__.py +0 -1
  96. huntermakespy-0.6.0/humpy_toolz/tests/test_curried.py +0 -89
  97. huntermakespy-0.6.0/humpy_toolz/tests/test_curried_doctests.py +0 -10
  98. huntermakespy-0.6.0/humpy_toolz/tests/test_dicttoolz.py +0 -1077
  99. huntermakespy-0.6.0/humpy_toolz/tests/test_functoolz.py +0 -620
  100. huntermakespy-0.6.0/humpy_toolz/tests/test_inspect_args.py +0 -441
  101. huntermakespy-0.6.0/humpy_toolz/tests/test_itertoolz.py +0 -417
  102. huntermakespy-0.6.0/humpy_toolz/tests/test_package.py +0 -6
  103. huntermakespy-0.6.0/humpy_toolz/tests/test_recipes.py +0 -16
  104. huntermakespy-0.6.0/humpy_toolz/tests/test_serialization.py +0 -139
  105. huntermakespy-0.6.0/humpy_toolz/tests/test_signatures.py +0 -74
  106. huntermakespy-0.6.0/humpy_toolz/tests/test_tlz.py +0 -53
  107. huntermakespy-0.6.0/humpy_toolz/tests/test_utils.py +0 -5
  108. huntermakespy-0.6.0/humpy_toolz/utils.py +0 -190
  109. huntermakespy-0.6.0/hunterMakesPy/py.typed +0 -0
  110. huntermakespy-0.6.0/hunterMakesPy.egg-info/SOURCES.txt +0 -118
  111. huntermakespy-0.6.0/hunterMakesPy.egg-info/top_level.txt +0 -4
  112. huntermakespy-0.6.0/pyproject.toml +0 -144
  113. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/LICENSE +0 -0
  114. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/__init__.py +0 -0
  115. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/_theSSOT.py +0 -0
  116. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/coping.py +0 -0
  117. {huntermakespy-0.6.0/humpy_cytoolz → huntermakespy-0.7.1/hunterMakesPy}/py.typed +0 -0
  118. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/semiotics.py +0 -0
  119. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/tests/__init__.py +0 -0
  120. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/theTypes.py +0 -0
  121. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy/theTypesCallableFunction.py +0 -0
  122. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/hunterMakesPy.egg-info/dependency_links.txt +0 -0
  123. {huntermakespy-0.6.0 → huntermakespy-0.7.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hunterMakesPy
3
- Version: 0.6.0
3
+ Version: 0.7.1
4
4
  Summary: Easy Python functions making making functional Python functions easier.
5
5
  Author-email: Hunter Hogan <HunterHogan@pm.me>
6
6
  License-Expression: CC-BY-NC-4.0
@@ -9,7 +9,7 @@ Project-URL: Donate, https://www.patreon.com/integrated
9
9
  Project-URL: Homepage, https://github.com/hunterhogan/hunterMakesPy
10
10
  Project-URL: Issues, https://github.com/hunterhogan/hunterMakesPy/issues
11
11
  Project-URL: Repository, https://github.com/hunterhogan/hunterMakesPy
12
- Keywords: attribute loading,concurrency limit,configuration,cytoolz,defensive programming,dictionary merging,directory creation,dynamic import,error propagation,file system utilities,input validation,integer parsing,module loading,nested data structures,package settings,parameter validation,pytest,string extraction,test utilities,toolz
12
+ Keywords: attribute loading,configuration,defensive programming,dictionary merging,dynamic import,file system utilities,input validation,module loading,package settings,parameter validation
13
13
  Classifier: Development Status :: 5 - Production/Stable
14
14
  Classifier: Environment :: Console
15
15
  Classifier: Framework :: Pytest
@@ -19,15 +19,12 @@ Classifier: Intended Audience :: Other Audience
19
19
  Classifier: Natural Language :: English
20
20
  Classifier: Operating System :: OS Independent
21
21
  Classifier: Programming Language :: Python
22
- Classifier: Programming Language :: Python :: 3
23
- Classifier: Programming Language :: Python :: 3.12
24
- Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.10
25
23
  Classifier: Programming Language :: Python :: 3.14
26
- Classifier: Programming Language :: Python :: Implementation :: CPython
27
24
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
28
25
  Classifier: Topic :: Utilities
29
26
  Classifier: Typing :: Typed
30
- Requires-Python: >=3.12
27
+ Requires-Python: >=3.10
31
28
  Description-Content-Type: text/markdown
32
29
  License-File: LICENSE
33
30
  Requires-Dist: autoflake
@@ -38,19 +35,15 @@ Requires-Dist: numpy
38
35
  Requires-Dist: tomli
39
36
  Requires-Dist: typing_extensions>=4.10.0
40
37
  Provides-Extra: development
41
- Requires-Dist: astToolkit; extra == "development"
42
- Requires-Dist: setuptools>=62.3; extra == "development"
43
38
  Requires-Dist: pytest-cov; extra == "development"
44
39
  Provides-Extra: testing
45
- Requires-Dist: cython; extra == "testing"
46
40
  Requires-Dist: librosa; extra == "testing"
47
41
  Requires-Dist: pytest; extra == "testing"
48
- Requires-Dist: pytest-xdist; extra == "testing"
49
42
  Dynamic: license-file
50
43
 
51
44
  # hunterMakesPy
52
45
 
53
- Utilities for converting mixed input to integers, calculating CPU limits, handling None values, importing code dynamically, and manipulating nested data. Also includes `humpy_toolz`, `humpy_cytoolz`, and `humpy_tlz`: typed forks of `toolz` and `cytoolz` with curried namespaces and a sandbox.
46
+ Utilities for converting mixed input to integers, calculating CPU limits, handling None values, importing code dynamically, and manipulating nested data.
54
47
 
55
48
  [![pip install hunterMakesPy](https://img.shields.io/badge/pip%20install-hunterMakesPy-gray.svg?colorB=3b434b)](https://pypi.org/project/hunterMakesPy/)
56
49
 
@@ -129,7 +122,7 @@ Write to `"deep/nested/path/file.txt"` and parent directories are created automa
129
122
  from hunterMakesPy.filesystemToolkit import writeStringToHere, writePython
130
123
 
131
124
  writeStringToHere("content", "nested/dirs/file.txt") # Creates dirs
132
- writePython(sourceCode, "output/module.py") # Formats, then writes
125
+ writePython(sourceCode, "output/module.py") # Formats, then writes
133
126
  ```
134
127
 
135
128
  ## Extract Strings from Arbitrarily Nested Data
@@ -190,100 +183,6 @@ def test_my_integer_validator(test_name, test_func):
190
183
  test_func()
191
184
  ```
192
185
 
193
- ---
194
-
195
- ## `humpy_toolz`: Typed Pure-Python Functional Utilities
196
-
197
- `humpy_toolz` is a typed fork of [`toolz`](https://github.com/pytoolz/toolz). It provides composable functions for iterators, dictionaries, and function composition with full type stubs and docstrings.
198
-
199
- ### Dictionary Transformations without Mutation
200
-
201
- Create new mappings by associating, dissociating, filtering, and mapping over keys or values. Nested access is supported through key-path sequences.
202
-
203
- ```python
204
- from humpy_toolz import merge, valmap, keyfilter, assoc
205
-
206
- merged = merge({"a": 1}, {"b": 2}) # {"a": 1, "b": 2}
207
- doubled = valmap(lambda x: x * 2, {"a": 1}) # {"a": 2}
208
- evens = keyfilter(lambda k: k > 1, {1: "a", 2: "b"}) # {2: "b"}
209
- updated = assoc({"x": 10}, "y", 20) # {"x": 10, "y": 20}
210
- ```
211
-
212
- ### Compose, Curry, and Thread Functions
213
-
214
- Build transformation sequences from left or right, partially apply arguments with `curry`, and thread a value through a series of functions.
215
-
216
- ```python
217
- from humpy_toolz import compose_left, curry, pipe
218
-
219
- increment = lambda x: x + 1
220
- double = lambda x: x * 2
221
- transform = compose_left(increment, double)
222
- transform(3) # 8
223
-
224
- pipe(3, increment, double) # 8
225
- ```
226
-
227
- ### Slice, Group, and Deduplicate Iterators
228
-
229
- Lazy operations over iterables: `take`, `drop`, `partition`, `sliding_window`, `unique`, `interleave`, `groupby`, `frequencies`, and more.
230
-
231
- ```python
232
- from humpy_toolz import take, frequencies, groupby, unique
233
-
234
- list(take(3, range(100))) # [0, 1, 2]
235
- frequencies(["a", "b", "a", "c"]) # {"a": 2, "b": 1, "c": 1}
236
- groupby(len, ["cat", "mouse", "dog"]) # {3: ["cat", "dog"], 5: ["mouse"]}
237
- list(unique([1, 2, 1, 3])) # [1, 2, 3]
238
- ```
239
-
240
- ### Curried Namespace for Partial Application
241
-
242
- Every function in `humpy_toolz.curried` accepts partial arguments and returns a new callable waiting for the rest.
243
-
244
- ```python
245
- from humpy_toolz.curried import map, filter, get
246
-
247
- list(map(str.upper, ["hello", "world"])) # ["HELLO", "WORLD"]
248
- list(filter(lambda x: x > 2, [1, 2, 3, 4])) # [3, 4]
249
- list(map(get(0), [(1, 2), (3, 4)])) # [1, 3]
250
- ```
251
-
252
- ### Sandbox: Parallel Fold and Equality-Based Hashing
253
-
254
- `humpy_toolz.sandbox` provides `fold` for unordered parallel reductions and `EqualityHashKey` for hashing otherwise-unhashable types.
255
-
256
- ```python
257
- from humpy_toolz.sandbox import fold, EqualityHashKey
258
- from operator import add
259
-
260
- fold(add, range(100), default=0) # 4950
261
- ```
262
-
263
- ---
264
-
265
- ## `humpy_cytoolz`: Cython-Accelerated Functional Utilities
266
-
267
- `humpy_cytoolz` is a typed fork of [`cytoolz`](https://github.com/pytoolz/cytoolz). It exposes the same API as `humpy_toolz` but the core modules (`dicttoolz`, `functoolz`, `itertoolz`, `recipes`, `utils`) are compiled as Cython extension modules for lower overhead on hot paths.
268
-
269
- ```python
270
- from humpy_cytoolz import groupby, curry, merge
271
- ```
272
-
273
- Install with the `cython` build dependency to compile the extensions. If compilation is unavailable, use `humpy_toolz` directly.
274
-
275
- ---
276
-
277
- ## `humpy_tlz`: Automatic Cython-or-Pure Dispatch
278
-
279
- `humpy_tlz` mirrors the `humpy_toolz` API and imports from `humpy_cytoolz` when available, falling back to `humpy_toolz` otherwise. Use `humpy_tlz` in library code so callers benefit from Cython acceleration without requiring it.
280
-
281
- ```python
282
- from humpy_tlz import pipe, curry, groupby
283
- ```
284
-
285
- ---
286
-
287
186
  ## My recovery
288
187
 
289
188
  [![Static Badge](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
@@ -1,6 +1,6 @@
1
1
  # hunterMakesPy
2
2
 
3
- Utilities for converting mixed input to integers, calculating CPU limits, handling None values, importing code dynamically, and manipulating nested data. Also includes `humpy_toolz`, `humpy_cytoolz`, and `humpy_tlz`: typed forks of `toolz` and `cytoolz` with curried namespaces and a sandbox.
3
+ Utilities for converting mixed input to integers, calculating CPU limits, handling None values, importing code dynamically, and manipulating nested data.
4
4
 
5
5
  [![pip install hunterMakesPy](https://img.shields.io/badge/pip%20install-hunterMakesPy-gray.svg?colorB=3b434b)](https://pypi.org/project/hunterMakesPy/)
6
6
 
@@ -79,7 +79,7 @@ Write to `"deep/nested/path/file.txt"` and parent directories are created automa
79
79
  from hunterMakesPy.filesystemToolkit import writeStringToHere, writePython
80
80
 
81
81
  writeStringToHere("content", "nested/dirs/file.txt") # Creates dirs
82
- writePython(sourceCode, "output/module.py") # Formats, then writes
82
+ writePython(sourceCode, "output/module.py") # Formats, then writes
83
83
  ```
84
84
 
85
85
  ## Extract Strings from Arbitrarily Nested Data
@@ -140,100 +140,6 @@ def test_my_integer_validator(test_name, test_func):
140
140
  test_func()
141
141
  ```
142
142
 
143
- ---
144
-
145
- ## `humpy_toolz`: Typed Pure-Python Functional Utilities
146
-
147
- `humpy_toolz` is a typed fork of [`toolz`](https://github.com/pytoolz/toolz). It provides composable functions for iterators, dictionaries, and function composition with full type stubs and docstrings.
148
-
149
- ### Dictionary Transformations without Mutation
150
-
151
- Create new mappings by associating, dissociating, filtering, and mapping over keys or values. Nested access is supported through key-path sequences.
152
-
153
- ```python
154
- from humpy_toolz import merge, valmap, keyfilter, assoc
155
-
156
- merged = merge({"a": 1}, {"b": 2}) # {"a": 1, "b": 2}
157
- doubled = valmap(lambda x: x * 2, {"a": 1}) # {"a": 2}
158
- evens = keyfilter(lambda k: k > 1, {1: "a", 2: "b"}) # {2: "b"}
159
- updated = assoc({"x": 10}, "y", 20) # {"x": 10, "y": 20}
160
- ```
161
-
162
- ### Compose, Curry, and Thread Functions
163
-
164
- Build transformation sequences from left or right, partially apply arguments with `curry`, and thread a value through a series of functions.
165
-
166
- ```python
167
- from humpy_toolz import compose_left, curry, pipe
168
-
169
- increment = lambda x: x + 1
170
- double = lambda x: x * 2
171
- transform = compose_left(increment, double)
172
- transform(3) # 8
173
-
174
- pipe(3, increment, double) # 8
175
- ```
176
-
177
- ### Slice, Group, and Deduplicate Iterators
178
-
179
- Lazy operations over iterables: `take`, `drop`, `partition`, `sliding_window`, `unique`, `interleave`, `groupby`, `frequencies`, and more.
180
-
181
- ```python
182
- from humpy_toolz import take, frequencies, groupby, unique
183
-
184
- list(take(3, range(100))) # [0, 1, 2]
185
- frequencies(["a", "b", "a", "c"]) # {"a": 2, "b": 1, "c": 1}
186
- groupby(len, ["cat", "mouse", "dog"]) # {3: ["cat", "dog"], 5: ["mouse"]}
187
- list(unique([1, 2, 1, 3])) # [1, 2, 3]
188
- ```
189
-
190
- ### Curried Namespace for Partial Application
191
-
192
- Every function in `humpy_toolz.curried` accepts partial arguments and returns a new callable waiting for the rest.
193
-
194
- ```python
195
- from humpy_toolz.curried import map, filter, get
196
-
197
- list(map(str.upper, ["hello", "world"])) # ["HELLO", "WORLD"]
198
- list(filter(lambda x: x > 2, [1, 2, 3, 4])) # [3, 4]
199
- list(map(get(0), [(1, 2), (3, 4)])) # [1, 3]
200
- ```
201
-
202
- ### Sandbox: Parallel Fold and Equality-Based Hashing
203
-
204
- `humpy_toolz.sandbox` provides `fold` for unordered parallel reductions and `EqualityHashKey` for hashing otherwise-unhashable types.
205
-
206
- ```python
207
- from humpy_toolz.sandbox import fold, EqualityHashKey
208
- from operator import add
209
-
210
- fold(add, range(100), default=0) # 4950
211
- ```
212
-
213
- ---
214
-
215
- ## `humpy_cytoolz`: Cython-Accelerated Functional Utilities
216
-
217
- `humpy_cytoolz` is a typed fork of [`cytoolz`](https://github.com/pytoolz/cytoolz). It exposes the same API as `humpy_toolz` but the core modules (`dicttoolz`, `functoolz`, `itertoolz`, `recipes`, `utils`) are compiled as Cython extension modules for lower overhead on hot paths.
218
-
219
- ```python
220
- from humpy_cytoolz import groupby, curry, merge
221
- ```
222
-
223
- Install with the `cython` build dependency to compile the extensions. If compilation is unavailable, use `humpy_toolz` directly.
224
-
225
- ---
226
-
227
- ## `humpy_tlz`: Automatic Cython-or-Pure Dispatch
228
-
229
- `humpy_tlz` mirrors the `humpy_toolz` API and imports from `humpy_cytoolz` when available, falling back to `humpy_toolz` otherwise. Use `humpy_tlz` in library code so callers benefit from Cython acceleration without requiring it.
230
-
231
- ```python
232
- from humpy_tlz import pipe, curry, groupby
233
- ```
234
-
235
- ---
236
-
237
143
  ## My recovery
238
144
 
239
145
  [![Static Badge](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
@@ -1,38 +1,24 @@
1
1
  """Manipulate data structures with encoding, extraction, and merging utilities.
2
2
 
3
- (AI generated docstring)
4
-
5
- You can use this module to transform NumPy arrays [1] into compact run-length encoded
6
- strings, extract strings from arbitrarily nested data structures, and merge multiple
7
- dictionaries with list values. The module provides specialized utilities for working with
8
- Cartesian mappings, heterogeneous nested data, and dictionary consolidation operations.
9
-
10
- The run-length encoding function produces self-decoding string representations optimized for
11
- large arrays with repetitive patterns. The string extraction function recursively traverses
12
- nested structures to collect all convertible string values. The dictionary merging function
13
- consolidates multiple dictionaries while offering optional deduplication and sorting.
3
+ You can use this module to transform arrays (in the general sense) into compact run-length encoded
4
+ strings, extract strings from arbitrarily nested data structures, or merge dictionaries of lists.
14
5
 
15
6
  Contents
16
7
  --------
17
8
  Functions
18
9
  autoDecodingRLE
19
- Transform a NumPy array into a compact, self-decoding run-length encoded string representation.
10
+ Transform a NumPy array into a compact, self-decoding run-length encoded string
11
+ representation.
20
12
  stringItUp
21
13
  Convert every element in input data structures to strings.
22
14
  updateExtendPolishDictionaryLists
23
15
  Merge multiple dictionaries with list values into a single dictionary.
24
-
25
- References
26
- ----------
27
- [1] NumPy - Context7
28
- https://numpy.org/doc/stable/reference/index.html
29
-
30
16
  """
31
17
  from __future__ import annotations
32
18
 
33
19
  from charset_normalizer import CharsetMatch
34
20
  from types import FunctionType
35
- from typing import Any, cast, TYPE_CHECKING
21
+ from typing import cast, TYPE_CHECKING
36
22
  import charset_normalizer
37
23
  import more_itertools
38
24
  import re as regex
@@ -43,24 +29,23 @@ if TYPE_CHECKING:
43
29
  from hunterMakesPy import 小于
44
30
  from numpy import integer
45
31
  from numpy.typing import NDArray
32
+ from typing import Any
46
33
 
47
34
  def removeExtraWhitespace(string: str) -> str:
48
35
  """Remove extra whitespace from string representation of Python data structures.""" # noqa: DOC201
49
36
  commas: str = regex.sub(r',\s+', ',', string)
50
37
  bracketsOpening: str = regex.sub(r'([\[\(])\s+', r'\1', commas)
51
- # Remove spaces before closing brackets/parentheses.
52
38
  return regex.sub(r'\s+([\]\)])', r'\1', bracketsOpening)
53
39
 
54
40
  def autoDecodingRLE(arrayTarget: NDArray[integer[Any]], *, assumeAddSpaces: bool = False) -> str:
55
41
  """Transform a NumPy array into a compact, self-decoding run-length encoded string representation.
56
42
 
57
43
  Use this function to convert a NumPy array into a string that, when evaluated as Python code,
58
- creates a list or nested lists representing the original array structure, and if used as an
59
- argument to `numpy.array()`, will recreate the original array structure. The RLE (Run-Length
60
- Encoding) string does _not_ need a special decoder function: it is already native Python syntax.
61
- The function employs two encoding strategies:
62
- 1. Python `range` syntax for consecutive integer sequences.
63
- 2. Multiplication syntax for repeated elements.
44
+ creates a list or nested lists representing the original array structure. You can create a NumPy
45
+ array, torch Tensor, or other array-like object with the auto-decoded list of lists. The RLE
46
+ (Run-Length Encoding) string does _not_ need a decoder function: it is native Python syntax. The
47
+ function employs two encoding strategies: 1. Python `range` syntax for consecutive integer
48
+ sequences. 2. Multiplication syntax for repeated elements.
64
49
 
65
50
  The resulting string representation is merely minified Python code, so it is space-efficient and,
66
51
  hypothetically, human-readable.
@@ -71,9 +56,8 @@ def autoDecodingRLE(arrayTarget: NDArray[integer[Any]], *, assumeAddSpaces: bool
71
56
  The NumPy array to be encoded.
72
57
  assumeAddSpaces : bool = False
73
58
  Affects internal length comparison during compression decisions. This parameter doesn't
74
- directly change output format but influences whether `range` or multiplication syntax is
75
- preferred in certain cases. The parameter exists because `ast.unparse()` (Abstract Syntax
76
- Tree) inserts spaces in the RLE string.
59
+ directly change the output: instead, use it to assume that something else will add spaces,
60
+ such as `ast.unparse()` (Abstract Syntax Tree) or a Python formatter.
77
61
 
78
62
  Returns
79
63
  -------
@@ -207,7 +191,6 @@ def stringItUp(*scrapPile: Any) -> list[str]:
207
191
  -------
208
192
  listStrungUp : list[str]
209
193
  (list2strung2up) A `list` of string versions of all convertible elements.
210
-
211
194
  """
212
195
  scrap: Any = None
213
196
  listStrungUp: list[str] = []
@@ -283,7 +266,7 @@ def updateExtendPolishDictionaryLists(*dictionaryLists: Mapping[str, list[小于
283
266
  Notes
284
267
  -----
285
268
  The returned value, `ePluribusUnum`, is a so-called primitive dictionary (`dict`). Furthermore,
286
- every dictionary key is a so-called primitive string (*cf.* `str()`) and every dictionary value
269
+ every dictionary key is a so-called primitive string (_cf._ `str()`) and every dictionary value
287
270
  is a so-called primitive `list` (`list`). If `dictionaryLists` has other data types, the data
288
271
  types will not be preserved. That could have unexpected consequences. Conversion from the
289
272
  original data type to a `list`, for example, may not preserve the order even if you want the
@@ -2,64 +2,65 @@
2
2
 
3
3
  (AI generated docstring)
4
4
 
5
- You can use this module to import `identifier` values from logical module paths or Python
6
- files, create parent directories for output paths, and write text or formatted Python
7
- source to files and text streams. The writing functions can normalize Python imports with
8
- `autoflake` [1] and `isort` [2] before the destination receives the final text.
5
+ You can use this module to import `identifier` values from logical module paths or Python files,
6
+ create parent directories for output paths, and write text or formatted Python source to files and
7
+ text streams. The writing functions can normalize Python imports with `autoflake` [1] and `isort` [2]
8
+ before the destination receives the final text.
9
9
 
10
10
  Contents
11
11
  --------
12
12
  Functions
13
- importLogicalPath2Identifier
14
- Import `identifier` from the module named by `logicalPathModule`.
15
- importPathFilename2Identifier
16
- Import `identifier` from the Python file at `pathFilename`.
17
- makeDirectorySafely
18
- Create parent directories for `pathFilename` when `pathFilename` is a filesystem path.
19
- makeDirsSafely
20
- Temporary alias for `makeDirectorySafely`.
21
- writePython
22
- Format `pythonSource` and write `pythonSource` to `pathFilename`.
23
- writeStringToHere
24
- Write `this` to `pathFilename`.
13
+ importLogicalPath2Identifier
14
+ Import `identifier` from the module named by `logicalPathModule`.
15
+ importPathFilename2Identifier
16
+ Import `identifier` from the Python file at `pathFilename`.
17
+ makeDirectorySafely
18
+ Create parent directories for `pathFilename` when `pathFilename` is a filesystem path.
19
+ makeDirsSafely
20
+ Temporary alias for `makeDirectorySafely`.
21
+ writePython
22
+ Format `pythonSource` and write `pythonSource` to `pathFilename`.
23
+ writeStringToHere
24
+ Write `this` to `pathFilename`.
25
25
 
26
26
  Variables
27
27
  ---------
28
- settings_autoflakeDEFAULT
29
- Default settings dictionary for Python source cleanup.
30
- settings_isortDEFAULT
31
- Default settings dictionary for Python import sorting.
28
+ settings_autoflakeDEFAULT
29
+ Default settings dictionary for Python source cleanup.
30
+ settings_isortDEFAULT
31
+ Default settings dictionary for Python import sorting.
32
32
 
33
33
  References
34
34
  ----------
35
35
  [1] autoflake
36
- https://github.com/PyCQA/autoflake
36
+ https://github.com/PyCQA/autoflake
37
37
  [2] isort
38
- https://pycqa.github.io/isort/
38
+ https://pycqa.github.io/isort/
39
39
  """
40
40
  from __future__ import annotations
41
41
 
42
42
  from autoflake import fix_code as autoflake_fix_code
43
+ from io import IOBase, TextIOBase
43
44
  from isort import code as isort_code
44
45
  from pathlib import Path, PurePath
45
- from typing import Any, overload, TYPE_CHECKING
46
+ from typing import overload, TYPE_CHECKING
46
47
  import contextlib
47
48
  import importlib
48
49
  import importlib.util
49
- import io
50
50
 
51
51
  if TYPE_CHECKING:
52
52
  from hunterMakesPy import identifierDotAttribute
53
53
  from importlib.machinery import ModuleSpec
54
54
  from os import PathLike
55
55
  from types import ModuleType
56
+ from typing import Any
56
57
 
57
58
  def importLogicalPath2Identifier(logicalPathModule: identifierDotAttribute, identifier: str, packageIdentifierIfRelative: str | None = None) -> Any:
58
59
  """Import `identifier` from the module named by `logicalPathModule`.
59
60
 
60
- You can use this function to resolve a function, class, or other attribute from a module
61
- path string. This function imports `logicalPathModule` with `importlib.import_module` [1]
62
- and returns the attribute selected by `identifier`.
61
+ You can use this function to resolve a function, class, or other attribute from a module path
62
+ string. This function imports `logicalPathModule` with `importlib.import_module` [1] and returns
63
+ the attribute selected by `identifier`.
63
64
 
64
65
  Parameters
65
66
  ----------
@@ -83,8 +84,8 @@ def importLogicalPath2Identifier(logicalPathModule: identifierDotAttribute, iden
83
84
  def importPathFilename2Identifier(pathFilename: PathLike[Any] | PurePath, identifier: str, moduleIdentifier: str | None = None) -> Any:
84
85
  """Import `identifier` from the Python file at `pathFilename`.
85
86
 
86
- You can use this function to load a Python source file as a module and retrieve a named
87
- attribute from that module. This function builds a module specification with
87
+ You can use this function to load a Python source file as a module and retrieve a named attribute
88
+ from that module. This function builds a module specification with
88
89
  `importlib.util.spec_from_file_location` [1], executes the loaded module with
89
90
  `importlib.util.module_from_spec` [2], and returns the attribute selected by `identifier`.
90
91
 
@@ -134,79 +135,78 @@ def makeDirectorySafely(pathFilename: Any) -> None:
134
135
 
135
136
  You can use this function to prepare an output location before a later write operation. This
136
137
  function ignores `OSError` from `Path.mkdir` [1] and does nothing when `pathFilename` is an
137
- `io.IOBase` [2] stream.
138
+ `IOBase` [2] stream.
138
139
 
139
140
  Parameters
140
141
  ----------
141
142
  pathFilename : Any
142
- The target path or open stream. When `pathFilename` is not an `io.IOBase` instance, the
143
+ The target path or open stream. When `pathFilename` is not an `IOBase` instance, the
143
144
  function creates the parent directory of `pathFilename`.
144
145
 
145
146
  References
146
147
  ----------
147
148
  [1] `pathlib.Path.mkdir`
148
149
  https://docs.python.org/3/library/pathlib.html#pathlib.Path.mkdir
149
- [2] `io.IOBase`
150
+ [2] `IOBase`
150
151
  https://docs.python.org/3/library/io.html#io.IOBase
151
152
  """
152
- if not isinstance(pathFilename, io.IOBase):
153
+ if not isinstance(pathFilename, IOBase):
153
154
  with contextlib.suppress(OSError):
154
155
  Path(pathFilename).parent.mkdir(parents=True, exist_ok=True)
155
156
  makeDirsSafely = makeDirectorySafely
156
157
  """Alias for `makeDirectorySafely`."""
157
158
 
158
159
  settings_autoflakeDEFAULT: dict[str, list[str] | bool] = {
159
- 'additional_imports': [],
160
- 'expand_star_imports': True,
161
- 'remove_all_unused_imports': True,
162
- 'remove_duplicate_keys': False,
163
- 'remove_unused_variables': False,
160
+ 'additional_imports': []
161
+ , 'expand_star_imports': True
162
+ , 'remove_all_unused_imports': True
163
+ , 'remove_duplicate_keys': False
164
+ , 'remove_unused_variables': False
164
165
  }
165
166
  """Default settings dictionary for Python source cleanup."""
166
167
 
167
168
  settings_isortDEFAULT: dict[str, bool | int | str | list[str]] = {
168
- "combine_as_imports": True,
169
- "force_alphabetical_sort_within_sections": True,
170
- "from_first": True,
171
- "honor_noqa": True,
172
- "indent": "\t",
173
- "line_length": 140,
174
- "lines_after_imports": 1,
175
- "lines_between_types": 0,
176
- "multi_line_output": 4,
177
- "no_sections": True,
178
- "use_parentheses": True,
169
+ "combine_as_imports": True
170
+ , "force_alphabetical_sort_within_sections": True
171
+ , "from_first": True
172
+ , "honor_noqa": True
173
+ , "indent": "\t"
174
+ , "line_length": 140
175
+ , "lines_after_imports": 1
176
+ , "lines_between_types": 0
177
+ , "multi_line_output": 4
178
+ , "no_sections": True
179
+ , "use_parentheses": True
179
180
  }
180
181
  """Default settings dictionary for Python import sorting."""
181
182
 
182
183
  @overload
183
184
  def writePython(pythonSource: str, pathFilename: PathLike[Any] | PurePath, settings: dict[str, dict[str, Any]] | None = None) -> Path: ...
184
185
  @overload
185
- def writePython(pythonSource: str, pathFilename: io.TextIOBase, settings: dict[str, dict[str, Any]] | None = None) -> io.TextIOBase: ...
186
- def writePython(pythonSource: str, pathFilename: PathLike[Any] | PurePath | io.TextIOBase, settings: dict[str, dict[str, Any]] | None = None) -> Path | io.TextIOBase:
186
+ def writePython(pythonSource: str, pathFilename: TextIOBase, settings: dict[str, dict[str, Any]] | None = None) -> TextIOBase: ...
187
+ def writePython(pythonSource: str, pathFilename: PathLike[Any] | PurePath | TextIOBase, settings: dict[str, dict[str, Any]] | None = None) -> Path | TextIOBase:
187
188
  """Format and write Python source code to a file or text stream.
188
189
 
189
190
  (AI generated docstring)
190
191
 
191
- You can use this function to normalize Python imports and then send the resulting source
192
- code to a file path or open text stream. This function applies `autoflake` [1] first,
193
- applies `isort` [2] second, appends a trailing newline, and writes the final text to
194
- `pathFilename`.
192
+ You can use this function to normalize Python imports and then send the resulting source code to a
193
+ file path or open text stream. This function applies `autoflake` [1] first, applies `isort` [2]
194
+ second, appends a trailing newline, and writes the final text to `pathFilename`.
195
195
 
196
196
  Parameters
197
197
  ----------
198
198
  pythonSource : str
199
199
  The Python source code to format and write.
200
- pathFilename : PathLike[Any] | PurePath | io.TextIOBase
200
+ pathFilename : PathLike[Any] | PurePath | TextIOBase
201
201
  The target destination. `pathFilename` can be a filesystem path or an open text stream.
202
202
  settings : dict[str, dict[str, Any]] | None = None
203
- Formatter configuration. The `'autoflake'` key overrides `settings_autoflakeDEFAULT`.
204
- The `'isort'` key overrides `settings_isortDEFAULT`. `None` uses the default settings for
205
- each formatter.
203
+ Formatter configuration. The `'autoflake'` key overrides `settings_autoflakeDEFAULT`. The
204
+ `'isort'` key overrides `settings_isortDEFAULT`. `None` uses the default settings for each
205
+ formatter.
206
206
 
207
207
  Returns
208
208
  -------
209
- destinationWritten : Path | io.TextIOBase
209
+ destinationWritten : Path | TextIOBase
210
210
  The file path or text stream that received the formatted source code.
211
211
 
212
212
  See Also
@@ -235,26 +235,24 @@ def writePython(pythonSource: str, pathFilename: PathLike[Any] | PurePath | io.T
235
235
  @overload
236
236
  def writeStringToHere(this: str, pathFilename: PathLike[Any] | PurePath) -> Path: ...
237
237
  @overload
238
- def writeStringToHere(this: str, pathFilename: io.TextIOBase) -> io.TextIOBase: ...
239
- def writeStringToHere(this: str, pathFilename: PathLike[Any] | PurePath | io.TextIOBase) -> Path | io.TextIOBase:
238
+ def writeStringToHere(this: str, pathFilename: TextIOBase) -> TextIOBase: ...
239
+ def writeStringToHere(this: str, pathFilename: PathLike[Any] | PurePath | TextIOBase) -> Path | TextIOBase:
240
240
  """Write `this` to `pathFilename`.
241
241
 
242
- You can use this function to send text to a filesystem path or an open text stream. This
243
- function creates the parent directory when `pathFilename` is path-like, writes UTF-8 text
244
- with `Path.write_text` [1], or writes and flushes an `io.TextIOBase` [2] stream. The
245
- package-assimilation code in `hunterMakesPy.assimilate.chopShop.transformPackages` [3] uses
246
- this function to persist transformed source files.
242
+ You can use this function to send text to a filesystem path or an open text stream. This function
243
+ creates the parent directory when `pathFilename` is path-like, writes UTF-8 text with
244
+ `Path.write_text` [1], or writes and flushes a `TextIOBase` [2] stream.
247
245
 
248
246
  Parameters
249
247
  ----------
250
248
  this : str
251
249
  The string content to write.
252
- pathFilename : PathLike[Any] | PurePath | io.TextIOBase
250
+ pathFilename : PathLike[Any] | PurePath | TextIOBase
253
251
  The target destination. `pathFilename` can be a filesystem path or an open text stream.
254
252
 
255
253
  Returns
256
254
  -------
257
- destinationWritten : Path | io.TextIOBase
255
+ destinationWritten : Path | TextIOBase
258
256
  The file path or text stream that received `this`.
259
257
 
260
258
  See Also
@@ -266,12 +264,11 @@ def writeStringToHere(this: str, pathFilename: PathLike[Any] | PurePath | io.Tex
266
264
  --------
267
265
  The package-assimilation code writes transformed source text to a destination package path.
268
266
 
269
- ```python
270
- from hunterMakesPy.filesystemToolkit import writeStringToHere
267
+ ```python from hunterMakesPy.filesystemToolkit import writeStringToHere
271
268
 
272
269
  writeStringToHere(
273
- regexChangeImports(pathFilename.read_text()),
274
- settingsFor[humpyPackage].pathPackage / pathFilename.relative_to(pathTransformee),
270
+ regexChangeImports(pathFilename.read_text()), settingsFor[humpyPackage].pathPackage /
271
+ pathFilename.relative_to(pathTransformee)
275
272
  )
276
273
  ```
277
274
 
@@ -279,11 +276,10 @@ def writeStringToHere(this: str, pathFilename: PathLike[Any] | PurePath | io.Tex
279
276
  ----------
280
277
  [1] `pathlib.Path.write_text`
281
278
  https://docs.python.org/3/library/pathlib.html#pathlib.Path.write_text
282
- [2] `io.TextIOBase`
279
+ [2] `TextIOBase`
283
280
  https://docs.python.org/3/library/io.html#io.TextIOBase
284
- [3] `hunterMakesPy.assimilate.chopShop.transformPackages`
285
281
  """
286
- if isinstance(pathFilename, io.TextIOBase):
282
+ if isinstance(pathFilename, TextIOBase):
287
283
  pathFilename.write(str(this))
288
284
  pathFilename.flush()
289
285
  else: