hunterMakesPy 0.7.4__tar.gz → 0.7.6__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.
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/PKG-INFO +1 -1
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/__init__.py +3 -1
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/parseParameters.py +16 -23
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/semiotics.py +2 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy.egg-info/PKG-INFO +1 -1
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/pyproject.toml +1 -1
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/LICENSE +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/README.md +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/_theSSOT.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/coping.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/dataStructures.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/filesystemToolkit.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/py.typed +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/tests/__init__.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/tests/conftest.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/tests/test_coping.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/tests/test_dataStructures.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/tests/test_filesystemToolkit.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/tests/test_parseParameters.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/tests/test_theTypes.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/theTypes.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy/theTypesCallableFunction.py +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy.egg-info/SOURCES.txt +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy.egg-info/dependency_links.txt +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy.egg-info/requires.txt +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/hunterMakesPy.egg-info/top_level.txt +0 -0
- {huntermakespy-0.7.4 → huntermakespy-0.7.6}/setup.cfg +0 -0
|
@@ -68,7 +68,9 @@ References
|
|
|
68
68
|
# isort: split
|
|
69
69
|
from __future__ import annotations
|
|
70
70
|
|
|
71
|
-
from hunterMakesPy.semiotics import
|
|
71
|
+
from hunterMakesPy.semiotics import (
|
|
72
|
+
ansiColor as ansiColor, ansiColorReset as ansiColorReset, decreasing as decreasing, errorL33T as errorL33T, inclusive as inclusive,
|
|
73
|
+
oneIndexed as oneIndexed, zeroIndexed as zeroIndexed)
|
|
72
74
|
|
|
73
75
|
# isort: split
|
|
74
76
|
from hunterMakesPy.theTypes import (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ruff:
|
|
1
|
+
# ruff: file-ignore[raise-within-try, docstring-missing-exception, too-many-statements-in-try-clause, blind-except]
|
|
2
2
|
"""Validate parameters and parse input with defensive error handling.
|
|
3
3
|
|
|
4
4
|
(AI generated docstring)
|
|
@@ -45,7 +45,7 @@ import sys
|
|
|
45
45
|
|
|
46
46
|
if TYPE_CHECKING:
|
|
47
47
|
from charset_normalizer.models import CharsetMatch
|
|
48
|
-
from collections.abc import
|
|
48
|
+
from collections.abc import Collection
|
|
49
49
|
from hunterMakesPy.theTypes import Limitation
|
|
50
50
|
from typing import Any
|
|
51
51
|
|
|
@@ -195,7 +195,7 @@ def _constructErrorMessage(context: ErrorMessageContext, parameterName: str, par
|
|
|
195
195
|
|
|
196
196
|
return "".join(messageParts)
|
|
197
197
|
|
|
198
|
-
def intInnit(listInt_Allegedly:
|
|
198
|
+
def intInnit(listInt_Allegedly: Collection[Any], parameterName: str | None = None, parameterType: type[Any] | None = None) -> list[int]:
|
|
199
199
|
"""Validate and convert input values to a `list` of integers.
|
|
200
200
|
|
|
201
201
|
Accepts various numeric types and attempts to convert them into integers while providing descriptive error messages. This
|
|
@@ -204,7 +204,7 @@ def intInnit(listInt_Allegedly: Iterable[Any], parameterName: str | None = None,
|
|
|
204
204
|
|
|
205
205
|
Parameters
|
|
206
206
|
----------
|
|
207
|
-
listInt_Allegedly :
|
|
207
|
+
listInt_Allegedly : Collection[Any]
|
|
208
208
|
The input sequence that should contain integer-compatible values. Accepts integers, strings, floats, complex numbers, and
|
|
209
209
|
binary data. Rejects boolean values and non-integer numeric values.
|
|
210
210
|
parameterName : str | None = None
|
|
@@ -236,7 +236,7 @@ def intInnit(listInt_Allegedly: Iterable[Any], parameterName: str | None = None,
|
|
|
236
236
|
parameterType = parameterType or list
|
|
237
237
|
|
|
238
238
|
if not listInt_Allegedly:
|
|
239
|
-
message: str = f"I did not receive a value for {parameterName}
|
|
239
|
+
message: str = f"I did not receive a value for `{parameterName}`, but I must have it."
|
|
240
240
|
raise ValueError(message)
|
|
241
241
|
|
|
242
242
|
# Be nice, and assume the input container is valid and every element is valid.
|
|
@@ -250,11 +250,10 @@ def intInnit(listInt_Allegedly: Iterable[Any], parameterName: str | None = None,
|
|
|
250
250
|
listValidated: list[int] = []
|
|
251
251
|
|
|
252
252
|
for allegedInt in listInt_Allegedly:
|
|
253
|
-
|
|
254
253
|
errorMessageContext: ErrorMessageContext = ErrorMessageContext(
|
|
255
|
-
parameterValue=allegedInt
|
|
256
|
-
parameterValueType=type(allegedInt).__name__
|
|
257
|
-
isElement=True
|
|
254
|
+
parameterValue=allegedInt
|
|
255
|
+
, parameterValueType=type(allegedInt).__name__
|
|
256
|
+
, isElement=True
|
|
258
257
|
)
|
|
259
258
|
|
|
260
259
|
# Always rejected as ambiguous
|
|
@@ -292,26 +291,20 @@ def intInnit(listInt_Allegedly: Iterable[Any], parameterName: str | None = None,
|
|
|
292
291
|
if lengthInitial is not None and isinstance(listInt_Allegedly, Sized) and len(listInt_Allegedly) != lengthInitial:
|
|
293
292
|
raise RuntimeError((lengthInitial, len(listInt_Allegedly)))
|
|
294
293
|
|
|
295
|
-
except (TypeError, ValueError) as
|
|
296
|
-
if isinstance(
|
|
297
|
-
context: ErrorMessageContext =
|
|
294
|
+
except (TypeError, ValueError) as ERROR:
|
|
295
|
+
if isinstance(ERROR.args[0], ErrorMessageContext):
|
|
296
|
+
context: ErrorMessageContext = ERROR.args[0]
|
|
298
297
|
if not context.containerType:
|
|
299
298
|
context.containerType = type(listInt_Allegedly).__name__
|
|
300
299
|
message = _constructErrorMessage(context, parameterName, parameterType)
|
|
301
|
-
raise type(
|
|
300
|
+
raise type(ERROR)(message) from None
|
|
302
301
|
# If it's not our Exception, don't molest it
|
|
303
302
|
raise
|
|
304
303
|
|
|
305
|
-
except RuntimeError as
|
|
306
|
-
lengthCurrent
|
|
307
|
-
lengthInitial, lengthCurrent =
|
|
308
|
-
|
|
309
|
-
f"The input sequence {parameterName} was modified during iteration. "
|
|
310
|
-
f"Initial length {lengthInitial}, current length {lengthCurrent}."
|
|
311
|
-
)
|
|
312
|
-
raise RuntimeError(
|
|
313
|
-
ERRORmessage
|
|
314
|
-
) from None
|
|
304
|
+
except RuntimeError as ERROR:
|
|
305
|
+
lengthInitial, lengthCurrent = ERROR.args[0]
|
|
306
|
+
message = (f"`{parameterName}` was modified during iteration: {lengthInitial = }, current length {lengthCurrent = }.")
|
|
307
|
+
raise RuntimeError(message) from None
|
|
315
308
|
|
|
316
309
|
else:
|
|
317
310
|
return listValidated
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|