mapFolding 0.12.2__py3-none-any.whl → 0.12.3__py3-none-any.whl
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.
- mapFolding/__init__.py +4 -2
- mapFolding/_theSSOT.py +32 -88
- mapFolding/{datatypes.py → _theTypes.py} +25 -3
- mapFolding/basecamp.py +39 -34
- mapFolding/beDRY.py +79 -54
- mapFolding/dataBaskets.py +117 -74
- mapFolding/filesystemToolkit.py +140 -91
- mapFolding/oeis.py +242 -144
- mapFolding/reference/flattened.py +1 -1
- mapFolding/someAssemblyRequired/RecipeJob.py +68 -53
- mapFolding/someAssemblyRequired/__init__.py +40 -15
- mapFolding/someAssemblyRequired/_toolIfThis.py +82 -54
- mapFolding/someAssemblyRequired/_toolkitContainers.py +19 -16
- mapFolding/someAssemblyRequired/getLLVMforNoReason.py +35 -26
- mapFolding/someAssemblyRequired/makeAllModules.py +348 -275
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +81 -57
- mapFolding/someAssemblyRequired/toolkitNumba.py +80 -50
- mapFolding/someAssemblyRequired/transformationTools.py +63 -40
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/METADATA +7 -11
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/RECORD +28 -28
- tests/test_computations.py +26 -8
- tests/test_oeis.py +8 -7
- tests/test_other.py +3 -3
- tests/test_tasks.py +2 -4
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/WHEEL +0 -0
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.12.2.dist-info → mapfolding-0.12.3.dist-info}/top_level.txt +0 -0
|
@@ -27,18 +27,17 @@ through specialized compilation paths essential for computationally intensive ma
|
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
from astToolkit import (
|
|
30
|
-
Be,
|
|
31
|
-
NodeChanger, parseLogicalPath2astModule, Then,
|
|
32
|
-
)
|
|
30
|
+
Be, extractClassDef, identifierDotAttribute, IngredientsFunction, Make, NodeChanger, parseLogicalPath2astModule, Then)
|
|
33
31
|
from astToolkit.transformationTools import unparseFindReplace
|
|
32
|
+
from hunterMakesPy import importLogicalPath2Identifier
|
|
34
33
|
from mapFolding.someAssemblyRequired import DeReConstructField2ast, IfThis, ShatteredDataclass
|
|
35
|
-
from Z0Z_tools import importLogicalPath2Callable
|
|
36
34
|
import ast
|
|
37
35
|
import dataclasses
|
|
38
36
|
|
|
39
37
|
def shatter_dataclassesDOTdataclass(logicalPathModule: identifierDotAttribute, dataclassIdentifier: str, instanceIdentifier: str) -> ShatteredDataclass:
|
|
40
|
-
"""
|
|
41
|
-
|
|
38
|
+
"""Decompose a dataclass definition into AST components for manipulation and code generation.
|
|
39
|
+
|
|
40
|
+
(AI generated docstring)
|
|
42
41
|
|
|
43
42
|
This function breaks down a complete dataclass (like ComputationState) into its constituent
|
|
44
43
|
parts as AST nodes, enabling fine-grained manipulation of its fields for code generation.
|
|
@@ -54,35 +53,44 @@ def shatter_dataclassesDOTdataclass(logicalPathModule: identifierDotAttribute, d
|
|
|
54
53
|
where dataclass instances can't be directly used but their fields need to be individually
|
|
55
54
|
manipulated and passed to computational functions.
|
|
56
55
|
|
|
57
|
-
Parameters
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
Parameters
|
|
57
|
+
----------
|
|
58
|
+
logicalPathModule : identifierDotAttribute
|
|
59
|
+
The fully qualified module path containing the dataclass definition.
|
|
60
|
+
dataclassIdentifier : str
|
|
61
|
+
The name of the dataclass to decompose.
|
|
62
|
+
instanceIdentifier : str
|
|
63
|
+
The variable name to use for the dataclass instance in generated code.
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
ShatteredDataclass
|
|
68
|
+
A ShatteredDataclass containing AST representations of all dataclass components,
|
|
69
|
+
with imports, field definitions, annotations, and repackaging code.
|
|
70
|
+
|
|
71
|
+
Raises
|
|
72
|
+
------
|
|
73
|
+
ValueError
|
|
74
|
+
If the dataclass cannot be found in the specified module or if no counting variable is identified in the dataclass.
|
|
65
75
|
|
|
66
|
-
Raises:
|
|
67
|
-
ValueError: If the dataclass cannot be found in the specified module or if no counting variable is identified in the dataclass.
|
|
68
76
|
"""
|
|
69
77
|
Official_fieldOrder: list[str] = []
|
|
70
78
|
dictionaryDeReConstruction: dict[str, DeReConstructField2ast] = {}
|
|
71
79
|
|
|
72
80
|
dataclassClassDef: ast.ClassDef | None = extractClassDef(parseLogicalPath2astModule(logicalPathModule), dataclassIdentifier)
|
|
73
|
-
if not
|
|
74
|
-
|
|
81
|
+
if not dataclassClassDef:
|
|
82
|
+
message = f"I could not find `{dataclassIdentifier = }` in `{logicalPathModule = }`."
|
|
83
|
+
raise ValueError(message)
|
|
75
84
|
|
|
76
85
|
countingVariable = None
|
|
77
|
-
for aField in dataclasses.fields(
|
|
86
|
+
for aField in dataclasses.fields(importLogicalPath2Identifier(logicalPathModule, dataclassIdentifier)): # pyright: ignore [reportArgumentType]
|
|
78
87
|
Official_fieldOrder.append(aField.name)
|
|
79
88
|
dictionaryDeReConstruction[aField.name] = DeReConstructField2ast(logicalPathModule, dataclassClassDef, instanceIdentifier, aField)
|
|
80
89
|
if aField.metadata.get('theCountingIdentifier', False):
|
|
81
90
|
countingVariable = dictionaryDeReConstruction[aField.name].name
|
|
82
91
|
if countingVariable is None:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
raise ValueError(f"I could not find the counting variable in `{dataclassIdentifier = }` in `{logicalPathModule = }`.")
|
|
92
|
+
message = f"I could not find the counting variable in `{dataclassIdentifier = }` in `{logicalPathModule = }`."
|
|
93
|
+
raise ValueError(message)
|
|
86
94
|
|
|
87
95
|
shatteredDataclass = ShatteredDataclass(
|
|
88
96
|
countingVariableAnnotation=dictionaryDeReConstruction[countingVariable].astAnnotation,
|
|
@@ -106,8 +114,9 @@ def shatter_dataclassesDOTdataclass(logicalPathModule: identifierDotAttribute, d
|
|
|
106
114
|
return shatteredDataclass
|
|
107
115
|
|
|
108
116
|
def removeDataclassFromFunction(ingredientsTarget: IngredientsFunction, shatteredDataclass: ShatteredDataclass) -> IngredientsFunction:
|
|
109
|
-
"""
|
|
110
|
-
|
|
117
|
+
"""Transform a function that operates on dataclass instances to work with individual field parameters.
|
|
118
|
+
|
|
119
|
+
(AI generated docstring)
|
|
111
120
|
|
|
112
121
|
This function performs the core transformation required for Numba compatibility by removing dataclass
|
|
113
122
|
dependencies from function signatures and implementations. It modifies the target function to:
|
|
@@ -121,12 +130,18 @@ def removeDataclassFromFunction(ingredientsTarget: IngredientsFunction, shattere
|
|
|
121
130
|
implementations, as Numba cannot handle dataclass instances directly but can efficiently
|
|
122
131
|
process individual primitive values and tuples.
|
|
123
132
|
|
|
124
|
-
Parameters
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
Parameters
|
|
134
|
+
----------
|
|
135
|
+
ingredientsTarget : IngredientsFunction
|
|
136
|
+
The function definition and its dependencies to be transformed.
|
|
137
|
+
shatteredDataclass : ShatteredDataclass
|
|
138
|
+
The decomposed dataclass components providing AST mappings and transformations.
|
|
139
|
+
|
|
140
|
+
Returns
|
|
141
|
+
-------
|
|
142
|
+
IngredientsFunction
|
|
143
|
+
The modified function ingredients with dataclass dependencies removed.
|
|
127
144
|
|
|
128
|
-
Returns:
|
|
129
|
-
ingredientsTarget: The modified function ingredients with dataclass dependencies removed.
|
|
130
145
|
"""
|
|
131
146
|
ingredientsTarget.astFunctionDef.args = Make.arguments(list_arg=shatteredDataclass.list_argAnnotated4ArgumentsSpecification)
|
|
132
147
|
ingredientsTarget.astFunctionDef.returns = shatteredDataclass.signatureReturnAnnotation
|
|
@@ -136,8 +151,9 @@ def removeDataclassFromFunction(ingredientsTarget: IngredientsFunction, shattere
|
|
|
136
151
|
return ingredientsTarget
|
|
137
152
|
|
|
138
153
|
def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFunction, targetCallableIdentifier: str, shatteredDataclass: ShatteredDataclass) -> IngredientsFunction:
|
|
139
|
-
"""
|
|
140
|
-
|
|
154
|
+
"""Transform a caller function to interface with a dataclass-free target function.
|
|
155
|
+
|
|
156
|
+
(AI generated docstring)
|
|
141
157
|
|
|
142
158
|
This function complements `removeDataclassFromFunction` by modifying calling code to work with
|
|
143
159
|
the transformed target function. It implements the unpacking and repacking pattern required
|
|
@@ -153,18 +169,25 @@ def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFun
|
|
|
153
169
|
field-based implementations, maintaining the original interface while enabling performance
|
|
154
170
|
optimizations in the target function.
|
|
155
171
|
|
|
156
|
-
Parameters
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
172
|
+
Parameters
|
|
173
|
+
----------
|
|
174
|
+
ingredientsCaller : IngredientsFunction
|
|
175
|
+
The calling function definition and its dependencies to be transformed.
|
|
176
|
+
targetCallableIdentifier : str
|
|
177
|
+
The name of the target function being called.
|
|
178
|
+
shatteredDataclass : ShatteredDataclass
|
|
179
|
+
The decomposed dataclass components providing unpacking and repacking logic.
|
|
180
|
+
|
|
181
|
+
Returns
|
|
182
|
+
-------
|
|
183
|
+
IngredientsFunction
|
|
184
|
+
The modified caller function with appropriate unpacking and repacking around the target call.
|
|
160
185
|
|
|
161
|
-
Returns:
|
|
162
|
-
ingredientsCaller: The modified caller function with appropriate unpacking and repacking around the target call.
|
|
163
186
|
"""
|
|
164
187
|
astCallTargetCallable = Make.Call(Make.Name(targetCallableIdentifier), shatteredDataclass.listName4Parameters)
|
|
165
|
-
replaceAssignTargetCallable = NodeChanger(
|
|
166
|
-
unpack4targetCallable = NodeChanger(
|
|
167
|
-
repack4targetCallable = NodeChanger(
|
|
188
|
+
replaceAssignTargetCallable = NodeChanger(Be.Assign.valueIs(IfThis.isCallIdentifier(targetCallableIdentifier)), Then.replaceWith(Make.Assign([shatteredDataclass.fragments4AssignmentOrParameters], value=astCallTargetCallable)))
|
|
189
|
+
unpack4targetCallable = NodeChanger(Be.Assign.valueIs(IfThis.isCallIdentifier(targetCallableIdentifier)), Then.insertThisAbove(shatteredDataclass.listUnpack))
|
|
190
|
+
repack4targetCallable = NodeChanger(Be.Assign.valueIs(IfThis.isCallIdentifier(targetCallableIdentifier)), Then.insertThisBelow([shatteredDataclass.repack]))
|
|
168
191
|
replaceAssignTargetCallable.visit(ingredientsCaller.astFunctionDef)
|
|
169
192
|
unpack4targetCallable.visit(ingredientsCaller.astFunctionDef)
|
|
170
193
|
repack4targetCallable.visit(ingredientsCaller.astFunctionDef)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.12.
|
|
4
|
-
Summary: Map folding algorithm with code transformation framework for optimizing numerical computations
|
|
3
|
+
Version: 0.12.3
|
|
4
|
+
Summary: Map folding algorithm with code transformation framework for optimizing numerical computations.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License: CC-BY-NC-4.0
|
|
7
7
|
Project-URL: Donate, https://www.patreon.com/integrated
|
|
@@ -29,25 +29,21 @@ Classifier: Typing :: Typed
|
|
|
29
29
|
Requires-Python: >=3.12
|
|
30
30
|
Description-Content-Type: text/markdown
|
|
31
31
|
License-File: LICENSE
|
|
32
|
-
Requires-Dist: Z0Z_tools
|
|
33
32
|
Requires-Dist: astToolkit>=0.5.0
|
|
34
|
-
Requires-Dist:
|
|
33
|
+
Requires-Dist: hunterMakesPy
|
|
35
34
|
Requires-Dist: numba
|
|
36
35
|
Requires-Dist: numba_progress
|
|
37
36
|
Requires-Dist: numpy
|
|
38
37
|
Requires-Dist: platformdirs
|
|
39
|
-
|
|
40
|
-
Requires-Dist:
|
|
41
|
-
Requires-Dist:
|
|
38
|
+
Provides-Extra: development
|
|
39
|
+
Requires-Dist: mypy; extra == "development"
|
|
40
|
+
Requires-Dist: pyupgrade; extra == "development"
|
|
41
|
+
Requires-Dist: setuptools-scm; extra == "development"
|
|
42
42
|
Provides-Extra: testing
|
|
43
|
-
Requires-Dist: mypy; extra == "testing"
|
|
44
43
|
Requires-Dist: pytest; extra == "testing"
|
|
45
44
|
Requires-Dist: pytest-cov; extra == "testing"
|
|
46
45
|
Requires-Dist: pytest-env; extra == "testing"
|
|
47
46
|
Requires-Dist: pytest-xdist; extra == "testing"
|
|
48
|
-
Requires-Dist: pyupgrade; extra == "testing"
|
|
49
|
-
Requires-Dist: ruff; extra == "testing"
|
|
50
|
-
Requires-Dist: setuptools-scm; extra == "testing"
|
|
51
47
|
Dynamic: license-file
|
|
52
48
|
|
|
53
49
|
# mapFolding
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
mapFolding/__init__.py,sha256=
|
|
2
|
-
mapFolding/_theSSOT.py,sha256=
|
|
3
|
-
mapFolding/
|
|
4
|
-
mapFolding/
|
|
1
|
+
mapFolding/__init__.py,sha256=dl3HR2zoipFo0UstEJn3iWTkXlA_XeCQw_zfw2fk4qE,3643
|
|
2
|
+
mapFolding/_theSSOT.py,sha256=dloMAsIOhUnIE7-SFJbQYyl6IYo7CdCAyBZPqMuckko,3380
|
|
3
|
+
mapFolding/_theTypes.py,sha256=rT8UTm-I_haMQlUGaJ4yvqIMt6FUOvWH-VUYNud6UN4,5495
|
|
4
|
+
mapFolding/basecamp.py,sha256=VuX0hLrXkY-XEcV9trd4aSdzxTfUNMR6kTnYo8-6tJw,9474
|
|
5
|
+
mapFolding/beDRY.py,sha256=Iikg3U4zQjx6JOKL62R7Tb0CpOm3JkPSIewAByco9GA,14777
|
|
5
6
|
mapFolding/daoOfMapFolding.py,sha256=ncTIiBfTsM8SNVx9qefZ0bBcBtviWLSk4iPv3Z9nGiE,5442
|
|
6
|
-
mapFolding/dataBaskets.py,sha256=
|
|
7
|
-
mapFolding/
|
|
8
|
-
mapFolding/
|
|
9
|
-
mapFolding/oeis.py,sha256=hf3AgQOiFf2Gs0WbS3JYIVNgfPfVlp0T0ZLDvfvi4Lg,21978
|
|
7
|
+
mapFolding/dataBaskets.py,sha256=ch-8jVvZ57nJ52pB8N_u3Egz-56IfA2t8Ct0ba7SXOY,14252
|
|
8
|
+
mapFolding/filesystemToolkit.py,sha256=Ex5tyugRQurXIgUNVtkQYfWMq8fM4e-izX01MBXU5_8,11006
|
|
9
|
+
mapFolding/oeis.py,sha256=zw_Aua57-VAXbtS0soG_xfBR1PozmsYLQCoy_Vq5WAU,23026
|
|
10
10
|
mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
mapFolding/reference/__init__.py,sha256=GKcSgYE49NcTISx-JZbELXyq-eRkMeTL5g4DXInWFw0,2206
|
|
12
|
-
mapFolding/reference/flattened.py,sha256=
|
|
12
|
+
mapFolding/reference/flattened.py,sha256=0eHgLFIeIeVUsI5zF5oSy5iWYrjOMzxr7KjDxiTe01k,16078
|
|
13
13
|
mapFolding/reference/hunterNumba.py,sha256=iLfyqwGdAh6c5GbapnKsWhAsNsR3O-fyGGHAdohluLw,7258
|
|
14
14
|
mapFolding/reference/irvineJavaPort.py,sha256=UEfIX4QbPLl5jnyfYIyX5YRR3_rYvPUikK8jLehsFko,4076
|
|
15
15
|
mapFolding/reference/jaxCount.py,sha256=TuDNKOnyhQfuixKmIxO9Algv7dvy7KMGhgsV3h96FGE,14853
|
|
@@ -20,16 +20,16 @@ mapFolding/reference/total_countPlus1vsPlusN.py,sha256=yJZAVLVdoXqHag2_N6_6CT-Q6
|
|
|
20
20
|
mapFolding/reference/jobsCompleted/__init__.py,sha256=TU93ZGUW1xEkT6d9mQFn_rp5DvRy0ZslEB2Q6MF5ZDc,2596
|
|
21
21
|
mapFolding/reference/jobsCompleted/[2x19]/p2x19.py,sha256=_tvYtfzMWVo2VtUbIAieoscb4N8FFflgTdW4-ljBUuA,19626
|
|
22
22
|
mapFolding/reference/jobsCompleted/p2x19/p2x19.py,sha256=eZEw4Me4ocTt6VXoK2-Sbd5SowZtxRIbN9dZmc7OCVg,6395
|
|
23
|
-
mapFolding/someAssemblyRequired/RecipeJob.py,sha256=
|
|
24
|
-
mapFolding/someAssemblyRequired/__init__.py,sha256=
|
|
25
|
-
mapFolding/someAssemblyRequired/_toolIfThis.py,sha256=
|
|
26
|
-
mapFolding/someAssemblyRequired/_toolkitContainers.py,sha256=
|
|
27
|
-
mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=
|
|
23
|
+
mapFolding/someAssemblyRequired/RecipeJob.py,sha256=Gi8H1z68rtl2PQShMb6D1JFug9S_edFxipWUuc0K1EQ,10949
|
|
24
|
+
mapFolding/someAssemblyRequired/__init__.py,sha256=UNDh6O86jT5ywlw9LgeWsUHwOfNvoMJRDAzYXbwCbeM,5779
|
|
25
|
+
mapFolding/someAssemblyRequired/_toolIfThis.py,sha256=VDZC10Xo3E1Y5n6FmaBBbOBR-rinV9DFkpgw8zrDyzg,6339
|
|
26
|
+
mapFolding/someAssemblyRequired/_toolkitContainers.py,sha256=ymqEWH5oO_gNjvRjpRELCzahXfU74fhHZspnv6GGLiE,13680
|
|
27
|
+
mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=tY0-2K0BFkwLAAjSrFJLPoG8CevDHOFc3OH3TxXANzg,2806
|
|
28
28
|
mapFolding/someAssemblyRequired/infoBooth.py,sha256=GWiqnHbqk7te_pvVuk4G_gbFa_W2aeSx19w4pakvqfM,2300
|
|
29
|
-
mapFolding/someAssemblyRequired/makeAllModules.py,sha256=
|
|
30
|
-
mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py,sha256=
|
|
31
|
-
mapFolding/someAssemblyRequired/toolkitNumba.py,sha256=
|
|
32
|
-
mapFolding/someAssemblyRequired/transformationTools.py,sha256=
|
|
29
|
+
mapFolding/someAssemblyRequired/makeAllModules.py,sha256=E5d1YoP8wOGBCknyjR9uDx2xxHEp18UAjDPxIf6PeKg,44351
|
|
30
|
+
mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py,sha256=T3xopmCckvDJqdbEXL7IzQLYmfulp0EO5-kdpyjxWZs,19027
|
|
31
|
+
mapFolding/someAssemblyRequired/toolkitNumba.py,sha256=UNLFadfRl6sHCHVEGbCu4sCPpnLKVqMd1U5ULWcEyis,14855
|
|
32
|
+
mapFolding/someAssemblyRequired/transformationTools.py,sha256=nPGZsvb5GquaCCxdDh_XzNIZYSiVJpWKd7wfhfRvxnk,11512
|
|
33
33
|
mapFolding/syntheticModules/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
|
|
34
34
|
mapFolding/syntheticModules/countParallel.py,sha256=OK_IB9w4yy9MMAiGvkei5ezPm_00v2nYjPrQZ_IlELg,7733
|
|
35
35
|
mapFolding/syntheticModules/daoOfMapFolding.py,sha256=cfWPABtXyCxJ0BwPI7rhfLh_2UYV_XKAL8lJ4GLNXaQ,5896
|
|
@@ -38,16 +38,16 @@ mapFolding/syntheticModules/initializeCount.py,sha256=nWSlJMMfIM3DvZxMn6ISQusUJq
|
|
|
38
38
|
mapFolding/syntheticModules/theorem2.py,sha256=9jrbZNNX4BWYZW1S0JjvRY2k7RU7I1RNUMV7JdCt1ZY,3017
|
|
39
39
|
mapFolding/syntheticModules/theorem2Numba.py,sha256=-cKjNyxgUMFhEyFVs0VJ7hw4LfrV0WSNK5tPYbQ1oNU,3369
|
|
40
40
|
mapFolding/syntheticModules/theorem2Trimmed.py,sha256=DHW3NxBdtABQYBKm2WRvfQ5kzc2_UwGI2h4ePuYEJoM,2685
|
|
41
|
-
mapfolding-0.12.
|
|
41
|
+
mapfolding-0.12.3.dist-info/licenses/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
42
42
|
tests/__init__.py,sha256=5RdiZYAl8nPIM1sxB_D0CsN6J8173LOZ0hpR3geTHAU,1312
|
|
43
43
|
tests/conftest.py,sha256=eBo0IIm98402hl_XW5nT06cUvW25ciItv1_zZdM152E,11126
|
|
44
|
-
tests/test_computations.py,sha256=
|
|
44
|
+
tests/test_computations.py,sha256=9We4l3JcyQy-LGHdCIL2fP_v6mXfdnPcD7YIp5C9Um8,5845
|
|
45
45
|
tests/test_filesystem.py,sha256=IXTeyfifXe6vLizCo8BiSn5Yx9DEKYEc_hoJRKhQFNk,3899
|
|
46
|
-
tests/test_oeis.py,sha256=
|
|
47
|
-
tests/test_other.py,sha256=
|
|
48
|
-
tests/test_tasks.py,sha256
|
|
49
|
-
mapfolding-0.12.
|
|
50
|
-
mapfolding-0.12.
|
|
51
|
-
mapfolding-0.12.
|
|
52
|
-
mapfolding-0.12.
|
|
53
|
-
mapfolding-0.12.
|
|
46
|
+
tests/test_oeis.py,sha256=CA0f8vHDwm_pLX4SMQN3_hTfy6elU2Hgm0d-jrxFoqE,6299
|
|
47
|
+
tests/test_other.py,sha256=ELIMRO8NbuQzzleVRN4zhC1bWYK3KTzFQhS_GOKrnnk,4945
|
|
48
|
+
tests/test_tasks.py,sha256=g80zHTjpv8zb5ptIIbJro9aY4McMn0gYMXj00MqY7vw,4042
|
|
49
|
+
mapfolding-0.12.3.dist-info/METADATA,sha256=nZn2rzN0f5NDTIg_tS6Sb5cWS5wLfpuW5gjWIxLuANg,7884
|
|
50
|
+
mapfolding-0.12.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
51
|
+
mapfolding-0.12.3.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
|
|
52
|
+
mapfolding-0.12.3.dist-info/top_level.txt,sha256=1gP2vFaqPwHujGwb3UjtMlLEGN-943VSYFR7V4gDqW8,17
|
|
53
|
+
mapfolding-0.12.3.dist-info/RECORD,,
|
tests/test_computations.py
CHANGED
|
@@ -38,10 +38,8 @@ import pytest
|
|
|
38
38
|
if __name__ == '__main__':
|
|
39
39
|
multiprocessing.set_start_method('spawn')
|
|
40
40
|
|
|
41
|
-
# TODO test synthesis
|
|
42
|
-
|
|
43
41
|
@pytest.mark.parametrize('flow', ['daoOfMapFolding', 'theorem2', 'theorem2Trimmed', 'theorem2numba'])
|
|
44
|
-
def test_flowControl(mapShapeTestCountFolds: tuple[int, ...], flow: Literal['daoOfMapFolding'
|
|
42
|
+
def test_flowControl(mapShapeTestCountFolds: tuple[int, ...], flow: Literal['daoOfMapFolding', 'theorem2', 'theorem2numba']) -> None:
|
|
45
43
|
"""Validate that different computational flows produce identical results.
|
|
46
44
|
|
|
47
45
|
This is the primary test for ensuring mathematical consistency across different
|
|
@@ -54,6 +52,24 @@ def test_flowControl(mapShapeTestCountFolds: tuple[int, ...], flow: Literal['dao
|
|
|
54
52
|
standardizedEqualToCallableReturn(getFoldsTotalKnown(mapShapeTestCountFolds), countFolds, None, None, None, None, mapShapeTestCountFolds, None, None, flow)
|
|
55
53
|
|
|
56
54
|
def test_aOFn_calculate_value(oeisID: str) -> None:
|
|
55
|
+
"""Verify OEIS sequence value calculations against known reference values.
|
|
56
|
+
|
|
57
|
+
(AI generated docstring)
|
|
58
|
+
|
|
59
|
+
Tests the `oeisIDfor_n` function by comparing its calculated output against
|
|
60
|
+
known correct values from the OEIS database. This ensures that sequence
|
|
61
|
+
value computations remain mathematically accurate across code changes.
|
|
62
|
+
|
|
63
|
+
The test iterates through validation test cases defined in `settingsOEIS`
|
|
64
|
+
for the given OEIS sequence identifier, verifying that each computed value
|
|
65
|
+
matches its corresponding known reference value.
|
|
66
|
+
|
|
67
|
+
Parameters
|
|
68
|
+
----------
|
|
69
|
+
oeisID : str
|
|
70
|
+
The OEIS sequence identifier to test calculations for.
|
|
71
|
+
|
|
72
|
+
"""
|
|
57
73
|
for n in settingsOEIS[oeisID]['valuesTestValidation']:
|
|
58
74
|
standardizedEqualToCallableReturn(settingsOEIS[oeisID]['valuesKnown'][n], oeisIDfor_n, oeisID, n)
|
|
59
75
|
|
|
@@ -69,8 +85,8 @@ def test_writeJobNumba(oneTestCuzTestsOverwritingTests: tuple[int, ...], pathFil
|
|
|
69
85
|
that the generated code produces mathematically correct results. This pattern
|
|
70
86
|
can be adapted for testing other dynamically generated computational approaches.
|
|
71
87
|
"""
|
|
72
|
-
from mapFolding.someAssemblyRequired.makeJobTheorem2Numba import makeJobNumba
|
|
73
|
-
from mapFolding.someAssemblyRequired.toolkitNumba import SpicesJobNumba
|
|
88
|
+
from mapFolding.someAssemblyRequired.makeJobTheorem2Numba import makeJobNumba # noqa: PLC0415
|
|
89
|
+
from mapFolding.someAssemblyRequired.toolkitNumba import SpicesJobNumba # noqa: PLC0415
|
|
74
90
|
mapShape = oneTestCuzTestsOverwritingTests
|
|
75
91
|
state = MapFoldingState(mapShape)
|
|
76
92
|
state = initializeGroupsOfFolds(state)
|
|
@@ -88,12 +104,14 @@ def test_writeJobNumba(oneTestCuzTestsOverwritingTests: tuple[int, ...], pathFil
|
|
|
88
104
|
|
|
89
105
|
Don_Lapre_Road_to_Self_Improvement = importlib.util.spec_from_file_location("__main__", pathFilenameModule)
|
|
90
106
|
if Don_Lapre_Road_to_Self_Improvement is None:
|
|
91
|
-
|
|
107
|
+
msg = f"Failed to create module specification from {pathFilenameModule}"
|
|
108
|
+
raise ImportError(msg)
|
|
92
109
|
if Don_Lapre_Road_to_Self_Improvement.loader is None:
|
|
93
|
-
|
|
110
|
+
msg = f"Failed to get loader for module {pathFilenameModule}"
|
|
111
|
+
raise ImportError(msg)
|
|
94
112
|
module = importlib.util.module_from_spec(Don_Lapre_Road_to_Self_Improvement)
|
|
95
113
|
|
|
96
114
|
module.__name__ = "__main__"
|
|
97
115
|
Don_Lapre_Road_to_Self_Improvement.loader.exec_module(module)
|
|
98
116
|
|
|
99
|
-
standardizedEqualToCallableReturn(str(getFoldsTotalKnown(oneTestCuzTestsOverwritingTests)), pathFilenameFoldsTotal.read_text().strip)
|
|
117
|
+
standardizedEqualToCallableReturn(str(getFoldsTotalKnown(oneTestCuzTestsOverwritingTests)), pathFilenameFoldsTotal.read_text(encoding="utf-8").strip)
|
tests/test_oeis.py
CHANGED
|
@@ -87,13 +87,14 @@ def test_clearOEIScache(mock_unlink: unittest.mock.MagicMock, mock_exists: unitt
|
|
|
87
87
|
mock_exists.assert_called_once()
|
|
88
88
|
mock_unlink.assert_not_called()
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
# Monkey tests
|
|
91
|
+
# def testNetworkError(monkeypatch: pytest.MonkeyPatch, pathCacheTesting: Path) -> None:
|
|
92
|
+
# """Test network error handling."""
|
|
93
|
+
# def mockUrlopen(*args: Any, **kwargs: Any) -> NoReturn:
|
|
94
|
+
# raise URLError("Network error")
|
|
95
|
+
|
|
96
|
+
# monkeypatch.setattr(urllib.request, 'urlopen', mockUrlopen)
|
|
97
|
+
# standardizedEqualToCallableReturn(URLError, getOEISidValues, next(iter(settingsOEIS)))
|
|
97
98
|
|
|
98
99
|
# ===== Command Line Interface Tests =====
|
|
99
100
|
def testHelpText() -> None:
|
tests/test_other.py
CHANGED
|
@@ -21,16 +21,16 @@ patterns and show how to handle edge cases gracefully. The parametrized tests
|
|
|
21
21
|
provide examples of comprehensive boundary testing that you can adapt for your
|
|
22
22
|
own functions.
|
|
23
23
|
|
|
24
|
-
The integration with external utility modules (
|
|
24
|
+
The integration with external utility modules (hunterMakesPy) shows how to test
|
|
25
25
|
dependencies while maintaining clear separation of concerns.
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
from collections.abc import Callable
|
|
29
|
+
from hunterMakesPy import intInnit
|
|
30
|
+
from hunterMakesPy.pytestForYourUse import PytestFor_intInnit, PytestFor_oopsieKwargsie
|
|
29
31
|
from mapFolding import getLeavesTotal, setProcessorLimit, validateListDimensions
|
|
30
32
|
from tests.conftest import standardizedEqualToCallableReturn
|
|
31
33
|
from typing import Any, Literal
|
|
32
|
-
from Z0Z_tools import intInnit
|
|
33
|
-
from Z0Z_tools.pytestForYourUse import PytestFor_intInnit, PytestFor_oopsieKwargsie
|
|
34
34
|
import multiprocessing
|
|
35
35
|
import numba
|
|
36
36
|
import pytest
|
tests/test_tasks.py
CHANGED
|
@@ -26,13 +26,11 @@ compatibility and proper resource isolation between test processes.
|
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
from collections.abc import Callable
|
|
29
|
+
from hunterMakesPy.pytestForYourUse import PytestFor_defineConcurrencyLimit
|
|
29
30
|
from mapFolding import (
|
|
30
|
-
countFolds, getFoldsTotalKnown, getLeavesTotal, getTaskDivisions, setProcessorLimit,
|
|
31
|
-
validateListDimensions,
|
|
32
|
-
)
|
|
31
|
+
countFolds, getFoldsTotalKnown, getLeavesTotal, getTaskDivisions, setProcessorLimit, validateListDimensions)
|
|
33
32
|
from tests.conftest import standardizedEqualToCallableReturn
|
|
34
33
|
from typing import Literal
|
|
35
|
-
from Z0Z_tools.pytestForYourUse import PytestFor_defineConcurrencyLimit
|
|
36
34
|
import multiprocessing
|
|
37
35
|
import pytest
|
|
38
36
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|