hunterMakesPy 0.5.1__tar.gz → 0.5.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 (122) hide show
  1. {huntermakespy-0.5.1/hunterMakesPy.egg-info → huntermakespy-0.5.2}/PKG-INFO +1 -1
  2. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/recipes.pyi +20 -0
  3. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/dataStructures.py +52 -72
  4. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/semiotics.py +76 -99
  5. {huntermakespy-0.5.1 → huntermakespy-0.5.2/hunterMakesPy.egg-info}/PKG-INFO +1 -1
  6. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/pyproject.toml +1 -11
  7. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/LICENSE +0 -0
  8. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/README.md +0 -0
  9. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/Notice_of_Copyright.txt +0 -0
  10. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/__init__.pxd +0 -0
  11. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/__init__.py +0 -0
  12. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/__init__.pyi +0 -0
  13. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/_signatures.py +0 -0
  14. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/_signatures.pyi +0 -0
  15. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/cpython.pxd +0 -0
  16. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/curried/__init__.py +0 -0
  17. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/curried/exceptions.py +0 -0
  18. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/curried/exceptions.pyi +0 -0
  19. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/curried/operator.py +0 -0
  20. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/dicttoolz.c +0 -0
  21. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/dicttoolz.pxd +0 -0
  22. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/dicttoolz.pyi +0 -0
  23. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/dicttoolz.pyx +0 -0
  24. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/functoolz.c +0 -0
  25. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/functoolz.pxd +0 -0
  26. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/functoolz.pyi +0 -0
  27. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/functoolz.pyx +0 -0
  28. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/itertoolz.c +0 -0
  29. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/itertoolz.pxd +0 -0
  30. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/itertoolz.pyi +0 -0
  31. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/itertoolz.pyx +0 -0
  32. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/py.typed +0 -0
  33. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/recipes.c +0 -0
  34. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/recipes.pxd +0 -0
  35. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/recipes.pyx +0 -0
  36. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/__init__.py +0 -0
  37. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/dev_skip_test.py +0 -0
  38. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_curried.py +0 -0
  39. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_curried_toolzlike.py +0 -0
  40. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_dev_skip_test.py +0 -0
  41. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_dicttoolz.py +0 -0
  42. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_docstrings.py +0 -0
  43. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_doctests.py +0 -0
  44. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_embedded_sigs.py +0 -0
  45. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_functoolz.py +0 -0
  46. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_inspect_args.py +0 -0
  47. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_itertoolz.py +0 -0
  48. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_none_safe.py +0 -0
  49. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_recipes.py +0 -0
  50. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_serialization.py +0 -0
  51. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_signatures.py +0 -0
  52. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_stubs.py +0 -0
  53. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_tlz.py +0 -0
  54. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/tests/test_utils.py +0 -0
  55. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/utils.c +0 -0
  56. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/utils.pxd +0 -0
  57. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/utils.pyi +0 -0
  58. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_cytoolz/utils.pyx +0 -0
  59. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_tlz/__init__.py +0 -0
  60. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_tlz/_build_tlz.py +0 -0
  61. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/Notice_of_Copyright.txt +0 -0
  62. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/__init__.py +0 -0
  63. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/__init__.pyi +0 -0
  64. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/_signatures.py +0 -0
  65. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/curried/__init__.py +0 -0
  66. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/curried/__init__.pyi +0 -0
  67. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/curried/exceptions.py +0 -0
  68. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/curried/exceptions.pyi +0 -0
  69. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/curried/operator.py +0 -0
  70. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/curried/operator.pyi +0 -0
  71. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/dicttoolz.py +0 -0
  72. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/functoolz.py +0 -0
  73. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/functoolz.pyi +0 -0
  74. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/itertoolz.py +0 -0
  75. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/itertoolz.pyi +0 -0
  76. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/py.typed +0 -0
  77. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/recipes.py +0 -0
  78. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/recipes.pyi +0 -0
  79. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/sandbox/__init__.py +0 -0
  80. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/sandbox/__init__.pyi +0 -0
  81. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/sandbox/core.py +0 -0
  82. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/sandbox/core.pyi +0 -0
  83. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/sandbox/parallel.py +0 -0
  84. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/sandbox/parallel.pyi +0 -0
  85. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/sandbox/tests/__init__.py +0 -0
  86. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/sandbox/tests/test_core.py +0 -0
  87. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/sandbox/tests/test_parallel.py +0 -0
  88. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/__init__.py +0 -0
  89. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_curried.py +0 -0
  90. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_curried_doctests.py +0 -0
  91. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_dicttoolz.py +0 -0
  92. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_functoolz.py +0 -0
  93. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_inspect_args.py +0 -0
  94. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_itertoolz.py +0 -0
  95. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_package.py +0 -0
  96. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_recipes.py +0 -0
  97. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_serialization.py +0 -0
  98. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_signatures.py +0 -0
  99. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_tlz.py +0 -0
  100. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/tests/test_utils.py +0 -0
  101. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/utils.py +0 -0
  102. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/humpy_toolz/utils.pyi +0 -0
  103. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/__init__.py +0 -0
  104. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/_theSSOT.py +0 -0
  105. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/coping.py +0 -0
  106. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/filesystemToolkit.py +0 -0
  107. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/parseParameters.py +0 -0
  108. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/py.typed +0 -0
  109. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/tests/__init__.py +0 -0
  110. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/tests/conftest.py +0 -0
  111. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/tests/test_coping.py +0 -0
  112. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/tests/test_dataStructures.py +0 -0
  113. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/tests/test_filesystemToolkit.py +0 -0
  114. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/tests/test_parseParameters.py +0 -0
  115. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/tests/test_theTypes.py +0 -0
  116. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/theTypes.py +0 -0
  117. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy/theTypesCallableFunction.py +0 -0
  118. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy.egg-info/SOURCES.txt +0 -0
  119. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy.egg-info/dependency_links.txt +0 -0
  120. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy.egg-info/requires.txt +0 -0
  121. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/hunterMakesPy.egg-info/top_level.txt +0 -0
  122. {huntermakespy-0.5.1 → huntermakespy-0.5.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hunterMakesPy
3
- Version: 0.5.1
3
+ Version: 0.5.2
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
@@ -10,6 +10,26 @@ def countby[V](key: Any, seq: Iterable[Sequence[V] | Mapping[Any, V]]) -> dict[V
10
10
  def countby[T, K, V]( key: Callable[[T], K] | Any, seq: Iterable[T] | Iterable[Sequence[V] | Mapping[Any, V]] ) -> dict[K, int] | dict[V, int]: ...
11
11
 
12
12
  class partitionby[T](Iterator[tuple[T, ...]]):
13
+ """Partition a sequence according to a function
14
+
15
+ Partition `s` into a sequence of lists such that, when traversing
16
+ `s`, every time the output of `func` changes a new list is started
17
+ and that and subsequent items are collected into that list.
18
+
19
+ >>> is_space = lambda c: c == " "
20
+ >>> list(partitionby(is_space, "I have space"))
21
+ [('I',), (' ',), ('h', 'a', 'v', 'e'), (' ',), ('s', 'p', 'a', 'c', 'e')]
22
+
23
+ >>> is_large = lambda x: x > 10
24
+ >>> list(partitionby(is_large, [1, 2, 1, 99, 88, 33, 99, -1, 5]))
25
+ [(1, 2, 1), (99, 88, 33, 99), (-1, 5)]
26
+
27
+ See Also
28
+ --------
29
+ partition
30
+ groupby
31
+ itertools.groupby
32
+ """
13
33
  def __init__(self, func: Callable[[T], Any], seq: Iterable[T]) -> None: ...
14
34
  def __iter__(self) -> partitionby[T]: ...
15
35
  def __next__(self) -> tuple[T, ...]: ...
@@ -33,6 +33,7 @@ from collections.abc import Mapping
33
33
  from humpy_cytoolz.functoolz import identity
34
34
  from humpy_cytoolz.recipes import partitionby
35
35
  from hunterMakesPy import Ordinals
36
+ from more_itertools import consecutive_groups
36
37
  from numpy import integer
37
38
  from numpy.typing import NDArray
38
39
  from typing import Any, cast
@@ -76,88 +77,67 @@ def autoDecodingRLE(arrayTarget: NDArray[integer[Any]], *, assumeAddSpaces: bool
76
77
 
77
78
  The encoded string uses only builtins — no imports are needed to decode it.
78
79
  """
79
- def measurerCalculatesAdjustedLength(string: str) -> int:
80
- """`assumeAddSpaces` characters: `,` 1; `]*` 2."""
81
- return len(string) + assumeAddSpaces * (string.count(',') + string.count(']*') * 2)
82
-
83
- # TODO there is only ONE call to this. Refactor to inline it and remove the function definition.
84
- def encoderConvertsTokenToString(token: int | tuple[int, int]) -> str:
85
- string: str = str(token)
86
- if isinstance(token, tuple):
87
- rangeStart, rangeEnd = token
88
- if rangeStart == 0:
89
- string = f"*range({rangeEnd})"
90
- else:
91
- string = f"*range({rangeStart},{rangeEnd})"
92
- return string
93
-
94
- def encoderTransformsOneDimensionalSequenceToString(listIntegers: list[int]) -> str:
95
- stringRepresentingArray: str = '[]'
96
-
97
- if listIntegers:
98
- listTokens: list[int | tuple[int, int]] = []
99
- index: int = 0
100
- countIntegers: int = len(listIntegers)
101
-
102
- while index < countIntegers:
103
- countConsecutive: int = 1
104
- while (index + countConsecutive < countIntegers) and (listIntegers[index + countConsecutive] == listIntegers[index] + countConsecutive):
105
- countConsecutive += 1
106
-
107
- integerStart: int = listIntegers[index]
108
- integerEnd: int = integerStart + countConsecutive
109
- stringRangeSyntax: str = ''
110
- if integerStart == 0:
111
- stringRangeSyntax = f"*range({integerEnd})"
112
- else:
113
- stringRangeSyntax = f"*range({integerStart},{integerEnd})"
114
- stringCommaSeparated: str = ','.join(str(integerStart + offset) for offset in range(countConsecutive))
115
-
116
- if measurerCalculatesAdjustedLength(stringRangeSyntax) < measurerCalculatesAdjustedLength(stringCommaSeparated):
117
- listTokens.append((integerStart, integerEnd))
118
- else:
119
- for indexOffset in range(countConsecutive):
120
- listTokens.append(integerStart + indexOffset) # noqa: PERF401
121
- index += countConsecutive
80
+ def encodeByRecursion(arraySlice: NDArray[integer[Any]]) -> str:
81
+ if arraySlice.ndim == 0:
82
+ return str(int(arraySlice))
83
+ if arraySlice.ndim == 1:
84
+ return encodeListAsString(arraySlice.tolist())
85
+ return '[' + ','.join(map(encodeByRecursion, arraySlice)) + ']'
122
86
 
123
- listSegments: list[str] = []
124
- listBuffer: list[str] = []
87
+ def encodeListAsString(listIntegers: list[int]) -> str:
88
+ listTokens: list[str] = []
125
89
 
126
- for groupTokens in partitionby(identity, listTokens):
127
- listGroup: list[int | tuple[int, int]] = list(groupTokens)
128
- tokenActive: int | tuple[int, int] = listGroup[0]
129
- countRepetitions: int = len(listGroup)
90
+ for integersConsecutive in consecutive_groups(listIntegers):
91
+ tupleIntegersConsecutive: tuple[int, ...] = tuple(integersConsecutive)
92
+ integersConsecutiveLength: int = len(tupleIntegersConsecutive)
130
93
 
131
- stringTokenActive: str = encoderConvertsTokenToString(tokenActive)
94
+ if integersConsecutiveLength == 1:
95
+ listTokens.append(str(tupleIntegersConsecutive[0]))
96
+ else:
97
+ start: int = tupleIntegersConsecutive[0]
98
+ stop: int = start + integersConsecutiveLength
99
+ if start == 0:
100
+ startAs_str: str = ''
101
+ else:
102
+ startAs_str = f"{start},"
103
+ stringRangeSyntax: str = f"*range({startAs_str}{stop})"
132
104
 
133
- if 1 < countRepetitions:
134
- stringMultiplicationSyntax: str = f"[{stringTokenActive}]*{countRepetitions}"
135
- stringListSyntax: str = "[" + ",".join([stringTokenActive] * countRepetitions) + "]"
136
- if measurerCalculatesAdjustedLength(stringMultiplicationSyntax) < measurerCalculatesAdjustedLength(stringListSyntax):
137
- if listBuffer:
138
- listSegments.append('[' + ','.join(listBuffer) + ']')
139
- listBuffer = []
140
- listSegments.append(stringMultiplicationSyntax)
141
- continue
105
+ stringCommaSeparated: str = ','.join(map(str, tupleIntegersConsecutive))
142
106
 
143
- listBuffer.extend([stringTokenActive] * countRepetitions)
107
+ if measureStringLength(stringRangeSyntax) < measureStringLength(stringCommaSeparated):
108
+ listTokens.append(stringRangeSyntax)
109
+ else:
110
+ listTokens.append(stringCommaSeparated)
111
+
112
+ listSegments: list[str] = []
113
+ listBuffer: list[str] = []
114
+
115
+ for tokensIdentical in partitionby(identity, listTokens):
116
+ tokenAs_str: str = tokensIdentical[0]
117
+ countRepetitions: int = len(tokensIdentical)
118
+
119
+ if 1 < countRepetitions:
120
+ stringMultiplicationSyntax: str = f"[{tokenAs_str}]*{countRepetitions}"
121
+ stringListSyntax: str = "[" + ",".join([tokenAs_str] * countRepetitions) + "]"
122
+ if measureStringLength(stringMultiplicationSyntax) < measureStringLength(stringListSyntax):
123
+ if listBuffer:
124
+ listSegments.append('[' + ','.join(listBuffer) + ']')
125
+ listBuffer = []
126
+ listSegments.append(stringMultiplicationSyntax)
127
+ continue
144
128
 
145
- if listBuffer:
146
- listSegments.append('[' + ','.join(listBuffer) + ']')
129
+ listBuffer.extend([tokenAs_str] * countRepetitions)
147
130
 
148
- if listSegments:
149
- stringRepresentingArray = '+'.join(listSegments)
131
+ if listBuffer:
132
+ listSegments.append('[' + ','.join(listBuffer) + ']')
150
133
 
151
- return stringRepresentingArray
134
+ return '+'.join(listSegments)
152
135
 
153
- def encoderTransformsArrayRecursively(arraySlice: NDArray[integer[Any]]) -> str:
154
- if arraySlice.ndim == 0:
155
- return str(int(arraySlice))
156
- if arraySlice.ndim == 1:
157
- return encoderTransformsOneDimensionalSequenceToString(arraySlice.tolist())
158
- return '[' + ','.join(encoderTransformsArrayRecursively(arraySlice[indexRow]) for indexRow in range(arraySlice.shape[0])) + ']'
136
+ def measureStringLength(string: str) -> int:
137
+ """`assumeAddSpaces` characters: `,` 1; `]*` 2."""
138
+ return len(string) + assumeAddSpaces * (string.count(',') + string.count(']*') * 2)
159
139
 
160
- return encoderTransformsArrayRecursively(arrayTarget)
140
+ return encodeByRecursion(arrayTarget)
161
141
 
162
142
  def stringItUp(*scrapPile: Any) -> list[str]:
163
143
  """Convert, if possible, every element in the input data structure to a string.
@@ -1,18 +1,15 @@
1
1
  """Express semantic intent through named constants and ANSI color codes.
2
2
 
3
- (AI generated docstring)
3
+ You can use this module to replace numeric literals with semantically meaningful identifiers and
4
+ apply colored terminal output using high-contrast ANSI escape sequences [1]. The module provides
5
+ semantic constants for directional iteration, boundary inclusion, indexing convention adjustments,
6
+ and error state signaling, along with terminal color formatting utilities.
4
7
 
5
- You can use this module to replace numeric literals with semantically meaningful identifiers
6
- and apply colored terminal output using high-contrast ANSI escape sequences [1]. The module
7
- provides semantic constants for directional iteration, boundary inclusion, indexing
8
- convention adjustments, and error state signaling, along with terminal color formatting
9
- utilities.
10
-
11
- The semantic constants make code intent explicit by replacing ambiguous numeric literals like
12
- `-1`, `1`, and `31212012` with descriptive identifiers such as `decreasing`, `inclusive`,
13
- `zeroIndexed`, and `errorL33T`. The ANSI color utilities provide escape sequences for
14
- high-contrast color combinations selected through visibility research [2], enabling clear
15
- terminal output during debugging and logging operations.
8
+ The semantic constants make code intent explicit by replacing ambiguous numeric literals like `-1`,
9
+ `1`, and `31212012` with descriptive identifiers such as `decreasing`, `inclusive`, `zeroIndexed`,
10
+ and `errorL33T`. The ANSI color utilities provide escape sequences for high-contrast color
11
+ combinations selected through visibility research [2], enabling clear terminal output during
12
+ debugging and logging operations.
16
13
 
17
14
  Contents
18
15
  --------
@@ -47,8 +44,6 @@ from typing import NamedTuple
47
44
  decreasing: int = -1
48
45
  """Express descending iteration or a reverse direction.
49
46
 
50
- (AI generated docstring)
51
-
52
47
  The identifier `decreasing` holds the value `-1` and serves as a semantic replacement for
53
48
  numeric literals in contexts where direction or ordering matters. You can use `decreasing`
54
49
  as an addend to adjust boundary values, as a multiplicand to reverse sign or direction,
@@ -108,26 +103,22 @@ References
108
103
  errorL33T: int = 31212012
109
104
  """Signal an error state with a visually distinctive numeric value.
110
105
 
111
- (AI generated docstring)
106
+ The identifier `errorL33T` holds the value `31212012` and serves as a semantic replacement for
107
+ typical error values such as `-1`. You can use `errorL33T` wherever an error sentinel value appears
108
+ but where the meaning "error state" is more important than the specific numeric value. The value
109
+ `31212012` spells "ERROR" in leetspeak [1], making `errorL33T` more visually distinctive during
110
+ debugging than common error values like `-1`.
112
111
 
113
- The identifier `errorL33T` holds the value `31212012` and serves as a semantic replacement
114
- for typical error values such as `-1`. You can use `errorL33T` wherever an error sentinel
115
- value appears but where the meaning "error state" is more important than the specific
116
- numeric value. The value `31212012` spells "ERROR" in leetspeak [1], making `errorL33T`
117
- more visually distinctive during debugging than common error values like `-1`.
112
+ You can use `errorL33T` directly as a positive value to signal an invalid or uninitialized state. You
113
+ can use `-errorL33T` when a negative value provides a stronger visual signal or when the domain
114
+ expects negative error indicators. The leetspeak encoding makes `errorL33T` immediately recognizable
115
+ in debugger output, log files, or printed state, reducing the risk of overlooking error conditions
116
+ that might be missed with generic values like `-1`.
118
117
 
119
- You can use `errorL33T` directly as a positive value to signal an invalid or uninitialized
120
- state. You can use `-errorL33T` when a negative value provides a stronger visual signal
121
- or when the domain expects negative error indicators. The leetspeak encoding makes
122
- `errorL33T` immediately recognizable in debugger output, log files, or printed state,
123
- reducing the risk of overlooking error conditions that might be missed with generic
124
- values like `-1`.
125
-
126
- In rare cases when code execution does not raise `Exception` [2] but produces incorrect
127
- output, seeing `31212012` or `-31212012` in the output provides a stronger diagnostic
128
- signal than `-1` or other conventional error values. The distinctive value helps identify
129
- which variables hold error states without requiring careful inspection of every numeric
130
- field.
118
+ In rare cases when code execution does not raise `Exception` [2] but produces incorrect output,
119
+ seeing `31212012` or `-31212012` in the output provides a stronger diagnostic signal than `-1` or
120
+ other conventional error values. The distinctive value helps identify which variables hold error
121
+ states without requiring careful inspection of every numeric field.
131
122
 
132
123
  Examples
133
124
  --------
@@ -165,27 +156,24 @@ References
165
156
  inclusive: int = 1
166
157
  """Express inclusion (or exclusion) of a boundary value.
167
158
 
168
- (AI generated docstring)
169
-
170
- The identifier `inclusive` holds the value `1` and serves as a semantic replacement for
171
- the numeric literal `1` when adjusting boundary computations. You can use `inclusive` to
172
- convert Python's default half-open interval semantics `[start, stop)` into closed intervals
173
- `[start, stop]` by adding `inclusive` to the upper bound. You can also use `- inclusive`
174
- to signal explicit exclusion of a boundary value.
159
+ The identifier `inclusive` holds the value `1` and serves as a semantic replacement for the numeric
160
+ literal `1` when adjusting boundary computations. You can use `inclusive` to convert Python's default
161
+ half-open interval semantics `[start, stop)` into closed intervals `[start, stop]` by adding
162
+ `inclusive` to the upper bound. You can also use `- inclusive` to signal explicit exclusion of a
163
+ boundary value.
175
164
 
176
- You can use `inclusive` wherever `1` would appear but where the meaning "include this
177
- boundary" or "extend by one position" is more important than the specific numeric value.
178
- Using `inclusive` makes the code's intent explicit: the adjustment exists to change interval
179
- semantics, not to perform arbitrary arithmetic.
165
+ You can use `inclusive` wherever `1` would appear but where the meaning "include this boundary" or
166
+ "extend by one position" is more important than the specific numeric value. Using `inclusive` makes
167
+ the code's intent explicit: the adjustment exists to change interval semantics, not to perform
168
+ arbitrary arithmetic.
180
169
 
181
- Common contexts include: `range` objects [1], `slice` objects [2], sequence indexing,
182
- and any function that accepts boundary parameters with half-open semantics (such as
183
- `random.randrange` [3], `numpy.arange` [4], or `pandas.RangeIndex` [5]).
170
+ Common contexts include: `range` objects [1], `slice` objects [2], sequence indexing, and any
171
+ function that accepts boundary parameters with half-open semantics (such as `random.randrange` [3],
172
+ `numpy.arange` [4], or `pandas.RangeIndex` [5]).
184
173
 
185
174
  Many functions in Python packages use half-open intervals by default. For example,
186
- `random.randrange(start, stop)` [3] excludes `stop`, while `random.randint(a, b)` [3]
187
- includes `b`. You can use `inclusive` to make the adjustment explicit when working with
188
- half-open functions:
175
+ `random.randrange(start, stop)` [3] excludes `stop`, while `random.randint(a, b)` [3] includes `b`.
176
+ You can use `inclusive` to make the adjustment explicit when working with half-open functions:
189
177
 
190
178
  - `range(1, lastValue + inclusive)` includes `lastValue` in the iteration.
191
179
  - `slice(start, stop + inclusive)` includes the element at index `stop`.
@@ -199,9 +187,9 @@ You can use `inclusive` to extend `range` [1] objects to include the final value
199
187
  >>> for leaf1ndex in range(1, leavesTotal + inclusive):
200
188
  ... processLeaf(leaf1ndex)
201
189
 
202
- Without `inclusive`, `range(1, leavesTotal)` would stop before processing the leaf at
203
- index `leavesTotal`. Adding `inclusive` ensures the loop processes all leaves from
204
- `1` through `leavesTotal`.
190
+ Without `inclusive`, `range(1, leavesTotal)` would stop before processing the leaf at index
191
+ `leavesTotal`. Adding `inclusive` ensures the loop processes all leaves from `1` through
192
+ `leavesTotal`.
205
193
 
206
194
  You can use `inclusive` in nested `range` [1] objects:
207
195
 
@@ -227,9 +215,9 @@ You can use `- inclusive` to signal explicit exclusion of a boundary:
227
215
  >>> for pile in filter(filterPredicate, range(0, pile_k - inclusive)):
228
216
  ... processPile(pile)
229
217
 
230
- In this example, `pile_k - inclusive` explicitly excludes the pile at index `pile_k` from
231
- the range. Filters or predicates that accept inclusive upper bounds (such as `between`-style
232
- functions) may require subtracting `inclusive` to express exclusive boundaries.
218
+ In this example, `pile_k - inclusive` explicitly excludes the pile at index `pile_k` from the range.
219
+ Filters or predicates that accept inclusive upper bounds (such as `between`-style functions) may
220
+ require subtracting `inclusive` to express exclusive boundaries.
233
221
 
234
222
  You can combine `inclusive` with other semantic constants:
235
223
 
@@ -261,8 +249,6 @@ References
261
249
  zeroIndexed: int = 1
262
250
  """Express that the adjustment to a value is due to zero-based indexing.
263
251
 
264
- (AI generated docstring)
265
-
266
252
  The identifier `zeroIndexed` holds the value `1` and serves as a semantic replacement
267
253
  for the numeric literal `1` when converting between zero-based indexing (Python's default)
268
254
  and one-based indexing (common in mathematical notation, human-readable numbering, and
@@ -340,27 +326,22 @@ References
340
326
  ansiColorReset: str = '\x1b[0m'
341
327
  """Reset terminal text color and background to default settings.
342
328
 
343
- (AI generated docstring)
344
-
345
- The identifier `ansiColorReset` holds the ANSI escape sequence [1] `\x1b[0m` that resets
346
- terminal foreground and background colors to their default values. You can use
347
- `ansiColorReset` after printing colored text to ensure subsequent output appears in the
348
- terminal's default color scheme.
329
+ The identifier `ansiColorReset` holds the ANSI escape sequence [1] `\x1b[0m` that resets terminal
330
+ foreground and background colors to their default values. You can use `ansiColorReset` after printing
331
+ colored text to ensure subsequent output appears in the terminal's default color scheme.
349
332
 
350
- ANSI escape sequences [1] allow programs to control terminal display attributes by
351
- embedding special character sequences in output text. The sequence `\x1b[0m` (ESC[0m)
352
- resets all text attributes, including color, weight, and style, returning the terminal
353
- to its default state.
333
+ ANSI escape sequences [1] allow programs to control terminal display attributes by embedding special
334
+ character sequences in output text. The sequence `\x1b[0m` (ESC[0m) resets all text attributes,
335
+ including color, weight, and style, returning the terminal to its default state.
354
336
 
355
- You can concatenate `ansiColorReset` with output strings or write `ansiColorReset` as
356
- a separate operation after colored text. Failing to reset colors causes subsequent
357
- output to inherit the previous color settings, which can make output difficult to read
358
- if default-colored text appears against a colored background.
337
+ You can concatenate `ansiColorReset` with output strings or write `ansiColorReset` as a separate
338
+ operation after colored text. Failing to reset colors causes subsequent output to inherit the
339
+ previous color settings, which can make output difficult to read if default-colored text appears
340
+ against a colored background.
359
341
 
360
- Most modern terminal emulators support ANSI escape sequences [1] on all platforms,
361
- including Windows Terminal, macOS Terminal, and Linux terminals. Legacy Windows console
362
- applications may require enabling ANSI support through Windows API calls or environment
363
- variables.
342
+ Most modern terminal emulators support ANSI escape sequences [1] on all platforms, including Windows
343
+ Terminal, macOS Terminal, and Linux terminals. Legacy Windows console applications may require
344
+ enabling ANSI support through Windows API calls or environment variables.
364
345
 
365
346
  Examples
366
347
  --------
@@ -390,30 +371,27 @@ References
390
371
  class AnsiColors(NamedTuple):
391
372
  r"""Provide high-contrast ANSI color combinations for terminal output.
392
373
 
393
- (AI generated docstring)
374
+ You can use this class to access ANSI escape sequences [1] for displaying colored text in
375
+ terminal emulators. Each attribute holds an escape sequence that sets both foreground and
376
+ background colors simultaneously. The color combinations were selected through research into
377
+ high-contrast color visibility [2] to maximize readability across different terminal color
378
+ schemes and viewing conditions.
394
379
 
395
- You can use this class to access ANSI escape sequences [1] for displaying colored
396
- text in terminal emulators. Each attribute holds an escape sequence that sets both
397
- foreground and background colors simultaneously. The color combinations were selected
398
- through research into high-contrast color visibility [2] to maximize readability
399
- across different terminal color schemes and viewing conditions.
400
-
401
- ANSI escape sequences [1] control terminal display attributes by embedding special
402
- character sequences in output text. The sequences in `AnsiColors` use the format
403
- `\\x1b[foreground;backgroundm` where foreground and background are numeric color codes.
404
- Each sequence sets both colors simultaneously to ensure sufficient contrast regardless
405
- of the terminal's default color scheme.
380
+ ANSI escape sequences [1] control terminal display attributes by embedding special character
381
+ sequences in output text. The sequences in `AnsiColors` use the format
382
+ `\\x1b[foreground;backgroundm` where foreground and background are numeric color codes. Each
383
+ sequence sets both colors simultaneously to ensure sufficient contrast regardless of the
384
+ terminal's default color scheme.
406
385
 
407
386
  You can access color combinations through attribute names following the pattern
408
- `ForegroundOnBackground`, such as `BlackOnCyan` or `WhiteOnRed`. The colors were
409
- chosen to provide strong visual contrast while remaining comfortable to read during
410
- extended debugging sessions. Always use `ansiColorReset` [3] after colored output
411
- to return the terminal to default colors.
387
+ `ForegroundOnBackground`, such as `BlackOnCyan` or `WhiteOnRed`. The colors were chosen to
388
+ provide strong visual contrast while remaining comfortable to read during extended debugging
389
+ sessions. Always use `ansiColorReset` [3] after colored output to return the terminal to default
390
+ colors.
412
391
 
413
- The `NamedTuple` [4] base class makes `AnsiColors` immutable and provides both
414
- attribute access and sequence indexing. You can access colors by name
415
- (`ansiColors.GreenOnBlack`) or by index (`ansiColors[0]`), enabling dynamic color
416
- selection based on computed indices.
392
+ The `NamedTuple` [4] base class makes `AnsiColors` immutable and provides both attribute access
393
+ and sequence indexing. You can access colors by name (`ansiColors.GreenOnBlack`) or by index
394
+ (`ansiColors[0]`), enabling dynamic color selection based on computed indices.
417
395
 
418
396
  Attributes
419
397
  ----------
@@ -477,9 +455,8 @@ class AnsiColors(NamedTuple):
477
455
  >>> colorIndex = int(identifier, 36) % len(ansiColors)
478
456
  >>> sys.stdout.write(f"{ansiColors[colorIndex]}{identifier}{ansiColorReset}")
479
457
 
480
- This pattern provides consistent color assignment for identifiers based on their
481
- string representation, making repeated identifiers appear in the same color across
482
- multiple runs.
458
+ This pattern provides consistent color assignment for identifiers based on their string
459
+ representation, making repeated identifiers appear in the same color across multiple runs.
483
460
 
484
461
  You can combine multiple colored segments in output:
485
462
 
@@ -495,7 +472,7 @@ class AnsiColors(NamedTuple):
495
472
  [2] Color contrast - Wikipedia
496
473
  https://en.wikipedia.org/wiki/Contrast_(vision)#Color_contrast
497
474
  [3] ansiColorReset
498
- Internal package reference
475
+
499
476
  [4] Built-in Types - `typing.NamedTuple` (Python documentation)
500
477
  https://docs.python.org/3/library/typing.html#typing.NamedTuple
501
478
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hunterMakesPy
3
- Version: 0.5.1
3
+ Version: 0.5.2
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hunterMakesPy"
3
- version = "0.5.1"
3
+ version = "0.5.2"
4
4
  description = "Easy Python functions making making functional Python functions easier."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -73,16 +73,6 @@ requires = [
73
73
  ]
74
74
  build-backend = "setuptools.build_meta"
75
75
 
76
- # [tool.cibuildwheel]
77
- # test-command = "pytest"
78
- # test-extras = ["testing"]
79
- # test-sources = [
80
- # "humpy_cytoolz/tests",
81
- # "humpy_toolz/sandbox/tests",
82
- # "humpy_toolz/tests",
83
- # "hunterMakesPy/tests",
84
- # ]
85
-
86
76
  [tool.coverage]
87
77
  report = { exclude_lines = [
88
78
  "if TYPE_CHECKING:",
File without changes
File without changes
File without changes