mapFolding 0.11.4__py3-none-any.whl → 0.12.0__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/oeis.py +9 -5
- mapFolding/someAssemblyRequired/RecipeJob.py +2 -2
- mapFolding/someAssemblyRequired/Z0Z_makeAllModules.py +138 -190
- mapFolding/someAssemblyRequired/__init__.py +7 -2
- mapFolding/someAssemblyRequired/_toolkitContainers.py +4 -4
- mapFolding/someAssemblyRequired/infoBooth.py +7 -10
- mapFolding/someAssemblyRequired/toolkitNumba.py +1 -1
- {mapfolding-0.11.4.dist-info → mapfolding-0.12.0.dist-info}/METADATA +2 -4
- {mapfolding-0.11.4.dist-info → mapfolding-0.12.0.dist-info}/RECORD +13 -13
- {mapfolding-0.11.4.dist-info → mapfolding-0.12.0.dist-info}/WHEEL +0 -0
- {mapfolding-0.11.4.dist-info → mapfolding-0.12.0.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.11.4.dist-info → mapfolding-0.12.0.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.11.4.dist-info → mapfolding-0.12.0.dist-info}/top_level.txt +0 -0
mapFolding/oeis.py
CHANGED
|
@@ -23,13 +23,13 @@ from functools import cache
|
|
|
23
23
|
from mapFolding import countFolds, packageSettings, TypedDict
|
|
24
24
|
from pathlib import Path
|
|
25
25
|
from typing import Any, Final
|
|
26
|
+
from urllib.parse import urlparse
|
|
26
27
|
from Z0Z_tools import writeStringToHere
|
|
27
28
|
import argparse
|
|
28
29
|
import random
|
|
29
30
|
import sys
|
|
30
31
|
import time
|
|
31
32
|
import urllib.request
|
|
32
|
-
import urllib.response
|
|
33
33
|
import warnings
|
|
34
34
|
|
|
35
35
|
cacheDays = 30
|
|
@@ -186,10 +186,14 @@ def getOEISofficial(pathFilenameCache: Path, url: str) -> None | str:
|
|
|
186
186
|
tryCache = False
|
|
187
187
|
|
|
188
188
|
if not tryCache:
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
parsedUrl = urlparse(url)
|
|
190
|
+
if parsedUrl.scheme not in ("http", "https"):
|
|
191
|
+
warnings.warn(f"I received the URL '{url}', but only 'http' and 'https' schemes are permitted.")
|
|
192
|
+
else:
|
|
193
|
+
httpResponse = urllib.request.urlopen(url)
|
|
194
|
+
oeisInformationRaw = httpResponse.read().decode('utf-8')
|
|
195
|
+
oeisInformation = str(oeisInformationRaw)
|
|
196
|
+
writeStringToHere(oeisInformation, pathFilenameCache)
|
|
193
197
|
|
|
194
198
|
if not oeisInformation:
|
|
195
199
|
warnings.warn(f"Failed to retrieve OEIS sequence information for {pathFilenameCache.stem}.")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from astToolkit import parseLogicalPath2astModule, str_nameDOTname
|
|
2
2
|
from mapFolding import getPathFilenameFoldsTotal, getPathRootJobDEFAULT, MapFoldingState, packageSettings
|
|
3
3
|
from mapFolding import DatatypeElephino as TheDatatypeElephino, DatatypeFoldsTotal as TheDatatypeFoldsTotal, DatatypeLeavesTotal as TheDatatypeLeavesTotal
|
|
4
|
-
from mapFolding.someAssemblyRequired import
|
|
4
|
+
from mapFolding.someAssemblyRequired import dataclassInstanceIdentifierDEFAULT, ShatteredDataclass
|
|
5
5
|
from mapFolding.someAssemblyRequired.transformationTools import shatter_dataclassesDOTdataclass
|
|
6
6
|
from pathlib import Path, PurePosixPath
|
|
7
7
|
from typing import TypeAlias
|
|
@@ -21,7 +21,7 @@ class RecipeJobTheorem2Numba:
|
|
|
21
21
|
|
|
22
22
|
sourceLogicalPathModuleDataclass: str_nameDOTname = 'mapFolding.dataBaskets'
|
|
23
23
|
sourceDataclassIdentifier: str = 'MapFoldingState'
|
|
24
|
-
sourceDataclassInstance: str =
|
|
24
|
+
sourceDataclassInstance: str = dataclassInstanceIdentifierDEFAULT
|
|
25
25
|
|
|
26
26
|
sourcePathPackage: PurePosixPath | None = PurePosixPath(packageSettings.pathPackage)
|
|
27
27
|
sourcePackageIdentifier: str | None = packageSettings.packageName
|
|
@@ -23,26 +23,57 @@ from mapFolding import packageSettings
|
|
|
23
23
|
from mapFolding.someAssemblyRequired import (
|
|
24
24
|
DeReConstructField2ast,
|
|
25
25
|
IfThis,
|
|
26
|
-
|
|
26
|
+
raiseIfNone,
|
|
27
27
|
ShatteredDataclass,
|
|
28
|
-
|
|
28
|
+
sourceCallableDispatcherDEFAULT,
|
|
29
29
|
)
|
|
30
|
-
from mapFolding.someAssemblyRequired.infoBooth import
|
|
30
|
+
from mapFolding.someAssemblyRequired.infoBooth import algorithmSourceModuleDEFAULT, dataPackingModuleIdentifierDEFAULT, logicalPathInfixDEFAULT, sourceCallableIdentifierDEFAULT, theCountingIdentifierDEFAULT
|
|
31
31
|
from mapFolding.someAssemblyRequired.toolkitNumba import decorateCallableWithNumba, parametersNumbaLight
|
|
32
32
|
from mapFolding.someAssemblyRequired.transformationTools import (
|
|
33
33
|
removeDataclassFromFunction,
|
|
34
34
|
shatter_dataclassesDOTdataclass,
|
|
35
35
|
unpackDataclassCallFunctionRepackDataclass,
|
|
36
36
|
)
|
|
37
|
+
from os import PathLike
|
|
37
38
|
from pathlib import PurePath
|
|
39
|
+
from typing import cast
|
|
38
40
|
from Z0Z_tools import importLogicalPath2Callable
|
|
39
41
|
import ast
|
|
40
42
|
import dataclasses
|
|
41
|
-
from os import PathLike
|
|
42
43
|
|
|
43
|
-
def
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
def findDataclass(ingredientsFunction: IngredientsFunction) -> tuple[str, str, str]:
|
|
45
|
+
dataclassName: ast.expr = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
46
|
+
dataclass_Identifier: str = raiseIfNone(NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName))
|
|
47
|
+
dataclassLogicalPathModule = None
|
|
48
|
+
for moduleWithLogicalPath, listNameTuples in ingredientsFunction.imports.dictionaryImportFrom.items():
|
|
49
|
+
for nameTuple in listNameTuples:
|
|
50
|
+
if nameTuple[0] == dataclass_Identifier:
|
|
51
|
+
dataclassLogicalPathModule = moduleWithLogicalPath
|
|
52
|
+
break
|
|
53
|
+
if dataclassLogicalPathModule:
|
|
54
|
+
break
|
|
55
|
+
dataclassInstanceIdentifier = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
56
|
+
return raiseIfNone(dataclassLogicalPathModule), dataclass_Identifier, dataclassInstanceIdentifier
|
|
57
|
+
|
|
58
|
+
def _getLogicalPath(packageName: str | None = None, logicalPathInfix: str | None = None, moduleIdentifier: str | None = None, *modules: str) -> str_nameDOTname:
|
|
59
|
+
listLogicalPathParts: list[str] = []
|
|
60
|
+
if packageName:
|
|
61
|
+
listLogicalPathParts.append(packageName)
|
|
62
|
+
if logicalPathInfix:
|
|
63
|
+
listLogicalPathParts.append(logicalPathInfix)
|
|
64
|
+
if moduleIdentifier:
|
|
65
|
+
listLogicalPathParts.append(moduleIdentifier)
|
|
66
|
+
if modules:
|
|
67
|
+
listLogicalPathParts.extend(modules)
|
|
68
|
+
logicalPath = '.'.join(listLogicalPathParts)
|
|
69
|
+
return logicalPath
|
|
70
|
+
|
|
71
|
+
def getModule(packageName: str | None = packageSettings.packageName, logicalPathInfix: str | None = logicalPathInfixDEFAULT, moduleIdentifier: str | None = algorithmSourceModuleDEFAULT) -> ast.Module:
|
|
72
|
+
logicalPathSourceModule = _getLogicalPath(packageName, logicalPathInfix, moduleIdentifier)
|
|
73
|
+
astModule = parseLogicalPath2astModule(logicalPathSourceModule)
|
|
74
|
+
return astModule
|
|
75
|
+
|
|
76
|
+
def _getPathFilename(pathRoot: PathLike[str] | PurePath | None = packageSettings.pathPackage, logicalPathInfix: PathLike[str] | PurePath | str | None = None, moduleIdentifier: str = '', fileExtension: str = packageSettings.fileExtension) -> PurePath:
|
|
46
77
|
pathFilename = PurePath(moduleIdentifier + fileExtension)
|
|
47
78
|
if logicalPathInfix:
|
|
48
79
|
pathFilename = PurePath(logicalPathInfix, pathFilename)
|
|
@@ -50,65 +81,39 @@ def _getPathFilename(pathRoot: PathLike[str] | PurePath | None = packageSettings
|
|
|
50
81
|
pathFilename = PurePath(pathRoot, pathFilename)
|
|
51
82
|
return pathFilename
|
|
52
83
|
|
|
53
|
-
def makeInitializeGroupsOfFolds(moduleIdentifier: str, callableIdentifier: str, logicalPathInfix: PathLike[str] | PurePath | str | None = None) ->
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
countInitializeIngredients = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
60
|
-
|
|
61
|
-
countInitializeIngredients.astFunctionDef.name = callableIdentifier
|
|
84
|
+
def makeInitializeGroupsOfFolds(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: PathLike[str] | PurePath | str | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
85
|
+
sourceCallableIdentifier = sourceCallableIdentifierDEFAULT
|
|
86
|
+
if callableIdentifier is None:
|
|
87
|
+
callableIdentifier = sourceCallableIdentifier
|
|
88
|
+
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
89
|
+
ingredientsFunction.astFunctionDef.name = callableIdentifier
|
|
62
90
|
|
|
63
|
-
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(
|
|
64
|
-
|
|
65
|
-
theCountingIdentifier = theCountingIdentifierHARDCODED
|
|
91
|
+
dataclassInstanceIdentifier = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
92
|
+
theCountingIdentifier = theCountingIdentifierDEFAULT
|
|
66
93
|
|
|
67
94
|
findThis = IfThis.isWhileAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
|
|
68
|
-
doThat = Grab.testAttribute(Grab.andDoAllOf([
|
|
69
|
-
NodeChanger(findThis, doThat).visit(
|
|
70
|
-
|
|
71
|
-
ingredientsModule = IngredientsModule(countInitializeIngredients)
|
|
72
|
-
|
|
73
|
-
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
|
|
95
|
+
doThat = Grab.testAttribute(Grab.andDoAllOf([Grab.opsAttribute(Then.replaceWith([ast.Eq()])), Grab.leftAttribute(Grab.attrAttribute(Then.replaceWith(theCountingIdentifier)))])) # pyright: ignore[reportArgumentType]
|
|
96
|
+
NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef.body[0])
|
|
74
97
|
|
|
98
|
+
ingredientsModule = IngredientsModule(ingredientsFunction)
|
|
99
|
+
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier)
|
|
75
100
|
write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
|
|
76
101
|
|
|
77
|
-
|
|
78
|
-
, logicalPathInfix: PathLike[str] | PurePath | str | None = None
|
|
79
|
-
, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
80
|
-
algorithmSourceModule = algorithmSourceModuleHARDCODED
|
|
81
|
-
sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
|
|
82
|
-
if callableIdentifier is None:
|
|
83
|
-
callableIdentifier = sourceCallableIdentifier
|
|
84
|
-
logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
|
|
102
|
+
return pathFilename
|
|
85
103
|
|
|
86
|
-
|
|
104
|
+
def makeDaoOfMapFolding(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: PathLike[str] | PurePath | str | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
105
|
+
sourceCallableIdentifier = sourceCallableIdentifierDEFAULT
|
|
87
106
|
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
88
107
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
108
|
+
if callableIdentifier is None:
|
|
109
|
+
callableIdentifier = sourceCallableIdentifier
|
|
110
|
+
ingredientsFunction.astFunctionDef.name = callableIdentifier
|
|
93
111
|
|
|
94
|
-
|
|
95
|
-
for moduleWithLogicalPath, listNameTuples in ingredientsFunction.imports.dictionaryImportFrom.items():
|
|
96
|
-
for nameTuple in listNameTuples:
|
|
97
|
-
if nameTuple[0] == dataclass_Identifier:
|
|
98
|
-
dataclassLogicalPathModule = moduleWithLogicalPath
|
|
99
|
-
break
|
|
100
|
-
if dataclassLogicalPathModule:
|
|
101
|
-
break
|
|
102
|
-
if dataclassLogicalPathModule is None: raise raiseIfNoneGitHubIssueNumber3
|
|
103
|
-
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
|
|
104
|
-
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
105
|
-
shatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclass_Identifier, dataclassInstanceIdentifier)
|
|
112
|
+
shatteredDataclass = shatter_dataclassesDOTdataclass(*findDataclass(ingredientsFunction))
|
|
106
113
|
|
|
107
114
|
ingredientsFunction.imports.update(shatteredDataclass.imports)
|
|
108
115
|
ingredientsFunction = removeDataclassFromFunction(ingredientsFunction, shatteredDataclass)
|
|
109
|
-
|
|
110
116
|
ingredientsFunction = removeUnusedParameters(ingredientsFunction)
|
|
111
|
-
|
|
112
117
|
ingredientsFunction = decorateCallableWithNumba(ingredientsFunction, parametersNumbaLight)
|
|
113
118
|
|
|
114
119
|
ingredientsModule = IngredientsModule(ingredientsFunction)
|
|
@@ -119,12 +124,11 @@ def makeDaoOfMapFolding(moduleIdentifier: str, callableIdentifier: str | None =
|
|
|
119
124
|
ingredientsFunctionDispatcher.imports.update(shatteredDataclass.imports)
|
|
120
125
|
targetCallableIdentifier = ingredientsFunction.astFunctionDef.name
|
|
121
126
|
ingredientsFunctionDispatcher = unpackDataclassCallFunctionRepackDataclass(ingredientsFunctionDispatcher, targetCallableIdentifier, shatteredDataclass)
|
|
122
|
-
astTuple
|
|
123
|
-
|
|
124
|
-
astTuple.ctx = ast.Store()
|
|
127
|
+
astTuple = raiseIfNone(NodeTourist(Be.Return, Then.extractIt(DOT.value)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
128
|
+
cast(ast.Tuple, astTuple).ctx = ast.Store()
|
|
125
129
|
|
|
126
130
|
findThis = ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCall_Identifier(targetCallableIdentifier))
|
|
127
|
-
doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts)))
|
|
131
|
+
doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), cast(ast.Tuple, astTuple).elts)))
|
|
128
132
|
changeAssignCallToTarget = NodeChanger(findThis, doThat)
|
|
129
133
|
changeAssignCallToTarget.visit(ingredientsFunctionDispatcher.astFunctionDef)
|
|
130
134
|
|
|
@@ -132,29 +136,21 @@ def makeDaoOfMapFolding(moduleIdentifier: str, callableIdentifier: str | None =
|
|
|
132
136
|
|
|
133
137
|
ingredientsModule.removeImportFromModule('numpy')
|
|
134
138
|
|
|
135
|
-
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier
|
|
139
|
+
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier)
|
|
136
140
|
|
|
137
141
|
write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
|
|
138
142
|
|
|
139
143
|
return pathFilename
|
|
140
144
|
|
|
141
|
-
def makeDaoOfMapFoldingParallel() -> PurePath:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
|
|
146
|
-
logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
|
|
147
|
-
|
|
148
|
-
logicalPathInfix = logicalPathInfixHARDCODED
|
|
149
|
-
moduleIdentifier = moduleIdentifierHARDCODED
|
|
150
|
-
|
|
151
|
-
astModule = parseLogicalPath2astModule(logicalPathSourceModule)
|
|
145
|
+
def makeDaoOfMapFoldingParallel(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: PathLike[str] | PurePath | str | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
146
|
+
sourceCallableIdentifier = sourceCallableIdentifierDEFAULT
|
|
147
|
+
if callableIdentifier is None:
|
|
148
|
+
callableIdentifier = sourceCallableIdentifier
|
|
152
149
|
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
150
|
+
ingredientsFunction.astFunctionDef.name = callableIdentifier
|
|
153
151
|
|
|
154
|
-
dataclassName: ast.expr
|
|
155
|
-
|
|
156
|
-
dataclass_Identifier: str | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
|
|
157
|
-
if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
152
|
+
dataclassName: ast.expr = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
153
|
+
dataclass_Identifier: str = raiseIfNone(NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName))
|
|
158
154
|
|
|
159
155
|
dataclassLogicalPathModule = None
|
|
160
156
|
for moduleWithLogicalPath, listNameTuples in ingredientsFunction.imports.dictionaryImportFrom.items():
|
|
@@ -164,9 +160,8 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
|
|
|
164
160
|
break
|
|
165
161
|
if dataclassLogicalPathModule:
|
|
166
162
|
break
|
|
167
|
-
if dataclassLogicalPathModule is None: raise
|
|
168
|
-
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
|
|
169
|
-
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
163
|
+
if dataclassLogicalPathModule is None: raise Exception
|
|
164
|
+
dataclassInstanceIdentifier = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
170
165
|
shatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclass_Identifier, dataclassInstanceIdentifier)
|
|
171
166
|
|
|
172
167
|
# Start add the parallel state fields to the count function ================================================
|
|
@@ -216,8 +211,7 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
|
|
|
216
211
|
findThis = ClassIsAndAttribute.testIs(ast.While, ClassIsAndAttribute.leftIs(ast.Compare, IfThis.isName_Identifier('leafConnectee')))
|
|
217
212
|
doThat = Then.extractIt(DOT.body)
|
|
218
213
|
captureCountGapsCodeBlock: NodeTourist[ast.While, Sequence[ast.stmt]] = NodeTourist(findThis, doThat)
|
|
219
|
-
countGapsCodeBlock = captureCountGapsCodeBlock.captureLastMatch(ingredientsFunction.astFunctionDef)
|
|
220
|
-
if countGapsCodeBlock is None: raise raiseIfNoneGitHubIssueNumber3
|
|
214
|
+
countGapsCodeBlock = raiseIfNone(captureCountGapsCodeBlock.captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
221
215
|
|
|
222
216
|
thisIsMyTaskIndexCodeBlock = ast.If(ast.BoolOp(ast.Or()
|
|
223
217
|
, values=[ast.Compare(ast.Name('leaf1ndex'), ops=[ast.NotEq()], comparators=[ast.Name('taskDivisions')])
|
|
@@ -236,23 +230,22 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
|
|
|
236
230
|
ingredientsFunction = decorateCallableWithNumba(ingredientsFunction, parametersNumbaLight)
|
|
237
231
|
|
|
238
232
|
# Start unpack/repack the dataclass function ================================================
|
|
239
|
-
sourceCallableIdentifier =
|
|
233
|
+
sourceCallableIdentifier = sourceCallableDispatcherDEFAULT
|
|
240
234
|
|
|
241
235
|
unRepackDataclass: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableIdentifier)
|
|
242
236
|
unRepackDataclass.astFunctionDef.name = 'unRepack' + dataclass_IdentifierParallel
|
|
243
237
|
unRepackDataclass.imports.update(shatteredDataclassParallel.imports)
|
|
244
|
-
findThis = ClassIsAndAttribute.annotationIs(ast.arg, IfThis.isName_Identifier(dataclass_Identifier)) #
|
|
245
|
-
doThat = Grab.annotationAttribute(Grab.idAttribute(Then.replaceWith(dataclass_IdentifierParallel))) #
|
|
246
|
-
NodeChanger(findThis, doThat).visit(unRepackDataclass.astFunctionDef) #
|
|
238
|
+
findThis = ClassIsAndAttribute.annotationIs(ast.arg, IfThis.isName_Identifier(dataclass_Identifier)) # pyright: ignore[reportArgumentType, reportUnknownVariableType, reportCallIssue]
|
|
239
|
+
doThat = Grab.annotationAttribute(Grab.idAttribute(Then.replaceWith(dataclass_IdentifierParallel))) # pyright: ignore[reportArgumentType]
|
|
240
|
+
NodeChanger(findThis, doThat).visit(unRepackDataclass.astFunctionDef) # pyright: ignore[reportUnknownArgumentType]
|
|
247
241
|
unRepackDataclass.astFunctionDef.returns = Make.Name(dataclass_IdentifierParallel)
|
|
248
242
|
targetCallableIdentifier = ingredientsFunction.astFunctionDef.name
|
|
249
243
|
unRepackDataclass = unpackDataclassCallFunctionRepackDataclass(unRepackDataclass, targetCallableIdentifier, shatteredDataclassParallel)
|
|
250
244
|
|
|
251
|
-
astTuple
|
|
252
|
-
|
|
253
|
-
astTuple.ctx = ast.Store()
|
|
245
|
+
astTuple = raiseIfNone(NodeTourist(Be.Return, Then.extractIt(DOT.value)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
246
|
+
cast(ast.Tuple, astTuple).ctx = ast.Store()
|
|
254
247
|
findThis = ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCall_Identifier(targetCallableIdentifier))
|
|
255
|
-
doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts)))
|
|
248
|
+
doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), cast(ast.Tuple, astTuple).elts)))
|
|
256
249
|
changeAssignCallToTarget = NodeChanger(findThis, doThat)
|
|
257
250
|
changeAssignCallToTarget.visit(unRepackDataclass.astFunctionDef)
|
|
258
251
|
|
|
@@ -287,28 +280,22 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
|
|
|
287
280
|
)
|
|
288
281
|
ingredientsModule.removeImportFromModule('numpy')
|
|
289
282
|
|
|
290
|
-
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier
|
|
283
|
+
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier)
|
|
291
284
|
|
|
292
285
|
write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
|
|
293
286
|
return pathFilename
|
|
294
287
|
|
|
295
|
-
def makeTheorem2(moduleIdentifier: str, callableIdentifier: str | None = None
|
|
296
|
-
|
|
297
|
-
, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
298
|
-
algorithmSourceModule = algorithmSourceModuleHARDCODED
|
|
299
|
-
sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
|
|
288
|
+
def makeTheorem2(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: PathLike[str] | PurePath | str | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
289
|
+
sourceCallableIdentifier = sourceCallableIdentifierDEFAULT
|
|
300
290
|
if callableIdentifier is None:
|
|
301
291
|
callableIdentifier = sourceCallableIdentifier
|
|
302
|
-
logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
|
|
303
|
-
|
|
304
|
-
astModule = parseLogicalPath2astModule(logicalPathSourceModule)
|
|
305
292
|
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
293
|
+
ingredientsFunction.astFunctionDef.name = callableIdentifier
|
|
306
294
|
|
|
307
|
-
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
|
|
308
|
-
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
295
|
+
dataclassInstanceIdentifier = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
309
296
|
|
|
310
297
|
findThis = IfThis.isWhileAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
|
|
311
|
-
doThat = Grab.testAttribute(Grab.comparatorsAttribute(Then.replaceWith([Make.Constant(4)]))) #
|
|
298
|
+
doThat = Grab.testAttribute(Grab.comparatorsAttribute(Then.replaceWith([Make.Constant(4)]))) # pyright: ignore[reportArgumentType]
|
|
312
299
|
NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
|
|
313
300
|
|
|
314
301
|
findThis = IfThis.isIfAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
|
|
@@ -326,7 +313,7 @@ def makeTheorem2(moduleIdentifier: str, callableIdentifier: str | None = None
|
|
|
326
313
|
doThat = Then.removeIt
|
|
327
314
|
NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
|
|
328
315
|
|
|
329
|
-
theCountingIdentifier =
|
|
316
|
+
theCountingIdentifier = theCountingIdentifierDEFAULT
|
|
330
317
|
doubleTheCount = Make.AugAssign(Make.Attribute(ast.Name(dataclassInstanceIdentifier), theCountingIdentifier), ast.Mult(), Make.Constant(2))
|
|
331
318
|
findThis = Be.Return
|
|
332
319
|
doThat = Then.insertThisAbove([doubleTheCount])
|
|
@@ -337,19 +324,20 @@ def makeTheorem2(moduleIdentifier: str, callableIdentifier: str | None = None
|
|
|
337
324
|
if sourceCallableDispatcher is not None:
|
|
338
325
|
raise NotImplementedError('sourceCallableDispatcher is not implemented yet')
|
|
339
326
|
|
|
340
|
-
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier
|
|
327
|
+
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier)
|
|
341
328
|
|
|
342
329
|
write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
|
|
343
330
|
|
|
344
331
|
return pathFilename
|
|
345
332
|
|
|
346
|
-
def trimTheorem2(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
333
|
+
def trimTheorem2(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: PathLike[str] | PurePath | str | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
334
|
+
sourceCallableIdentifier = sourceCallableIdentifierDEFAULT
|
|
335
|
+
if callableIdentifier is None:
|
|
336
|
+
callableIdentifier = sourceCallableIdentifier
|
|
337
|
+
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
338
|
+
ingredientsFunction.astFunctionDef.name = callableIdentifier
|
|
350
339
|
|
|
351
|
-
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
|
|
352
|
-
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
340
|
+
dataclassInstanceIdentifier = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
353
341
|
|
|
354
342
|
findThis = IfThis.isIfUnaryNotAttributeNamespace_Identifier(dataclassInstanceIdentifier, 'dimensionsUnconstrained')
|
|
355
343
|
doThat = Then.removeIt
|
|
@@ -358,128 +346,88 @@ def trimTheorem2(pathFilenameSource: PurePath) -> PurePath:
|
|
|
358
346
|
ingredientsModule = IngredientsModule(ingredientsFunction)
|
|
359
347
|
ingredientsModule.removeImportFromModule('numpy')
|
|
360
348
|
|
|
361
|
-
pathFilename =
|
|
349
|
+
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier)
|
|
362
350
|
|
|
363
351
|
write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
|
|
364
352
|
|
|
365
|
-
logicalPath: list[str] = []
|
|
366
|
-
if packageSettings.packageName:
|
|
367
|
-
logicalPath.append(packageSettings.packageName)
|
|
368
|
-
if logicalPathInfix:
|
|
369
|
-
logicalPath.append(logicalPathInfix)
|
|
370
|
-
logicalPath.append(pathFilename.stem)
|
|
371
|
-
moduleWithLogicalPath: str_nameDOTname = '.'.join(logicalPath)
|
|
372
|
-
|
|
373
|
-
astImportFrom: ast.ImportFrom = Make.ImportFrom(moduleWithLogicalPath, list_alias=[Make.alias(ingredientsFunction.astFunctionDef.name)])
|
|
374
|
-
|
|
375
353
|
return pathFilename
|
|
376
354
|
|
|
377
|
-
def numbaOnTheorem2(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
dataclass_Identifier: str | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
|
|
384
|
-
if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
385
|
-
|
|
386
|
-
dataclassLogicalPathModule = None
|
|
387
|
-
for moduleWithLogicalPath, listNameTuples in countNumbaTheorem2.imports.dictionaryImportFrom.items():
|
|
388
|
-
for nameTuple in listNameTuples:
|
|
389
|
-
if nameTuple[0] == dataclass_Identifier:
|
|
390
|
-
dataclassLogicalPathModule = moduleWithLogicalPath
|
|
391
|
-
break
|
|
392
|
-
if dataclassLogicalPathModule:
|
|
393
|
-
break
|
|
394
|
-
if dataclassLogicalPathModule is None: raise raiseIfNoneGitHubIssueNumber3
|
|
395
|
-
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(countNumbaTheorem2.astFunctionDef)
|
|
396
|
-
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
397
|
-
shatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclass_Identifier, dataclassInstanceIdentifier)
|
|
398
|
-
|
|
399
|
-
countNumbaTheorem2.imports.update(shatteredDataclass.imports)
|
|
400
|
-
countNumbaTheorem2 = removeDataclassFromFunction(countNumbaTheorem2, shatteredDataclass)
|
|
355
|
+
def numbaOnTheorem2(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: PathLike[str] | PurePath | str | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
356
|
+
sourceCallableIdentifier = sourceCallableIdentifierDEFAULT
|
|
357
|
+
if callableIdentifier is None:
|
|
358
|
+
callableIdentifier = sourceCallableIdentifier
|
|
359
|
+
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
360
|
+
ingredientsFunction.astFunctionDef.name = callableIdentifier
|
|
401
361
|
|
|
402
|
-
|
|
362
|
+
shatteredDataclass = shatter_dataclassesDOTdataclass(*findDataclass(ingredientsFunction))
|
|
403
363
|
|
|
404
|
-
|
|
364
|
+
ingredientsFunction.imports.update(shatteredDataclass.imports)
|
|
365
|
+
ingredientsFunction = removeDataclassFromFunction(ingredientsFunction, shatteredDataclass)
|
|
366
|
+
ingredientsFunction = removeUnusedParameters(ingredientsFunction)
|
|
367
|
+
ingredientsFunction = decorateCallableWithNumba(ingredientsFunction, parametersNumbaLight)
|
|
405
368
|
|
|
406
|
-
ingredientsModule = IngredientsModule(
|
|
369
|
+
ingredientsModule = IngredientsModule(ingredientsFunction)
|
|
407
370
|
ingredientsModule.removeImportFromModule('numpy')
|
|
408
371
|
|
|
409
|
-
pathFilename =
|
|
372
|
+
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier)
|
|
410
373
|
|
|
411
374
|
write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
|
|
412
375
|
|
|
413
|
-
|
|
414
|
-
if packageSettings.packageName:
|
|
415
|
-
logicalPath.append(packageSettings.packageName)
|
|
416
|
-
if logicalPathInfix:
|
|
417
|
-
logicalPath.append(logicalPathInfix)
|
|
418
|
-
logicalPath.append(pathFilename.stem)
|
|
419
|
-
moduleWithLogicalPath: str_nameDOTname = '.'.join(logicalPath)
|
|
420
|
-
|
|
421
|
-
astImportFrom: ast.ImportFrom = Make.ImportFrom(moduleWithLogicalPath, list_alias=[Make.alias(countNumbaTheorem2.astFunctionDef.name)])
|
|
422
|
-
|
|
423
|
-
return astImportFrom
|
|
376
|
+
return pathFilename
|
|
424
377
|
|
|
425
378
|
def makeUnRePackDataclass(astImportFrom: ast.ImportFrom) -> None:
|
|
426
379
|
callableIdentifierHARDCODED: str = 'sequential'
|
|
427
380
|
|
|
428
|
-
algorithmSourceModule =
|
|
429
|
-
sourceCallableIdentifier =
|
|
381
|
+
algorithmSourceModule = algorithmSourceModuleDEFAULT
|
|
382
|
+
sourceCallableIdentifier = sourceCallableDispatcherDEFAULT
|
|
430
383
|
logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
|
|
431
384
|
|
|
432
|
-
logicalPathInfix =
|
|
433
|
-
moduleIdentifier =
|
|
385
|
+
logicalPathInfix = logicalPathInfixDEFAULT
|
|
386
|
+
moduleIdentifier = dataPackingModuleIdentifierDEFAULT
|
|
434
387
|
callableIdentifier = callableIdentifierHARDCODED
|
|
435
388
|
|
|
436
389
|
ingredientsFunction: IngredientsFunction = astModuleToIngredientsFunction(parseLogicalPath2astModule(logicalPathSourceModule), sourceCallableIdentifier)
|
|
437
390
|
ingredientsFunction.astFunctionDef.name = callableIdentifier
|
|
438
|
-
dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(ingredientsFunction.astFunctionDef)
|
|
439
|
-
if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
|
|
440
|
-
dataclass_Identifier: str | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
|
|
441
|
-
if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
442
391
|
|
|
443
|
-
|
|
444
|
-
for moduleWithLogicalPath, listNameTuples in ingredientsFunction.imports.dictionaryImportFrom.items():
|
|
445
|
-
for nameTuple in listNameTuples:
|
|
446
|
-
if nameTuple[0] == dataclass_Identifier:
|
|
447
|
-
dataclassLogicalPathModule = moduleWithLogicalPath
|
|
448
|
-
break
|
|
449
|
-
if dataclassLogicalPathModule:
|
|
450
|
-
break
|
|
451
|
-
if dataclassLogicalPathModule is None: raise raiseIfNoneGitHubIssueNumber3
|
|
452
|
-
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
|
|
453
|
-
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
454
|
-
shatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclass_Identifier, dataclassInstanceIdentifier)
|
|
392
|
+
shatteredDataclass = shatter_dataclassesDOTdataclass(*findDataclass(ingredientsFunction))
|
|
455
393
|
|
|
456
394
|
ingredientsFunction.imports.update(shatteredDataclass.imports)
|
|
457
395
|
ingredientsFunction.imports.addAst(astImportFrom)
|
|
458
396
|
targetCallableIdentifier = astImportFrom.names[0].name
|
|
459
|
-
ingredientsFunction = unpackDataclassCallFunctionRepackDataclass(ingredientsFunction, targetCallableIdentifier, shatteredDataclass)
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
astTuple: ast.Tuple | None = NodeTourist(Be.Return, Then.extractIt(DOT.value)).captureLastMatch(targetFunctionDef) # type: ignore
|
|
464
|
-
if astTuple is None: raise raiseIfNoneGitHubIssueNumber3
|
|
465
|
-
astTuple.ctx = ast.Store()
|
|
397
|
+
ingredientsFunction = raiseIfNone(unpackDataclassCallFunctionRepackDataclass(ingredientsFunction, targetCallableIdentifier, shatteredDataclass))
|
|
398
|
+
targetFunctionDef = raiseIfNone(extractFunctionDef(parseLogicalPath2astModule(raiseIfNone(astImportFrom.module)), targetCallableIdentifier))
|
|
399
|
+
astTuple = raiseIfNone(NodeTourist(Be.Return, Then.extractIt(DOT.value)).captureLastMatch(targetFunctionDef))
|
|
400
|
+
cast(ast.Tuple, astTuple).ctx = ast.Store()
|
|
466
401
|
|
|
467
402
|
findThis = ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCall_Identifier(targetCallableIdentifier))
|
|
468
|
-
doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts)))
|
|
403
|
+
doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), cast(ast.Tuple, astTuple).elts)))
|
|
469
404
|
NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
|
|
470
405
|
|
|
471
406
|
ingredientsModule = IngredientsModule(ingredientsFunction)
|
|
472
407
|
ingredientsModule.removeImportFromModule('numpy')
|
|
473
408
|
|
|
474
|
-
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier
|
|
409
|
+
pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier)
|
|
475
410
|
|
|
476
411
|
write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
|
|
477
412
|
|
|
478
413
|
if __name__ == '__main__':
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
414
|
+
astModule = getModule(logicalPathInfix=None)
|
|
415
|
+
makeInitializeGroupsOfFolds(astModule, 'initializeCount', 'initializeGroupsOfFolds', logicalPathInfixDEFAULT)
|
|
416
|
+
|
|
417
|
+
astModule = getModule(logicalPathInfix=None)
|
|
418
|
+
pathFilename = makeDaoOfMapFolding(astModule, 'daoOfMapFolding', None, logicalPathInfixDEFAULT, sourceCallableDispatcherDEFAULT)
|
|
419
|
+
|
|
420
|
+
astModule = getModule(logicalPathInfix=None)
|
|
421
|
+
pathFilename = makeDaoOfMapFoldingParallel(astModule, 'countParallel', None, logicalPathInfixDEFAULT, sourceCallableDispatcherDEFAULT)
|
|
422
|
+
|
|
423
|
+
astModule = getModule(logicalPathInfix=None)
|
|
424
|
+
pathFilename = makeTheorem2(astModule, 'theorem2', None, logicalPathInfixDEFAULT, None)
|
|
425
|
+
|
|
426
|
+
astModule = parsePathFilename2astModule(pathFilename)
|
|
427
|
+
pathFilename = trimTheorem2(astModule, 'theorem2Trimmed', None, logicalPathInfixDEFAULT, None)
|
|
428
|
+
|
|
429
|
+
astModule = parsePathFilename2astModule(pathFilename)
|
|
430
|
+
pathFilename = numbaOnTheorem2(astModule, 'theorem2Numba', None, logicalPathInfixDEFAULT, None)
|
|
431
|
+
|
|
432
|
+
astImportFrom = Make.ImportFrom(_getLogicalPath(packageSettings.packageName, logicalPathInfixDEFAULT, 'theorem2Numba'), list_alias=[Make.alias(sourceCallableIdentifierDEFAULT)])
|
|
483
433
|
makeUnRePackDataclass(astImportFrom)
|
|
484
|
-
pathFilename = makeDaoOfMapFolding('daoOfMapFolding', None, logicalPathInfixHARDCODED, sourceCallableDispatcherHARDCODED)
|
|
485
|
-
makeDaoOfMapFoldingParallel()
|
|
@@ -45,9 +45,9 @@ test suite.
|
|
|
45
45
|
"""
|
|
46
46
|
|
|
47
47
|
from mapFolding.someAssemblyRequired.infoBooth import (
|
|
48
|
-
|
|
48
|
+
dataclassInstanceIdentifierDEFAULT as dataclassInstanceIdentifierDEFAULT,
|
|
49
49
|
raiseIfNoneGitHubIssueNumber3 as raiseIfNoneGitHubIssueNumber3,
|
|
50
|
-
|
|
50
|
+
sourceCallableDispatcherDEFAULT as sourceCallableDispatcherDEFAULT,
|
|
51
51
|
)
|
|
52
52
|
|
|
53
53
|
from mapFolding.someAssemblyRequired._toolIfThis import IfThis as IfThis
|
|
@@ -56,3 +56,8 @@ from mapFolding.someAssemblyRequired._toolkitContainers import (
|
|
|
56
56
|
DeReConstructField2ast as DeReConstructField2ast,
|
|
57
57
|
ShatteredDataclass as ShatteredDataclass,
|
|
58
58
|
)
|
|
59
|
+
|
|
60
|
+
def raiseIfNone[TypeSansNone](returnTarget: TypeSansNone | None) -> TypeSansNone:
|
|
61
|
+
if returnTarget is None:
|
|
62
|
+
raise ValueError('Return is None.')
|
|
63
|
+
return returnTarget
|
|
@@ -133,15 +133,15 @@ class DeReConstructField2ast:
|
|
|
133
133
|
self.ast_keyword_field__field = Make.keyword(self.name, self.astName)
|
|
134
134
|
self.ast_nameDOTname = Make.Attribute(Make.Name(dataclassesDOTdataclassInstance_Identifier), self.name)
|
|
135
135
|
|
|
136
|
-
sherpa
|
|
136
|
+
sherpa = NodeTourist( # pyright: ignore[reportUnknownVariableType]
|
|
137
137
|
findThis=ClassIsAndAttribute.targetIs(ast.AnnAssign, IfThis.isName_Identifier(self.name))
|
|
138
|
-
, doThat=Then.extractIt(DOT.annotation) #
|
|
138
|
+
, doThat=Then.extractIt(DOT.annotation) # pyright: ignore[reportArgumentType]
|
|
139
139
|
).captureLastMatch(dataclassClassDef)
|
|
140
140
|
|
|
141
|
-
if sherpa is None: raise raiseIfNoneGitHubIssueNumber3
|
|
141
|
+
if sherpa is None: raise raiseIfNoneGitHubIssueNumber3
|
|
142
142
|
else: self.astAnnotation = sherpa
|
|
143
143
|
|
|
144
|
-
self.ast_argAnnotated = Make.arg(self.name, self.astAnnotation)
|
|
144
|
+
self.ast_argAnnotated = Make.arg(self.name, self.astAnnotation) # pyright: ignore[reportUnknownArgumentType, reportUnknownMemberType]
|
|
145
145
|
|
|
146
146
|
dtype = self.metadata.get('dtype', None)
|
|
147
147
|
if dtype:
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
algorithmSourceModuleDEFAULT: str = 'daoOfMapFolding'
|
|
2
|
+
dataclassInstanceIdentifierDEFAULT: str = 'state'
|
|
3
|
+
dataPackingModuleIdentifierDEFAULT: str = 'dataPacking'
|
|
4
|
+
logicalPathInfixDEFAULT: str = 'syntheticModules'
|
|
5
|
+
sourceCallableDispatcherDEFAULT: str = 'doTheNeedful'
|
|
6
|
+
sourceCallableIdentifierDEFAULT: str = 'count'
|
|
7
|
+
theCountingIdentifierDEFAULT: str = 'groupsOfFolds'
|
|
6
8
|
|
|
7
9
|
class raiseIfNoneGitHubIssueNumber3(Exception): pass
|
|
8
10
|
|
|
@@ -13,8 +15,3 @@ dictionaryEstimates: dict[tuple[int, ...], int] = {
|
|
|
13
15
|
(3,3,3,3): 85109616000000000000000000000000,
|
|
14
16
|
(8,8): 791274195985524900,
|
|
15
17
|
}
|
|
16
|
-
algorithmSourceModuleHARDCODED: str = 'daoOfMapFolding'
|
|
17
|
-
sourceCallableIdentifierHARDCODED: str = 'count'
|
|
18
|
-
logicalPathInfixHARDCODED: str = 'syntheticModules'
|
|
19
|
-
theCountingIdentifierHARDCODED: str = 'groupsOfFolds'
|
|
20
|
-
dataPackingModuleIdentifierHARDCODED: str = 'dataPacking'
|
|
@@ -129,4 +129,4 @@ def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, paramete
|
|
|
129
129
|
class SpicesJobNumba:
|
|
130
130
|
useNumbaProgressBar: bool = True
|
|
131
131
|
numbaProgressBarIdentifier: str = 'ProgressBarGroupsOfFolds'
|
|
132
|
-
parametersNumba: ParametersNumba = dataclasses.field(default_factory=ParametersNumba)
|
|
132
|
+
parametersNumba: ParametersNumba = dataclasses.field(default_factory=ParametersNumba) # pyright: ignore[reportArgumentType, reportCallIssue, reportUnknownVariableType]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
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
|
|
@@ -18,8 +18,6 @@ Classifier: Natural Language :: English
|
|
|
18
18
|
Classifier: Operating System :: OS Independent
|
|
19
19
|
Classifier: Programming Language :: Python
|
|
20
20
|
Classifier: Programming Language :: Python :: 3
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
23
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
24
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
25
23
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
@@ -28,7 +26,7 @@ Classifier: Topic :: Software Development :: Code Generators
|
|
|
28
26
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
27
|
Classifier: Topic :: Software Development :: Compilers
|
|
30
28
|
Classifier: Typing :: Typed
|
|
31
|
-
Requires-Python: >=3.
|
|
29
|
+
Requires-Python: >=3.12
|
|
32
30
|
Description-Content-Type: text/markdown
|
|
33
31
|
License-File: LICENSE
|
|
34
32
|
Requires-Dist: astToolkit
|
|
@@ -5,7 +5,7 @@ mapFolding/daoOfMapFolding.py,sha256=ncTIiBfTsM8SNVx9qefZ0bBcBtviWLSk4iPv3Z9nGiE
|
|
|
5
5
|
mapFolding/dataBaskets.py,sha256=crfmmYJGeJ7QLCzuYi4rtVOtzCDRoOiTNfPfHbc6Foo,5620
|
|
6
6
|
mapFolding/datatypes.py,sha256=dqOAa2RbiGcsRl9X4qo4tdMamgOoZVnewrMjY4mHXS4,773
|
|
7
7
|
mapFolding/filesystemToolkit.py,sha256=O9VQ0tSXlrGUhU3qN7uWxOTAZfuQb3fcRkTrfRZrGXo,9854
|
|
8
|
-
mapFolding/oeis.py,sha256=
|
|
8
|
+
mapFolding/oeis.py,sha256=ENTFLTQ2gfet16AA0CHy55mq5Qc0FBiix3IEpdymaV8,17115
|
|
9
9
|
mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
mapFolding/theSSOT.py,sha256=7CyB3FnDWyNovTuUPRvSIfF7GxQc3aZoIsIwF1-4OyE,1456
|
|
11
11
|
mapFolding/reference/__init__.py,sha256=GKcSgYE49NcTISx-JZbELXyq-eRkMeTL5g4DXInWFw0,2206
|
|
@@ -20,15 +20,15 @@ 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/Z0Z_makeAllModules.py,sha256=
|
|
25
|
-
mapFolding/someAssemblyRequired/__init__.py,sha256=
|
|
23
|
+
mapFolding/someAssemblyRequired/RecipeJob.py,sha256=oDOg5FVGTlnZQFW1K0OVucoHbApjsLTpPXy9GtMbjp4,4339
|
|
24
|
+
mapFolding/someAssemblyRequired/Z0Z_makeAllModules.py,sha256=MmwL95QGFKwuJFk2l2PCo2f4FMuVAtLsqiLFofX0Lns,28872
|
|
25
|
+
mapFolding/someAssemblyRequired/__init__.py,sha256=ndEXbwc6SSGnAyYkgL2I4nvDGQa8EbJu_f9l9NJwTsw,2931
|
|
26
26
|
mapFolding/someAssemblyRequired/_toolIfThis.py,sha256=h1ueRlUU6Rb4vZCa3KtxFjUSrULRl-GkPp8NrosWdzM,3012
|
|
27
|
-
mapFolding/someAssemblyRequired/_toolkitContainers.py,sha256=
|
|
27
|
+
mapFolding/someAssemblyRequired/_toolkitContainers.py,sha256=OBEqbzY137YVht5sWjJhfBSeE1qnx_xHRzjx4QFZ6P0,9767
|
|
28
28
|
mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=9RPU6vK_eUg64GtVFI_nZnvUryXw8gfHJs9NyDYHIvg,2745
|
|
29
|
-
mapFolding/someAssemblyRequired/infoBooth.py,sha256=
|
|
29
|
+
mapFolding/someAssemblyRequired/infoBooth.py,sha256=RbYswVvjE0mfORepk4tUzScMCb7WYf0GFMs0u-MUmn0,635
|
|
30
30
|
mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py,sha256=csxagvDr89U5fBOSxD6KB6JJh5UVWF8IFGzogIMh1qY,13928
|
|
31
|
-
mapFolding/someAssemblyRequired/toolkitNumba.py,sha256=
|
|
31
|
+
mapFolding/someAssemblyRequired/toolkitNumba.py,sha256=F4DriKPj9TeEJ1qB9H74ekJfMfw2vJvW1zeJXHtxE0E,6680
|
|
32
32
|
mapFolding/someAssemblyRequired/transformationTools.py,sha256=kL3pDENALrayrDRa7gv64IPG-o7tBw8MYnqM0_xJvIQ,7868
|
|
33
33
|
mapFolding/syntheticModules/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
|
|
34
34
|
mapFolding/syntheticModules/countParallel.py,sha256=OK_IB9w4yy9MMAiGvkei5ezPm_00v2nYjPrQZ_IlELg,7733
|
|
@@ -38,7 +38,7 @@ 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.
|
|
41
|
+
mapfolding-0.12.0.dist-info/licenses/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
42
42
|
tests/__init__.py,sha256=5VhHf0JJ2_DSh58zJ0rR5UkpoCon-0IkdljspTCzZ04,1950
|
|
43
43
|
tests/conftest.py,sha256=eumQRoDuWVrhsjDxWXGhW0N7lH0ZZ9XD-5q81bWFqOs,10874
|
|
44
44
|
tests/test_computations.py,sha256=HNpfs9Yz3rdfJInD15Jwd6DYsSR5TCwnR5EW0n7KbeI,5682
|
|
@@ -46,8 +46,8 @@ tests/test_filesystem.py,sha256=imlcetleJc4G9pDZTgS1j8UAs7ADbRxXVuNPecJAvqc,2964
|
|
|
46
46
|
tests/test_oeis.py,sha256=uxvwmgbnylSDdsVJfuAT0LuYLbIVFwSgdLxHm-xUGBM,5043
|
|
47
47
|
tests/test_other.py,sha256=DT7YE82YCHrSjdxhpY4UJnXmZvDm1b4e1QpZV3LyzcM,3747
|
|
48
48
|
tests/test_tasks.py,sha256=pEDukf2SVTOMEsn82JpAWKQzn1ZCTlkhLzQ5hYLg2yY,2780
|
|
49
|
-
mapfolding-0.
|
|
50
|
-
mapfolding-0.
|
|
51
|
-
mapfolding-0.
|
|
52
|
-
mapfolding-0.
|
|
53
|
-
mapfolding-0.
|
|
49
|
+
mapfolding-0.12.0.dist-info/METADATA,sha256=omaT9GvKUuLWj6JcQjB61-7_ygQQhVtAs00fmbcIguk,7610
|
|
50
|
+
mapfolding-0.12.0.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
|
51
|
+
mapfolding-0.12.0.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
|
|
52
|
+
mapfolding-0.12.0.dist-info/top_level.txt,sha256=1gP2vFaqPwHujGwb3UjtMlLEGN-943VSYFR7V4gDqW8,17
|
|
53
|
+
mapfolding-0.12.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|