hunterMakesPy 0.5.5__tar.gz → 0.6.0__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.5/hunterMakesPy.egg-info → huntermakespy-0.6.0}/PKG-INFO +2 -1
  2. huntermakespy-0.6.0/humpy_toolz/_signatures.py +458 -0
  3. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/dicttoolz.py +4 -5
  4. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/functoolz.pyi +16 -0
  5. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/itertoolz.py +8 -1
  6. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/__init__.py +1 -1
  7. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/coping.py +8 -5
  8. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/dataStructures.py +20 -20
  9. huntermakespy-0.6.0/hunterMakesPy/filesystemToolkit.py +293 -0
  10. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/parseParameters.py +9 -7
  11. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/semiotics.py +0 -1
  12. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/tests/test_dataStructures.py +5 -4
  13. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/tests/test_filesystemToolkit.py +9 -10
  14. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/tests/test_parseParameters.py +3 -3
  15. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/tests/test_theTypes.py +21 -18
  16. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/theTypes.py +5 -2
  17. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/theTypesCallableFunction.py +13 -19
  18. {huntermakespy-0.5.5 → huntermakespy-0.6.0/hunterMakesPy.egg-info}/PKG-INFO +2 -1
  19. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy.egg-info/requires.txt +1 -0
  20. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/pyproject.toml +3 -2
  21. huntermakespy-0.5.5/humpy_toolz/_signatures.py +0 -199
  22. huntermakespy-0.5.5/hunterMakesPy/filesystemToolkit.py +0 -222
  23. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/LICENSE +0 -0
  24. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/README.md +0 -0
  25. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/Notice_of_Copyright.txt +0 -0
  26. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/__init__.pxd +0 -0
  27. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/__init__.py +0 -0
  28. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/__init__.pyi +0 -0
  29. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/_signatures.py +0 -0
  30. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/_signatures.pyi +0 -0
  31. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/cpython.pxd +0 -0
  32. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/curried/__init__.py +0 -0
  33. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/curried/exceptions.py +0 -0
  34. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/curried/exceptions.pyi +0 -0
  35. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/curried/operator.py +0 -0
  36. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/dicttoolz.c +0 -0
  37. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/dicttoolz.pxd +0 -0
  38. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/dicttoolz.pyi +0 -0
  39. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/dicttoolz.pyx +0 -0
  40. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/functoolz.c +0 -0
  41. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/functoolz.pxd +0 -0
  42. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/functoolz.pyi +0 -0
  43. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/functoolz.pyx +0 -0
  44. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/itertoolz.c +0 -0
  45. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/itertoolz.pxd +0 -0
  46. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/itertoolz.pyi +0 -0
  47. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/itertoolz.pyx +0 -0
  48. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/py.typed +0 -0
  49. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/recipes.c +0 -0
  50. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/recipes.pxd +0 -0
  51. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/recipes.pyi +0 -0
  52. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/recipes.pyx +0 -0
  53. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/__init__.py +0 -0
  54. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/dev_skip_test.py +0 -0
  55. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_curried.py +0 -0
  56. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_curried_toolzlike.py +0 -0
  57. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_dev_skip_test.py +0 -0
  58. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_dicttoolz.py +0 -0
  59. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_docstrings.py +0 -0
  60. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_doctests.py +0 -0
  61. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_embedded_sigs.py +0 -0
  62. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_functoolz.py +0 -0
  63. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_inspect_args.py +0 -0
  64. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_itertoolz.py +0 -0
  65. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_none_safe.py +0 -0
  66. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_recipes.py +0 -0
  67. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_serialization.py +0 -0
  68. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_signatures.py +0 -0
  69. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_stubs.py +0 -0
  70. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_tlz.py +0 -0
  71. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/tests/test_utils.py +0 -0
  72. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/utils.c +0 -0
  73. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/utils.pxd +0 -0
  74. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/utils.pyi +0 -0
  75. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_cytoolz/utils.pyx +0 -0
  76. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_tlz/__init__.py +0 -0
  77. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_tlz/_build_tlz.py +0 -0
  78. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/Notice_of_Copyright.txt +0 -0
  79. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/__init__.py +0 -0
  80. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/__init__.pyi +0 -0
  81. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/curried/__init__.py +0 -0
  82. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/curried/__init__.pyi +0 -0
  83. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/curried/exceptions.py +0 -0
  84. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/curried/exceptions.pyi +0 -0
  85. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/curried/operator.py +0 -0
  86. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/curried/operator.pyi +0 -0
  87. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/functoolz.py +0 -0
  88. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/py.typed +0 -0
  89. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/recipes.py +0 -0
  90. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/recipes.pyi +0 -0
  91. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/sandbox/__init__.py +0 -0
  92. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/sandbox/__init__.pyi +0 -0
  93. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/sandbox/core.py +0 -0
  94. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/sandbox/core.pyi +0 -0
  95. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/sandbox/parallel.py +0 -0
  96. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/sandbox/parallel.pyi +0 -0
  97. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/sandbox/tests/__init__.py +0 -0
  98. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/sandbox/tests/test_core.py +0 -0
  99. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/sandbox/tests/test_parallel.py +0 -0
  100. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/__init__.py +0 -0
  101. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_curried.py +0 -0
  102. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_curried_doctests.py +0 -0
  103. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_dicttoolz.py +0 -0
  104. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_functoolz.py +0 -0
  105. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_inspect_args.py +0 -0
  106. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_itertoolz.py +0 -0
  107. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_package.py +0 -0
  108. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_recipes.py +0 -0
  109. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_serialization.py +0 -0
  110. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_signatures.py +0 -0
  111. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_tlz.py +0 -0
  112. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/tests/test_utils.py +0 -0
  113. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/humpy_toolz/utils.py +0 -0
  114. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/_theSSOT.py +0 -0
  115. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/py.typed +0 -0
  116. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/tests/__init__.py +0 -0
  117. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/tests/conftest.py +0 -0
  118. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy/tests/test_coping.py +0 -0
  119. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy.egg-info/SOURCES.txt +0 -0
  120. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy.egg-info/dependency_links.txt +0 -0
  121. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/hunterMakesPy.egg-info/top_level.txt +0 -0
  122. {huntermakespy-0.5.5 → huntermakespy-0.6.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hunterMakesPy
3
- Version: 0.5.5
3
+ Version: 0.6.0
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
@@ -35,6 +35,7 @@ Requires-Dist: charset_normalizer
35
35
  Requires-Dist: isort
36
36
  Requires-Dist: more_itertools
37
37
  Requires-Dist: numpy
38
+ Requires-Dist: tomli
38
39
  Requires-Dist: typing_extensions>=4.10.0
39
40
  Provides-Extra: development
40
41
  Requires-Dist: astToolkit; extra == "development"
@@ -0,0 +1,458 @@
1
+ # pyright: reportUnusedFunction=false
2
+ # pyright: reportUnknownLambdaType=false
3
+ # ruff: noqa: ARG005 A006 ANN202 TRY300 ANN001
4
+ """Internal module for better introspection of builtins.
5
+
6
+ The main functions are ``is_builtin_valid_args``, ``is_builtin_partial_args``,
7
+ and ``has_unknown_args``. Other functions in this module support these three.
8
+
9
+ Notably, we create a ``signatures`` registry to enable introspection of
10
+ builtin functions in any Python version. This includes builtins that
11
+ have more than one valid signature. Currently, the registry includes
12
+ builtins from ``builtins``, ``functools``, ``itertools``, and ``operator``
13
+ modules. More can be added as requested. We don't guarantee full coverage.
14
+
15
+ Everything in this module should be regarded as implementation details.
16
+ Users should try to not use this module directly.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from .functoolz import has_keywords, has_varargs, is_arity, is_partial_args, num_required_args
22
+ from importlib import import_module
23
+ from typing import Any, TYPE_CHECKING
24
+ import builtins
25
+ import functools
26
+ import inspect
27
+ import itertools
28
+ import operator
29
+
30
+ if TYPE_CHECKING:
31
+ from collections.abc import Callable
32
+ from types import ModuleType
33
+
34
+ type SignatureSpecification = tuple[int, Callable[..., Any], tuple[str, ...], inspect.Signature | None]
35
+ type SignatureInput = Callable[..., Any] | tuple[int, Callable[..., Any]] | tuple[int, Callable[..., Any], tuple[str, ...]]
36
+
37
+ module_info: dict[ModuleType, dict[str, list[SignatureInput]]] = {}
38
+ module_info[builtins] = {
39
+ 'abs': [lambda x: None],
40
+ 'all': [lambda iterable: None],
41
+ 'anext': [lambda aiterator: None, lambda aiterator, default: None],
42
+ 'any': [lambda iterable: None],
43
+ 'apply': [lambda object: None, lambda object, args: None, lambda object, args, kwargs: None],
44
+ 'ascii': [lambda obj: None],
45
+ 'bin': [lambda number: None],
46
+ 'bool': [lambda x=False: None],
47
+ 'buffer': [lambda object: None, lambda object, offset: None, lambda object, offset, size: None],
48
+ 'bytearray': [lambda: None, lambda int: None, lambda string, encoding='utf8', errors='strict': None],
49
+ 'callable': [lambda obj: None],
50
+ 'chr': [lambda i: None],
51
+ 'classmethod': [lambda function: None],
52
+ 'cmp': [lambda x, y: None],
53
+ 'coerce': [lambda x, y: None],
54
+ 'complex': [lambda real=0, imag=0: None],
55
+ 'delattr': [lambda obj, name: None],
56
+ 'dict': [lambda **kwargs: None, lambda mapping, **kwargs: None],
57
+ 'dir': [lambda: None, lambda object: None],
58
+ 'divmod': [lambda x, y: None],
59
+ 'enumerate': [(0, lambda iterable, start=0: None)],
60
+ 'eval': [lambda source: None, lambda source, globals: None, lambda source, globals, locals: None],
61
+ 'execfile': [lambda filename: None, lambda filename, globals: None, lambda filename, globals, locals: None],
62
+ 'file': [(0, lambda name, mode='r', buffering=-1: None)],
63
+ 'filter': [lambda function, iterable: None],
64
+ 'float': [lambda x=0.0: None],
65
+ 'format': [lambda value: None, lambda value, format_spec: None],
66
+ 'frozendict': [lambda **kwargs: None, lambda mapping, **kwargs: None],
67
+ 'frozenset': [lambda: None, lambda iterable: None],
68
+ 'getattr': [lambda object, name: None, lambda object, name, default: None],
69
+ 'globals': [lambda: None],
70
+ 'hasattr': [lambda obj, name: None],
71
+ 'hash': [lambda obj: None],
72
+ 'hex': [lambda number: None],
73
+ 'id': [lambda obj: None],
74
+ 'input': [lambda: None, lambda prompt: None],
75
+ 'int': [lambda x=0: None, (0, lambda x, base=10: None)],
76
+ 'intern': [lambda string: None],
77
+ 'isinstance': [lambda obj, class_or_tuple: None],
78
+ 'issubclass': [lambda cls, class_or_tuple: None],
79
+ 'iter': [lambda iterable: None, lambda callable, sentinel: None],
80
+ 'len': [lambda obj: None],
81
+ 'list': [lambda: None, lambda iterable: None],
82
+ 'locals': [lambda: None],
83
+ 'long': [lambda x=0: None, (0, lambda x, base=10: None)],
84
+ 'map': [lambda func, sequence, *iterables: None],
85
+ 'memoryview': [(0, lambda object: None)],
86
+ 'next': [lambda iterator: None, lambda iterator, default: None],
87
+ 'object': [lambda: None],
88
+ 'oct': [lambda number: None],
89
+ 'ord': [lambda c: None],
90
+ 'pow': [lambda x, y: None, lambda x, y, z: None],
91
+ 'property': [lambda fget=None, fset=None, fdel=None, doc=None: None],
92
+ 'range': [lambda stop: None, lambda start, stop: None, lambda start, stop, step: None],
93
+ 'raw_input': [lambda: None, lambda prompt: None],
94
+ 'reduce': [lambda function, sequence: None, lambda function, sequence, initial: None],
95
+ 'reload': [lambda module: None],
96
+ 'repr': [lambda obj: None],
97
+ 'reversed': [lambda sequence: None],
98
+ 'round': [(0, lambda number, ndigits=0: None)],
99
+ 'set': [lambda: None, lambda iterable: None],
100
+ 'setattr': [lambda obj, name, value: None],
101
+ 'slice': [lambda stop: None, lambda start, stop: None, lambda start, stop, step: None],
102
+ 'staticmethod': [lambda function: None],
103
+ 'sum': [lambda iterable: None, lambda iterable, start: None],
104
+ 'super': [lambda type: None, lambda type, obj: None],
105
+ 'tuple': [lambda: None, lambda iterable: None],
106
+ 'type': [lambda object: None, lambda name, bases, dict: None],
107
+ 'unichr': [lambda i: None],
108
+ 'unicode': [lambda object: None, lambda string='', encoding='utf8', errors='strict': None],
109
+ 'vars': [lambda: None, lambda object: None],
110
+ 'xrange': [lambda stop: None, lambda start, stop: None, lambda start, stop, step: None],
111
+ 'zip': [lambda *iterables: None],
112
+ '__build_class__': [(2, lambda func, name, *bases, **kwds: None, ('metaclass',))],
113
+ '__import__': [(0, lambda name, globals=None, locals=None, fromlist=None, level=None: None)],
114
+ }
115
+ module_info[builtins]['exec'] = [lambda source: None, lambda source, globals: None, lambda source, globals, locals: None]
116
+ module_info[builtins].update(
117
+ breakpoint=[lambda *args, **kws: None],
118
+ bytes=[lambda: None, lambda int: None, lambda string, encoding='utf8', errors='strict': None],
119
+ compile=[(0, lambda source, filename, mode, flags=0, dont_inherit=False, optimize=-1: None)],
120
+ max=[(1, lambda iterable: None, ('default', 'key')), (1, lambda arg1, arg2, *args: None, ('key',))],
121
+ min=[(1, lambda iterable: None, ('default', 'key')), (1, lambda arg1, arg2, *args: None, ('key',))],
122
+ open=[(0, lambda file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None: None)],
123
+ sorted=[(1, lambda iterable: None, ('key', 'reverse'))],
124
+ str=[lambda object='', encoding='utf', errors='strict': None],
125
+ )
126
+ module_info[builtins]['print'] = [(0, lambda *args: None, ('sep', 'end', 'file', 'flush'))]
127
+ module_info[functools] = {
128
+ 'cmp_to_key': [(0, lambda mycmp: None)],
129
+ 'partial': [lambda func, *args, **kwargs: None],
130
+ 'partialmethod': [lambda func, *args, **kwargs: None],
131
+ 'reduce': [lambda function, sequence: None, lambda function, sequence, initial: None],
132
+ }
133
+ module_info[itertools] = {
134
+ 'accumulate': [(0, lambda iterable, func=None: None)],
135
+ 'chain': [lambda *iterables: None],
136
+ 'combinations': [(0, lambda iterable, r: None)],
137
+ 'combinations_with_replacement': [(0, lambda iterable, r: None)],
138
+ 'compress': [(0, lambda data, selectors: None)],
139
+ 'count': [lambda start=0, step=1: None],
140
+ 'cycle': [lambda iterable: None],
141
+ 'dropwhile': [lambda predicate, iterable: None],
142
+ 'filterfalse': [lambda function, sequence: None],
143
+ 'groupby': [(0, lambda iterable, key=None: None)],
144
+ 'ifilter': [lambda function, sequence: None],
145
+ 'ifilterfalse': [lambda function, sequence: None],
146
+ 'imap': [lambda func, sequence, *iterables: None],
147
+ 'islice': [lambda iterable, stop: None, lambda iterable, start, stop: None, lambda iterable, start, stop, step: None],
148
+ 'izip': [lambda *iterables: None],
149
+ 'izip_longest': [(0, lambda *iterables: None, ('fillvalue',))],
150
+ 'pairwise': [lambda iterable: None],
151
+ 'permutations': [(0, lambda iterable, r=0: None)],
152
+ 'product': [(0, lambda *iterables: None, ('repeat',))],
153
+ 'repeat': [(0, lambda object, times=0: None)],
154
+ 'starmap': [lambda function, sequence: None],
155
+ 'takewhile': [lambda predicate, iterable: None],
156
+ 'tee': [lambda iterable: None, lambda iterable, n: None],
157
+ 'zip_longest': [(0, lambda *iterables: None, ('fillvalue',))],
158
+ }
159
+ module_info[operator] = {
160
+ '__abs__': [lambda a: None],
161
+ '__add__': [lambda a, b: None],
162
+ '__and__': [lambda a, b: None],
163
+ '__concat__': [lambda a, b: None],
164
+ '__contains__': [lambda a, b: None],
165
+ '__delitem__': [lambda a, b: None],
166
+ '__delslice__': [lambda a, b, c: None],
167
+ '__div__': [lambda a, b: None],
168
+ '__eq__': [lambda a, b: None],
169
+ '__floordiv__': [lambda a, b: None],
170
+ '__ge__': [lambda a, b: None],
171
+ '__getitem__': [lambda a, b: None],
172
+ '__getslice__': [lambda a, b, c: None],
173
+ '__gt__': [lambda a, b: None],
174
+ '__iadd__': [lambda a, b: None],
175
+ '__iand__': [lambda a, b: None],
176
+ '__iconcat__': [lambda a, b: None],
177
+ '__idiv__': [lambda a, b: None],
178
+ '__ifloordiv__': [lambda a, b: None],
179
+ '__ilshift__': [lambda a, b: None],
180
+ '__imatmul__': [lambda a, b: None],
181
+ '__imod__': [lambda a, b: None],
182
+ '__imul__': [lambda a, b: None],
183
+ '__index__': [lambda a: None],
184
+ '__inv__': [lambda a: None],
185
+ '__invert__': [lambda a: None],
186
+ '__ior__': [lambda a, b: None],
187
+ '__ipow__': [lambda a, b: None],
188
+ '__irepeat__': [lambda a, b: None],
189
+ '__irshift__': [lambda a, b: None],
190
+ '__isub__': [lambda a, b: None],
191
+ '__itruediv__': [lambda a, b: None],
192
+ '__ixor__': [lambda a, b: None],
193
+ '__le__': [lambda a, b: None],
194
+ '__lshift__': [lambda a, b: None],
195
+ '__lt__': [lambda a, b: None],
196
+ '__matmul__': [lambda a, b: None],
197
+ '__mod__': [lambda a, b: None],
198
+ '__mul__': [lambda a, b: None],
199
+ '__ne__': [lambda a, b: None],
200
+ '__neg__': [lambda a: None],
201
+ '__not__': [lambda a: None],
202
+ '__or__': [lambda a, b: None],
203
+ '__pos__': [lambda a: None],
204
+ '__pow__': [lambda a, b: None],
205
+ '__repeat__': [lambda a, b: None],
206
+ '__rshift__': [lambda a, b: None],
207
+ '__setitem__': [lambda a, b, c: None],
208
+ '__setslice__': [lambda a, b, c, d: None],
209
+ '__sub__': [lambda a, b: None],
210
+ '__truediv__': [lambda a, b: None],
211
+ '__xor__': [lambda a, b: None],
212
+ '_abs': [lambda x: None],
213
+ '_compare_digest': [lambda a, b: None],
214
+ 'abs': [lambda a: None],
215
+ 'add': [lambda a, b: None],
216
+ 'and_': [lambda a, b: None],
217
+ 'attrgetter': [lambda attr, *args: None],
218
+ 'concat': [lambda a, b: None],
219
+ 'contains': [lambda a, b: None],
220
+ 'countOf': [lambda a, b: None],
221
+ 'delitem': [lambda a, b: None],
222
+ 'delslice': [lambda a, b, c: None],
223
+ 'div': [lambda a, b: None],
224
+ 'eq': [lambda a, b: None],
225
+ 'floordiv': [lambda a, b: None],
226
+ 'ge': [lambda a, b: None],
227
+ 'getitem': [lambda a, b: None],
228
+ 'getslice': [lambda a, b, c: None],
229
+ 'gt': [lambda a, b: None],
230
+ 'iadd': [lambda a, b: None],
231
+ 'iand': [lambda a, b: None],
232
+ 'iconcat': [lambda a, b: None],
233
+ 'idiv': [lambda a, b: None],
234
+ 'ifloordiv': [lambda a, b: None],
235
+ 'ilshift': [lambda a, b: None],
236
+ 'imatmul': [lambda a, b: None],
237
+ 'imod': [lambda a, b: None],
238
+ 'imul': [lambda a, b: None],
239
+ 'index': [lambda a: None],
240
+ 'indexOf': [lambda a, b: None],
241
+ 'inv': [lambda a: None],
242
+ 'invert': [lambda a: None],
243
+ 'ior': [lambda a, b: None],
244
+ 'ipow': [lambda a, b: None],
245
+ 'irepeat': [lambda a, b: None],
246
+ 'irshift': [lambda a, b: None],
247
+ 'is_': [lambda a, b: None],
248
+ 'is_not': [lambda a, b: None],
249
+ 'isCallable': [lambda a: None],
250
+ 'isMappingType': [lambda a: None],
251
+ 'isNumberType': [lambda a: None],
252
+ 'isSequenceType': [lambda a: None],
253
+ 'isub': [lambda a, b: None],
254
+ 'itemgetter': [lambda item, *args: None],
255
+ 'itruediv': [lambda a, b: None],
256
+ 'ixor': [lambda a, b: None],
257
+ 'le': [lambda a, b: None],
258
+ 'length_hint': [lambda obj: None, lambda obj, default: None],
259
+ 'lshift': [lambda a, b: None],
260
+ 'lt': [lambda a, b: None],
261
+ 'matmul': [lambda a, b: None],
262
+ 'methodcaller': [lambda name, *args, **kwargs: None],
263
+ 'mod': [lambda a, b: None],
264
+ 'mul': [lambda a, b: None],
265
+ 'ne': [lambda a, b: None],
266
+ 'neg': [lambda a: None],
267
+ 'not_': [lambda a: None],
268
+ 'or_': [lambda a, b: None],
269
+ 'pos': [lambda a: None],
270
+ 'pow': [lambda a, b: None],
271
+ 'repeat': [lambda a, b: None],
272
+ 'rshift': [lambda a, b: None],
273
+ 'sequenceIncludes': [lambda a, b: None],
274
+ 'setitem': [lambda a, b, c: None],
275
+ 'setslice': [lambda a, b, c, d: None],
276
+ 'sub': [lambda a, b: None],
277
+ 'truediv': [lambda a, b: None],
278
+ 'truth': [lambda a: None],
279
+ 'xor': [lambda a, b: None],
280
+ }
281
+ module_info['humpy_toolz'] = {
282
+ 'curry': [(0, lambda *args, **kwargs: None)],
283
+ 'excepts': [(0, lambda exc, func, handler=None: None)],
284
+ 'flip': [(0, lambda func=None, a=None, b=None: None)],
285
+ 'juxt': [(0, lambda *funcs: None)],
286
+ 'memoize': [(0, lambda func=None, cache=None, key=None: None)],
287
+ }
288
+ module_info['humpy_toolz.functoolz'] = {
289
+ 'Compose': [(0, lambda funcs: None)], 'InstanceProperty': [(0, lambda fget=None, fset=None, fdel=None, doc=None, classval=None: None)]
290
+ }
291
+
292
+ def num_pos_args(sigspec: inspect.Signature) -> builtins.int:
293
+ """Return the number of positional arguments. ``f(x, y=1)`` has 1"""
294
+ return sum(1 for x in sigspec.parameters.values() if x.kind == x.POSITIONAL_OR_KEYWORD and x.default is x.empty)
295
+
296
+ def get_exclude_keywords(num_pos_only: builtins.int, sigspec: inspect.Signature) -> tuple[str, ...]:
297
+ """Return the names of position-only arguments if func has **kwargs"""
298
+ if num_pos_only == 0:
299
+ return ()
300
+ has_kwargs: builtins.bool = any(x.kind == x.VAR_KEYWORD for x in sigspec.parameters.values())
301
+ if not has_kwargs:
302
+ return ()
303
+ pos_args: builtins.list[inspect.Parameter] = list(sigspec.parameters.values())[:num_pos_only]
304
+ return tuple(x.name for x in pos_args)
305
+
306
+ def signature_or_spec(func: Callable[..., Any]) -> inspect.Signature | None:
307
+ try:
308
+ return inspect.signature(func)
309
+ except (ValueError, TypeError):
310
+ return None
311
+
312
+ def expand_sig(sig: SignatureInput) -> SignatureSpecification:
313
+ """Convert the signature spec in ``module_info`` to add to ``signatures``
314
+
315
+ The input signature spec is one of:
316
+ - ``lambda_func``
317
+ - ``(num_position_args, lambda_func)``
318
+ - ``(num_position_args, lambda_func, keyword_only_args)``
319
+
320
+ The output signature spec is:
321
+ ``(num_position_args, lambda_func, keyword_exclude, sigspec)``
322
+
323
+ where ``keyword_exclude`` includes keyword only arguments and, if variadic
324
+ keywords is present, the names of position-only argument. The latter is
325
+ included to support builtins such as ``partial(func, *args, **kwargs)``,
326
+ which allows ``func=`` to be used as a keyword even though it's the name
327
+ of a positional argument.
328
+ """
329
+ if isinstance(sig, tuple):
330
+ if len(sig) == 3:
331
+ num_pos_only, func, keyword_only = sig
332
+ assert isinstance(sig[-1], tuple)
333
+ else:
334
+ num_pos_only, func = sig
335
+ keyword_only = ()
336
+ sigspec: inspect.Signature | None = signature_or_spec(func)
337
+ else:
338
+ func: Callable[..., Any] = sig
339
+ sigspec = signature_or_spec(func)
340
+ num_pos_only: builtins.int = num_pos_args(sigspec)
341
+ keyword_only = ()
342
+ keyword_exclude: tuple[str, ...] = get_exclude_keywords(num_pos_only, sigspec)
343
+ return (num_pos_only, func, keyword_only + keyword_exclude, sigspec)
344
+
345
+ signatures: dict[Callable[..., Any], tuple[SignatureSpecification, ...]] = {}
346
+
347
+ def create_signature_registry(module_info: dict[ModuleType, dict[str, list[SignatureInput]]] = module_info, signatures: dict[Callable[..., Any], tuple[SignatureSpecification, ...]] = signatures):
348
+ for module, info in module_info.items():
349
+ if isinstance(module, str):
350
+ module: ModuleType = import_module(module)
351
+ for name, sigs in info.items():
352
+ if hasattr(module, name):
353
+ new_sigs: builtins.tuple[SignatureSpecification, ...] = tuple(expand_sig(sig) for sig in sigs)
354
+ signatures[getattr(module, name)] = new_sigs
355
+
356
+ def check_valid(sig: SignatureSpecification, args, kwargs) -> builtins.bool:
357
+ """Like ``is_valid_args`` for the given signature spec"""
358
+ num_pos_only, func, keyword_exclude, _sigspec = sig
359
+ if len(args) < num_pos_only:
360
+ return False
361
+ if keyword_exclude:
362
+ kwargs = dict(kwargs)
363
+ for item in keyword_exclude:
364
+ kwargs.pop(item, None)
365
+ try:
366
+ func(*args, **kwargs)
367
+ return True
368
+ except TypeError:
369
+ return False
370
+
371
+ def _is_valid_args(func: Callable[..., Any], args, kwargs) -> None | builtins.bool:
372
+ """Like ``is_valid_args`` for builtins in our ``signatures`` registry"""
373
+ if func not in signatures:
374
+ return None
375
+ sigs: builtins.tuple[SignatureSpecification, ...] = signatures[func]
376
+ return any(check_valid(sig, args, kwargs) for sig in sigs)
377
+
378
+ def check_partial(sig: SignatureSpecification, args, kwargs) -> builtins.bool | None:
379
+ """Like ``is_partial_args`` for the given signature spec"""
380
+ num_pos_only, func, keyword_exclude, sigspec = sig
381
+ if len(args) < num_pos_only:
382
+ pad: builtins.tuple[None, ...] = (None,) * (num_pos_only - len(args))
383
+ args = args + pad
384
+ if keyword_exclude:
385
+ kwargs = dict(kwargs)
386
+ for item in keyword_exclude:
387
+ kwargs.pop(item, None)
388
+ return is_partial_args(func, args, kwargs, sigspec)
389
+
390
+ def _is_partial_args(func: Callable[..., Any], args, kwargs) -> None | builtins.bool:
391
+ """Like ``is_partial_args`` for builtins in our ``signatures`` registry"""
392
+ if func not in signatures:
393
+ return None
394
+ sigs: builtins.tuple[SignatureSpecification, ...] = signatures[func]
395
+ return any(check_partial(sig, args, kwargs) for sig in sigs)
396
+
397
+ def check_arity(n: builtins.int, sig: SignatureSpecification) -> builtins.bool | None:
398
+ num_pos_only, func, keyword_exclude, sigspec = sig
399
+ if keyword_exclude or num_pos_only > n:
400
+ return False
401
+ return is_arity(n, func, sigspec)
402
+
403
+ def _is_arity(n: builtins.int, func: Callable[..., Any]) -> None | builtins.bool:
404
+ if func not in signatures:
405
+ return None
406
+ sigs: builtins.tuple[SignatureSpecification, ...] = signatures[func]
407
+ checks: builtins.list[builtins.bool | None] = [check_arity(n, sig) for sig in sigs]
408
+ if all(checks):
409
+ return True
410
+ elif any(checks):
411
+ return None
412
+ return False
413
+
414
+ def check_varargs(sig: SignatureSpecification) -> builtins.bool | None:
415
+ _num_pos_only, func, _keyword_exclude, sigspec = sig
416
+ return has_varargs(func, sigspec)
417
+
418
+ def _has_varargs(func: Callable[..., Any]) -> None | builtins.bool:
419
+ if func not in signatures:
420
+ return None
421
+ sigs: builtins.tuple[SignatureSpecification, ...] = signatures[func]
422
+ checks: builtins.list[builtins.bool | None] = [check_varargs(sig) for sig in sigs]
423
+ if all(checks):
424
+ return True
425
+ elif any(checks):
426
+ return None
427
+ return False
428
+
429
+ def check_keywords(sig: SignatureSpecification) -> builtins.bool | None:
430
+ _num_pos_only, func, keyword_exclude, sigspec = sig
431
+ if keyword_exclude:
432
+ return True
433
+ return has_keywords(func, sigspec)
434
+
435
+ def _has_keywords(func: Callable[..., Any]) -> None | builtins.bool:
436
+ if func not in signatures:
437
+ return None
438
+ sigs: builtins.tuple[SignatureSpecification, ...] = signatures[func]
439
+ checks: builtins.list[builtins.bool | None] = [check_keywords(sig) for sig in sigs]
440
+ if all(checks):
441
+ return True
442
+ elif any(checks):
443
+ return None
444
+ return False
445
+
446
+ def check_required_args(sig: SignatureSpecification) -> builtins.int | None:
447
+ _num_pos_only, func, _keyword_exclude, sigspec = sig
448
+ return num_required_args(func, sigspec)
449
+
450
+ def _num_required_args(func: Callable[..., Any]) -> None | builtins.int:
451
+ if func not in signatures:
452
+ return None
453
+ sigs: builtins.tuple[SignatureSpecification, ...] = signatures[func]
454
+ vals: builtins.list[builtins.int | None] = [check_required_args(sig) for sig in sigs]
455
+ val: builtins.int | None = vals[0]
456
+ if all(x == val for x in vals):
457
+ return val
458
+ return None
@@ -110,20 +110,20 @@ def assoc[K: Hashable, V](d: Mapping[K, V], key: K, value: V, factory: Callable[
110
110
  @overload
111
111
  def assoc_in[K1, K2, V1, V2](d: Mapping[K1, Mapping[K2, V2] | V1], keys: tuple[K1, K2], value: V2) -> dict[K1, dict[K2, V2] | V1 | V2]: ...
112
112
  @overload
113
- def assoc_in[K1, K2, V1, V2](d: Mapping[K1, Mapping[K2, V2] | V1], keys: tuple[K1, K2], value: V2, *, factory: Callable[ [], MutableMapping[K1, Any] ]) -> MutableMapping[K1, Any]: ...
113
+ def assoc_in[K1, K2, V1, V2](d: Mapping[K1, Mapping[K2, V2] | V1], keys: tuple[K1, K2], value: V2, *, factory: Callable[[], MutableMapping[K1, Any]]) -> MutableMapping[K1, Any]: ...
114
114
 
115
115
  # Overloads for nested dictionaries with tuple keys (3-level nesting)
116
116
  @overload
117
- def assoc_in[K1, K2, K3, V1, V2, V3](d: Mapping[ K1, Mapping[K2, Mapping[K3, V3] | V2] | V1 ], keys: tuple[K1, K2, K3], value: V3) -> dict[K1, dict[K2, dict[K3, V3] | V2 | V3] | V1 | V3]: ...
117
+ def assoc_in[K1, K2, K3, V1, V2, V3](d: Mapping[K1, Mapping[K2, Mapping[K3, V3] | V2] | V1], keys: tuple[K1, K2, K3], value: V3) -> dict[K1, dict[K2, dict[K3, V3] | V2 | V3] | V1 | V3]: ...
118
118
  @overload
119
- def assoc_in[K1, K2, K3, V1, V2, V3](d: Mapping[ K1, Mapping[K2, Mapping[K3, V3] | V2] | V1 ], keys: tuple[K1, K2, K3], value: V3, *, factory: Callable[ [], MutableMapping[K1, Any] ]) -> MutableMapping[K1, Any]: ...
119
+ def assoc_in[K1, K2, K3, V1, V2, V3](d: Mapping[K1, Mapping[K2, Mapping[K3, V3] | V2] | V1], keys: tuple[K1, K2, K3], value: V3, *, factory: Callable[[], MutableMapping[K1, Any]]) -> MutableMapping[K1, Any]: ...
120
120
 
121
121
  # General overloads for backwards compatibility
122
122
  @overload
123
123
  def assoc_in[K, V](d: Mapping[K, V], keys: Sequence[K], value: V) -> dict[K, V]: ...
124
124
  @overload
125
125
  def assoc_in[K, V](d: Mapping[K, V], keys: Sequence[K], value: V, *, factory: Callable[[], MutableMapping[K, V]]) -> MutableMapping[K, V]: ...
126
- def assoc_in[K, V](d: Mapping[K, V], keys: Sequence[K], value: V, *, factory: Callable[[], MutableMapping[K, V]] = dict) -> MutableMapping[K, V]: # pyright: ignore[reportInconsistentOverload]
126
+ def assoc_in[K, V](d: Mapping[K, V], keys: Sequence[K], value: V, *, factory: Callable[[], MutableMapping[K, V]] = dict) -> MutableMapping[K, V]: # pyright: ignore[reportInconsistentOverload]
127
127
  """Create a new `MutableMapping` from `d` with `value` at the path specified by `keys`.
128
128
 
129
129
  (AI generated docstring)
@@ -863,4 +863,3 @@ def valmap[K: Hashable, V0, V1](func: Callable[[V0], V1], d: Mapping[K, V0], fac
863
863
  rv: MutableMapping[K, V1] = factory()
864
864
  rv.update(zip(d.keys(), map(func, d.values()), strict=True))
865
865
  return rv
866
-
@@ -368,3 +368,19 @@ class excepts[T, **P]:
368
368
  def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T: ...
369
369
  @property
370
370
  def __name__(self) -> str: ...
371
+
372
+
373
+ def num_required_args(func: Callable[..., Any], sigspec: inspect.Signature | None = None) -> int | None:
374
+ ...
375
+
376
+ def has_varargs(func: Callable[..., Any], sigspec: inspect.Signature | None = None) -> bool | None:
377
+ ...
378
+
379
+ def has_keywords(func: Callable[..., Any], sigspec: inspect.Signature | None = None) -> bool | None:
380
+ ...
381
+
382
+ def is_partial_args(func: Callable[..., Any], args, kwargs, sigspec: inspect.Signature | None = None) -> bool | None:
383
+ ...
384
+
385
+ def is_arity(n: int, func: Callable[..., Any], sigspec: inspect.Signature | None = None) -> bool | None:
386
+ ...
@@ -426,7 +426,14 @@ def _get[K, T](ind: K, seq: SupportsGetItem[K, T], default: T) -> T:
426
426
  return seq[ind]
427
427
  except (KeyError, IndexError):
428
428
  return default
429
-
429
+ # TODO
430
+ """
431
+ # NOTE this part is correct.
432
+ ww: Callable[[fs2Path], DecodedFilename] = compose(librarianDecodesFilename, fs_path.basename)
433
+ # NOTE `T` should be a TypeVar. The input to get is `DecodedFilename`, a typeddict[str, str].
434
+ # I guess the annotation is returning an item tuple instead of the value.
435
+ qq: Callable[[fs2Path], tuple[T, ...]] = compose(get('fractionType'), ww)
436
+ """
430
437
  @overload
431
438
  def get[K, T](ind: Sequence[K], seq: SupportsGetItem[K, T], default: T | Literal['__no__default__'] = no_default) -> tuple[T, ...]: ...
432
439
  @overload
@@ -72,7 +72,7 @@ from hunterMakesPy.semiotics import decreasing as decreasing, errorL33T as error
72
72
 
73
73
  # isort: split
74
74
  from hunterMakesPy.theTypes import (
75
- CallableFunction as CallableFunction, identifierDotAttribute as identifierDotAttribute, Ordinals as Ordinals)
75
+ CallableFunction as CallableFunction, identifierDotAttribute as identifierDotAttribute, Ordinals as Ordinals, 小于 as 小于)
76
76
 
77
77
  # isort: split
78
78
  from hunterMakesPy.coping import PackageSettings as PackageSettings, raiseIfNone as raiseIfNone
@@ -3,22 +3,23 @@ from __future__ import annotations
3
3
 
4
4
  from importlib.util import find_spec
5
5
  from pathlib import Path
6
- from tomllib import loads as tomllib_loads
6
+ from tomli import loads as tomli_loads
7
7
  from typing import TYPE_CHECKING
8
+ from typing_extensions import TypeVar
8
9
  import dataclasses
9
10
 
10
11
  if TYPE_CHECKING:
11
12
  from importlib.machinery import ModuleSpec
12
13
 
13
14
  def getIdentifierPackagePACKAGING(identifierPackageFALLBACK: str) -> str:
14
- """Get package name from pyproject.toml or fallback to provided value."""
15
+ """Get package name from pyproject.toml or fallback to provided value.""" # noqa: DOC201
15
16
  try:
16
- return tomllib_loads(Path('pyproject.toml').read_text(encoding='utf-8'))['project']['name']
17
+ return tomli_loads(Path('pyproject.toml').read_text(encoding='utf-8'))['project']['name']
17
18
  except Exception: # noqa: BLE001
18
19
  return identifierPackageFALLBACK
19
20
 
20
21
  def getPathPackageINSTALLING(identifierPackage: str) -> Path:
21
- """Return the root directory of the installed package."""
22
+ """Return the root directory of the installed package.""" # noqa: DOC201
22
23
  try:
23
24
  moduleSpecification: ModuleSpec | None = find_spec(identifierPackage)
24
25
  if moduleSpecification and moduleSpecification.origin:
@@ -85,7 +86,9 @@ class PackageSettings:
85
86
  if self.pathPackage == Path() and self.identifierPackage:
86
87
  self.pathPackage = getPathPackageINSTALLING(self.identifierPackage)
87
88
 
88
- def raiseIfNone[TypeSansNone](expression: TypeSansNone | None, errorMessage: str | None = None) -> TypeSansNone:
89
+ TypeSansNone = TypeVar('TypeSansNone')
90
+
91
+ def raiseIfNone(expression: TypeSansNone | None, errorMessage: str | None = None) -> TypeSansNone:
89
92
  """Convert the `expression` return annotation from '`cerPytainty | None`' to '`cerPytainty`' because `expression` cannot be `None`; `raise` an `Exception` if you're wrong.
90
93
 
91
94
  The Python interpreter evaluates `expression` to a value: think of a function call or an attribute access. You can use