hunterMakesPy 0.3.1__tar.gz → 0.3.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 (26) hide show
  1. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/PKG-INFO +1 -1
  2. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/__init__.py +3 -5
  3. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/dataStructures.py +36 -39
  4. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/tests/test_dataStructures.py +2 -9
  5. huntermakespy-0.3.2/hunterMakesPy/theTypes.py +17 -0
  6. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy.egg-info/PKG-INFO +1 -1
  7. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/pyproject.toml +1 -1
  8. huntermakespy-0.3.1/hunterMakesPy/theTypes.py +0 -9
  9. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/LICENSE +0 -0
  10. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/README.md +0 -0
  11. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/_theSSOT.py +0 -0
  12. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/coping.py +0 -0
  13. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/filesystemToolkit.py +0 -0
  14. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/parseParameters.py +0 -0
  15. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/py.typed +0 -0
  16. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/pytestForYourUse.py +0 -0
  17. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/tests/__init__.py +0 -0
  18. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/tests/conftest.py +0 -0
  19. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/tests/test_coping.py +0 -0
  20. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/tests/test_filesystemToolkit.py +0 -0
  21. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy/tests/test_parseParameters.py +0 -0
  22. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy.egg-info/SOURCES.txt +0 -0
  23. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy.egg-info/dependency_links.txt +0 -0
  24. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy.egg-info/requires.txt +0 -0
  25. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/hunterMakesPy.egg-info/top_level.txt +0 -0
  26. {huntermakespy-0.3.1 → huntermakespy-0.3.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hunterMakesPy
3
- Version: 0.3.1
3
+ Version: 0.3.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: CC-BY-NC-4.0
@@ -9,7 +9,7 @@ This package provides:
9
9
  """
10
10
 
11
11
  # isort: split
12
- from hunterMakesPy.theTypes import identifierDotAttribute as identifierDotAttribute
12
+ from hunterMakesPy.theTypes import identifierDotAttribute as identifierDotAttribute, Ordinals as Ordinals
13
13
 
14
14
  # isort: split
15
15
  from hunterMakesPy.coping import PackageSettings as PackageSettings, raiseIfNone as raiseIfNone
@@ -26,10 +26,8 @@ from hunterMakesPy.filesystemToolkit import (
26
26
 
27
27
  # isort: split
28
28
  from hunterMakesPy.dataStructures import (
29
- stringItUp as stringItUp, updateExtendPolishDictionaryLists as updateExtendPolishDictionaryLists)
30
-
31
- # isort: split
32
- from hunterMakesPy.dataStructures import autoDecodingRLE as autoDecodingRLE
29
+ autoDecodingRLE as autoDecodingRLE, stringItUp as stringItUp,
30
+ updateExtendPolishDictionaryLists as updateExtendPolishDictionaryLists)
33
31
 
34
32
  # isort: split
35
33
  from hunterMakesPy._theSSOT import settingsPackage # pyright: ignore[reportUnusedImport]
@@ -1,11 +1,14 @@
1
1
  """Provides utilities for string extraction from nested data structures and merges multiple dictionaries containing lists into one dictionary."""
2
-
2
+ from charset_normalizer import CharsetMatch
3
3
  from collections.abc import Mapping
4
+ from hunterMakesPy import Ordinals
4
5
  from numpy import integer
5
6
  from numpy.typing import NDArray
6
- from typing import Any, Protocol, TYPE_CHECKING, TypeVar
7
+ from typing import Any, cast, TYPE_CHECKING, TypeVar
8
+ import charset_normalizer
7
9
  import more_itertools
8
10
  import re as regex
11
+ import sys
9
12
 
10
13
  if TYPE_CHECKING:
11
14
  from collections.abc import Iterator
@@ -187,33 +190,37 @@ def stringItUp(*scrapPile: Any) -> list[str]:
187
190
  listStrungUp: list[str] = []
188
191
 
189
192
  def drill(KitKat: Any) -> None:
190
- match KitKat:
191
- case str():
192
- listStrungUp.append(KitKat)
193
- case bool() | bytearray() | bytes() | complex() | float() | int() | memoryview() | None:
194
- listStrungUp.append(str(KitKat))
195
- case dict():
196
- for broken, piece in KitKat.items():
197
- drill(broken)
198
- drill(piece)
199
- case list() | tuple() | set() | frozenset() | range():
200
- for kit in KitKat:
201
- drill(kit)
202
- case _:
203
- if hasattr(KitKat, '__iter__'): # Unpack other iterables
204
- for kat in KitKat:
205
- drill(kat)
206
- else:
207
- try:
208
- sharingIsCaring = KitKat.__str__()
209
- listStrungUp.append(sharingIsCaring)
210
- except AttributeError:
211
- pass
212
- except TypeError: # "The error traceback provided indicates that there is an issue when calling the __str__ method on an object that does not have this method properly defined, leading to a TypeError."
213
- pass
214
- except:
215
- print(f"\nWoah! I received '{repr(KitKat)}'.\nTheir report card says, 'Plays well with others: Needs improvement.'\n") # noqa: T201
216
- raise
193
+ if isinstance(KitKat, str):
194
+ listStrungUp.append(KitKat)
195
+ elif (KitKat is None) or (isinstance(KitKat, (bool, bytearray, bytes, complex, float, int))):
196
+ listStrungUp.append(str(KitKat))
197
+ elif isinstance(KitKat, memoryview):
198
+ decodedString: CharsetMatch | None = charset_normalizer.from_bytes(KitKat.tobytes()).best()
199
+ if decodedString:
200
+ listStrungUp.append(str(decodedString))
201
+ elif isinstance(KitKat, dict):
202
+ DictDact: dict[Any, Any] = cast(dict[Any, Any], KitKat)
203
+ for broken, piece in DictDact.items():
204
+ drill(broken)
205
+ drill(piece)
206
+ elif isinstance(KitKat, (list, tuple, set, frozenset, range)):
207
+ for kit in KitKat: # pyright: ignore[reportUnknownVariableType]
208
+ drill(kit)
209
+ elif hasattr(KitKat, '__iter__'): # Unpack other iterables
210
+ for kat in KitKat:
211
+ drill(kat)
212
+ else:
213
+ try:
214
+ sharingIsCaring: str = KitKat.__str__()
215
+ listStrungUp.append(sharingIsCaring)
216
+ except AttributeError:
217
+ pass
218
+ except TypeError: # "The error traceback provided indicates that there is an issue when calling the __str__ method on an object that does not have this method properly defined, leading to a TypeError."
219
+ pass
220
+ except:
221
+ message: str = (f"\nWoah! I received '{repr(KitKat)}'.\nTheir report card says, 'Plays well with others: Needs improvement.'\n")
222
+ sys.stderr.write(message)
223
+ raise
217
224
  try:
218
225
  for scrap in scrapPile:
219
226
  drill(scrap)
@@ -221,16 +228,6 @@ def stringItUp(*scrapPile: Any) -> list[str]:
221
228
  listStrungUp.append(repr(scrap))
222
229
  return listStrungUp
223
230
 
224
- class Ordinals(Protocol):
225
- """Protocol for types that support ordering comparisons."""
226
-
227
- def __le__(self, other: "Ordinals", /) -> bool:
228
- """Less than or equal to comparison."""
229
- ...
230
- def __ge__(self, other: "Ordinals", /) -> bool:
231
- """Greater than or equal to comparison."""
232
- ...
233
-
234
231
  小于 = TypeVar('小于', bound=Ordinals)
235
232
 
236
233
  def updateExtendPolishDictionaryLists(*dictionaryLists: Mapping[str, list[小于] | set[小于] | tuple[小于, ...]], destroyDuplicates: bool = False, reorderLists: bool = False, killErroneousDataTypes: bool = False) -> dict[str, list[小于]]:
@@ -5,7 +5,7 @@ from fractions import Fraction
5
5
  from hunterMakesPy import autoDecodingRLE, stringItUp, updateExtendPolishDictionaryLists
6
6
  from hunterMakesPy.tests.conftest import standardizedEqualTo
7
7
  from numpy.typing import NDArray
8
- from typing import Any, Literal
8
+ from typing import Any
9
9
  import datetime
10
10
  import numpy
11
11
  import pytest
@@ -35,6 +35,7 @@ class CustomIterable:
35
35
  # Binary data - accepting either representation
36
36
  ("Prime bytes", [b'\x0B', b'\x0D', b'\x11'], [repr(b'\x0b'), repr(b'\x0d'), repr(b'\x11')]), # Let Python choose representation
37
37
  ("Custom bytearray", [bytearray(b"DEADBEEF")], ["bytearray(b'DEADBEEF')"]),
38
+ ("Memory view decoded", memoryview(b"DEADBEEF"), ["DEADBEEF"]),
38
39
  # Nested structures with unique values
39
40
  ("Nested dictionary", {'phi': 1.618, 'euler': 2.718}, ['phi', '1.618', 'euler', '2.718']),
40
41
  ("Mixed nesting", [{'NE': 37}, {'SW': 41}], ['NE', '37', 'SW', '41']),
@@ -59,14 +60,6 @@ def testStringItUp(description: str, value_scrapPile: list[Any], expected: list[
59
60
  """Test stringItUp with various inputs."""
60
61
  standardizedEqualTo(expected, stringItUp, value_scrapPile)
61
62
 
62
- @pytest.mark.parametrize("description,value_scrapPile,expected", [
63
- ("Memory view", memoryview(b"DEADBEEF"), ["<memory at 0x"]), # Special handling for memoryview
64
- ], ids=lambda x: x if isinstance(x, str) else "")
65
- def testStringItUpErrorCases(description: Literal['Memory view'], value_scrapPile: memoryview, expected: list[str]) -> None:
66
- result = stringItUp(value_scrapPile)
67
- assert len(result) == 1
68
- assert result[0].startswith(expected[0])
69
-
70
63
  @pytest.mark.parametrize("description,value_dictionaryLists,keywordArguments,expected", [
71
64
  ("Mixed value types", ({'ne': [11, 'prime'], 'sw': [True, None]}, {'ne': [3.141, 'golden'], 'sw': [False, 'void']}), {'destroyDuplicates': False, 'reorderLists': False}, {'ne': [11, 'prime', 3.141, 'golden'], 'sw': [True, None, False, 'void']}),
72
65
  ("Empty dictionaries", (dict[str, list[Any]](), dict[str, list[Any]]()), dict[str, Any](), dict[str, list[Any]]()),
@@ -0,0 +1,17 @@
1
+ """I type, you type, we all `type` for `theTypes`."""
2
+ from typing import Protocol, Self, TypeAlias
3
+
4
+ identifierDotAttribute: TypeAlias = str
5
+ """`str` (***str***ing) representing a dotted attribute identifier.
6
+
7
+ `TypeAlias` for a `str` `object` using dot notation to access an attribute, such as 'scipy.signal.windows'.
8
+
9
+ """
10
+
11
+
12
+ class Ordinals(Protocol):
13
+ """Any Python `object` `type` that may be ordered before or after a comparable `object` `type` using a less-than-or-equal-to comparison."""
14
+
15
+ def __le__(self, not_self_selfButSelfSelf_youKnow: Self, /) -> bool:
16
+ """Comparison by "***l***ess than or ***e***qual to"."""
17
+ ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hunterMakesPy
3
- Version: 0.3.1
3
+ Version: 0.3.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: CC-BY-NC-4.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hunterMakesPy"
3
- version = "0.3.1"
3
+ version = "0.3.2"
4
4
  description = "Easy Python functions making making functional Python functions easier."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,9 +0,0 @@
1
- """I type, you type, we all `type` for `theTypes`."""
2
- from typing import TypeAlias
3
-
4
- identifierDotAttribute: TypeAlias = str
5
- """`str` (***str***ing) representing a dotted attribute identifier.
6
-
7
- `TypeAlias` for a `str` `object` using dot notation to access an attribute, such as 'scipy.signal.windows'.
8
-
9
- """
File without changes
File without changes
File without changes