Utilities for converting mixed input to integers, calculating CPU limits, handling None values, importing code dynamically, and manipulating nested data.
Accepts strings, floats, complex numbers, and binary data and returns a list of validated integers. Ambiguous or incompatible values produce descriptive errors.
from hunterMakesPy.parseParameters import intInnit
ports = intInnit(["8080", 443, "22"], "server_ports")
# Returns: [8080, 443, 22]Pass 0.75 for 75% of CPUs, True for 1 CPU, 4 for exactly 4 CPUs, or -2 to reserve 2 CPUs.
from hunterMakesPy.parseParameters import defineConcurrencyLimit
workers = defineConcurrencyLimit(limit=0.75) # 6 on an 8-core machineParse string values such as "true", "false", or "none" into their Python equivalents without raising exceptions on mismatch.
from hunterMakesPy.parseParameters import oopsieKwargsie
oopsieKwargsie("True") # Returns: True
oopsieKwargsie("none") # Returns: None
oopsieKwargsie("hello") # Returns: "hello"Convert Type | None return annotations to Type by raising at runtime if the value is None. Removes None-checking noise from downstream code and satisfies type checkers.
from hunterMakesPy import raiseIfNone
config = raiseIfNone(getConfig(), "Missing configuration")Use decreasing instead of -1, inclusive for boundary adjustments, and zeroIndexed for index conversions. Intent becomes explicit and the code reads as prose.
from hunterMakesPy import decreasing, inclusive, zeroIndexed
rangeEnd = lengthSequence + inclusive
indexLast = lengthSequence - zeroIndexed
step = decreasingLoad functions or classes from "scipy.signal.windows" or "path/to/file.py" without manual module-loading boilerplate.
from hunterMakesPy.filesystemToolkit import importLogicalPath2Identifier
windowFunction = importLogicalPath2Identifier("scipy.signal.windows", "hann")Write to "deep/nested/path/file.txt" and parent directories are created automatically. writePython removes unused imports and sorts import statements before writing.
from hunterMakesPy.filesystemToolkit import writeStringToHere, writePython
writeStringToHere("content", "nested/dirs/file.txt") # Creates dirs
writePython(sourceCode, "output/module.py") # Formats, then writesRecursively traverse dictionaries, lists, tuples, and sets and collect every string value into a flat list.
from hunterMakesPy.dataStructures import stringItUp
strings = stringItUp({"users": ["alice"], "config": {"host": "localhost"}})
# Returns: ["users", "alice", "config", "host", "localhost"]Combine {"a": [1, 2]} and {"a": [3], "b": [4]} into {"a": [1, 2, 3], "b": [4]} with optional deduplication and sorting.
from hunterMakesPy.dataStructures import updateExtendPolishDictionaryLists
merged = updateExtendPolishDictionaryLists(
{"servers": ["chicago"]},
{"servers": ["tokyo", "chicago"]},
destroyDuplicates=True,
)
# Returns: {"servers": ["chicago", "tokyo"]}Encode repetitive patterns and consecutive sequences using run-length encoding and Python range syntax. The resulting string evaluates back to the original data.
from hunterMakesPy.dataStructures import autoDecodingRLE
encoded = autoDecodingRLE(arrayTarget)PackageSettings reads pyproject.toml automatically to resolve the package name and installation path.
from hunterMakesPy import PackageSettings
settings = PackageSettings(identifierPackageFALLBACK="myPackage")Import parameterized test generators to validate custom functions that match the expected signatures.
from hunterMakesPy.tests.test_parseParameters import PytestFor_intInnit
@pytest.mark.parametrize("test_name,test_func", PytestFor_intInnit(myFunction))
def test_my_integer_validator(test_name, test_func):
test_func()By law, authors retain their copyrights unless they grant exceptions. The Attribution-NonCommercial 4.0 International Deed outlines how you may use this work.
The restriction on commercial use (without a license) limits advantage-taking, unjust enrichment, and exploitation. You would be morally wrong if you were to enrich yourself by using this work while I am denied healthcare, housing, security of property, and the safety of my person.
To obtain and retain the right to use this work, you incur the cost of attributing the work to me. Your nominal cost might accrue as a benefit that mitigates my suffering or saves my life.
