mapFolding 0.16.1__py3-none-any.whl → 0.16.2__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.
- easyRun/A000682.py +1 -1
- easyRun/A005316.py +2 -3
- easyRun/NOTcountingFolds.py +3 -3
- easyRun/meanders.py +17 -19
- mapFolding/algorithms/matrixMeanders.py +15 -28
- mapFolding/algorithms/matrixMeandersBeDry.py +34 -116
- mapFolding/algorithms/matrixMeandersNumPy.py +117 -70
- mapFolding/algorithms/matrixMeandersPandas.py +113 -130
- mapFolding/algorithms/oeisIDbyFormula.py +23 -12
- mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py +26 -12
- mapFolding/basecamp.py +140 -242
- mapFolding/dataBaskets.py +14 -30
- mapFolding/reference/A000682facts.py +785 -1264
- mapFolding/reference/A005316facts.py +958 -923
- mapFolding/reference/matrixMeandersAnalysis/signatures.py +2030 -0
- mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +2 -2
- mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +83 -21
- mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +13 -12
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +2 -2
- mapFolding/someAssemblyRequired/makingModules_count.py +88 -80
- mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +11 -7
- mapFolding/someAssemblyRequired/mapFolding/makeMapFoldingModules.py +3 -3
- mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py +7 -8
- mapFolding/someAssemblyRequired/toolkitMakeModules.py +9 -9
- mapFolding/someAssemblyRequired/transformationTools.py +8 -8
- mapFolding/syntheticModules/A007822/algorithm.py +1 -0
- mapFolding/syntheticModules/A007822/asynchronous.py +6 -4
- mapFolding/syntheticModules/A007822/asynchronousAnnex.py +1 -1
- mapFolding/syntheticModules/A007822/asynchronousAnnexNumba.py +2 -17
- mapFolding/syntheticModules/A007822/asynchronousNumba.py +35 -8
- mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +15 -3
- mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +12 -3
- mapFolding/syntheticModules/A007822/theorem2.py +6 -0
- mapFolding/syntheticModules/A007822/theorem2Numba.py +28 -3
- mapFolding/syntheticModules/A007822/theorem2Trimmed.py +7 -1
- mapFolding/syntheticModules/daoOfMapFoldingNumba.py +2 -4
- mapFolding/syntheticModules/dataPacking.py +3 -5
- mapFolding/syntheticModules/meanders/bigInt.py +24 -34
- mapFolding/syntheticModules/theorem2.py +6 -0
- mapFolding/syntheticModules/theorem2Numba.py +9 -4
- mapFolding/syntheticModules/theorem2Trimmed.py +6 -0
- mapFolding/tests/test_computations.py +1 -1
- mapFolding/zCuzDocStoopid/makeDocstrings.py +2 -0
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.2.dist-info}/METADATA +1 -1
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.2.dist-info}/RECORD +49 -48
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.2.dist-info}/WHEEL +0 -0
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.2.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.2.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.16.1.dist-info → mapfolding-0.16.2.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from astToolkit import extractFunctionDef, Make # noqa: D100
|
|
1
|
+
from astToolkit import extractFunctionDef, identifierDotAttribute, Make # noqa: D100
|
|
2
2
|
from hunterMakesPy import raiseIfNone
|
|
3
3
|
from mapFolding.someAssemblyRequired import (
|
|
4
4
|
identifierCallableSourceDEFAULT, identifierCallableSourceDispatcherDEFAULT, identifierCountingDEFAULT,
|
|
@@ -7,7 +7,7 @@ import ast
|
|
|
7
7
|
|
|
8
8
|
identifierDataclass: str = identifierDataclassInstanceDEFAULT
|
|
9
9
|
identifierCounting: str = identifierCountingDEFAULT
|
|
10
|
-
logicalPathInfixA007822:
|
|
10
|
+
logicalPathInfixA007822: identifierDotAttribute = logicalPathInfixDEFAULT + '.A007822'
|
|
11
11
|
sourceCallableDispatcherA007822: str = identifierCallableSourceDispatcherDEFAULT
|
|
12
12
|
sourceCallableIdentifierA007822: str = identifierCallableSourceDEFAULT
|
|
13
13
|
|
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
"""addSymmetryCheckAsynchronous."""
|
|
2
|
-
from astToolkit import
|
|
2
|
+
from astToolkit import (
|
|
3
|
+
Be, extractFunctionDef, Grab, identifierDotAttribute, Make, NodeChanger, NodeTourist, parsePathFilename2astModule,
|
|
4
|
+
Then)
|
|
3
5
|
from hunterMakesPy import raiseIfNone
|
|
4
6
|
from mapFolding import packageSettings
|
|
5
|
-
from mapFolding.someAssemblyRequired import
|
|
7
|
+
from mapFolding.someAssemblyRequired import (
|
|
8
|
+
identifierCallableSourceDispatcherDEFAULT, identifierCountingDEFAULT, identifierDataclassInstanceDEFAULT, IfThis,
|
|
9
|
+
logicalPathInfixAlgorithmDEFAULT)
|
|
6
10
|
from mapFolding.someAssemblyRequired.A007822.A007822rawMaterials import (
|
|
7
11
|
A007822adjustFoldsTotal, astExprCall_filterAsymmetricFoldsDataclass, identifier_filterAsymmetricFolds,
|
|
8
12
|
identifierCounting, identifierDataclass, logicalPathInfixA007822, sourceCallableDispatcherA007822,
|
|
9
13
|
sourceCallableIdentifierA007822)
|
|
14
|
+
from mapFolding.someAssemblyRequired.infoBooth import identifierCallableSourceDEFAULT
|
|
10
15
|
from mapFolding.someAssemblyRequired.makingModules_count import makeTheorem2, numbaOnTheorem2, trimTheorem2
|
|
11
|
-
from mapFolding.someAssemblyRequired.toolkitMakeModules import
|
|
12
|
-
|
|
16
|
+
from mapFolding.someAssemblyRequired.toolkitMakeModules import (
|
|
17
|
+
getLogicalPath, getModule, getPathFilename, write_astModule)
|
|
13
18
|
from pathlib import PurePath
|
|
14
19
|
import ast
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
identifier_asynchronous = 'asynchronous'
|
|
22
|
+
identifier_getSymmetricFoldsTotal = 'getSymmetricFoldsTotal'
|
|
17
23
|
identifier_initializeConcurrencyManager = 'initializeConcurrencyManager'
|
|
18
24
|
identifier_processCompletedFutures = '_processCompletedFutures'
|
|
19
25
|
|
|
20
|
-
astExprCall_initializeConcurrencyManager: ast.Expr = Make.Expr(Make.Call(Make.Name(identifier_initializeConcurrencyManager)))
|
|
26
|
+
astExprCall_initializeConcurrencyManager: ast.Expr = Make.Expr(Make.Call(Make.Name(identifier_initializeConcurrencyManager), listParameters=[Make.Name('maxWorkers')]))
|
|
21
27
|
AssignTotal2CountingIdentifier: ast.Assign = Make.Assign(
|
|
22
28
|
[Make.Attribute(Make.Name(identifierDataclass), identifierCounting, context=Make.Store())]
|
|
23
|
-
, value=Make.Call(Make.Name(
|
|
29
|
+
, value=Make.Call(Make.Name(identifier_getSymmetricFoldsTotal))
|
|
24
30
|
)
|
|
25
31
|
|
|
26
|
-
def addSymmetryCheckAsynchronous(astModule: ast.Module,
|
|
32
|
+
def addSymmetryCheckAsynchronous(astModule: ast.Module, identifierModule: str, identifierCallable: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath: # noqa: ARG001
|
|
27
33
|
"""Add symmetry check to the counting function.
|
|
28
34
|
|
|
29
35
|
To do asynchronous filtering, a few things must happen.
|
|
@@ -66,19 +72,21 @@ def addSymmetryCheckAsynchronous(astModule: ast.Module, moduleIdentifier: str, c
|
|
|
66
72
|
).captureLastMatch(astModule))
|
|
67
73
|
|
|
68
74
|
astFunctionDef_doTheNeedful.body.insert(0, astExprCall_initializeConcurrencyManager)
|
|
75
|
+
astFunctionDef_doTheNeedful.args.args.append(Make.arg('maxWorkers', Make.BitOr.join([Make.Name('int'), Make.Constant(None)])))
|
|
76
|
+
astFunctionDef_doTheNeedful.args.defaults.append(Make.Constant(None))
|
|
69
77
|
|
|
70
78
|
NodeChanger(
|
|
71
79
|
findThis=Be.FunctionDef.nameIs(IfThis.isIdentifier(sourceCallableDispatcher))
|
|
72
80
|
, doThat=Then.replaceWith(astFunctionDef_doTheNeedful)
|
|
73
81
|
).visit(astModule)
|
|
74
82
|
|
|
75
|
-
astImportFrom = ast.ImportFrom(
|
|
76
|
-
, [Make.alias(identifier_filterAsymmetricFolds), Make.alias(
|
|
83
|
+
astImportFrom = ast.ImportFrom(getLogicalPath(packageSettings.identifierPackage, logicalPathInfix, identifierModule + 'Annex')
|
|
84
|
+
, [Make.alias(identifier_filterAsymmetricFolds), Make.alias(identifier_getSymmetricFoldsTotal), Make.alias(identifier_initializeConcurrencyManager)], 0)
|
|
77
85
|
|
|
78
86
|
astModule.body.insert(0, astImportFrom)
|
|
79
87
|
|
|
80
|
-
pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix,
|
|
81
|
-
pathFilenameAnnex: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix,
|
|
88
|
+
pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, identifierModule)
|
|
89
|
+
pathFilenameAnnex: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, identifierModule + 'Annex')
|
|
82
90
|
|
|
83
91
|
write_astModule(astModule, pathFilename, packageSettings.identifierPackage)
|
|
84
92
|
del astModule
|
|
@@ -165,33 +173,87 @@ def {identifier_filterAsymmetricFolds}(leafBelow: Array1DLeavesTotal) -> None:
|
|
|
165
173
|
del ImaString
|
|
166
174
|
|
|
167
175
|
ImaString = f"""
|
|
168
|
-
def {
|
|
176
|
+
def {identifier_getSymmetricFoldsTotal}() -> int:
|
|
169
177
|
global concurrencyManager, queueFutures, processingThread
|
|
170
178
|
raiseIfNone(concurrencyManager).shutdown(wait=True)
|
|
171
179
|
queueFutures.put(None)
|
|
172
180
|
raiseIfNone(processingThread).join()
|
|
173
181
|
return {identifierCounting}Total
|
|
174
182
|
"""
|
|
175
|
-
astModule.body.append(raiseIfNone(extractFunctionDef(ast.parse(ImaString),
|
|
183
|
+
astModule.body.append(raiseIfNone(extractFunctionDef(ast.parse(ImaString), identifier_getSymmetricFoldsTotal)))
|
|
176
184
|
del ImaString
|
|
177
|
-
|
|
178
185
|
write_astModule(astModule, pathFilenameAnnex, packageSettings.identifierPackage)
|
|
179
186
|
|
|
180
187
|
return pathFilename
|
|
181
188
|
|
|
189
|
+
def makeAsynchronousNumbaOnTheorem2(astModule: ast.Module, identifierModule: str, identifierCallable: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
190
|
+
"""Make the asynchronous numba on theorem2 module."""
|
|
191
|
+
pathFilename: PurePath = numbaOnTheorem2(astModule, identifierModule, identifierCallable, logicalPathInfix, sourceCallableDispatcher)
|
|
192
|
+
|
|
193
|
+
astModule = parsePathFilename2astModule(pathFilename)
|
|
194
|
+
|
|
195
|
+
listAssignToMove: list[ast.Assign] = []
|
|
196
|
+
|
|
197
|
+
findThis = IfThis.isAnyOf(IfThis.isAssignAndTargets0Is(IfThis.isNameIdentifier(identifierCountingDEFAULT))
|
|
198
|
+
, Be.AugAssign.targetIs(IfThis.isNameIdentifier(identifierCountingDEFAULT)))
|
|
199
|
+
NodeTourist(findThis, Then.appendTo(listAssignToMove)).visit(astModule)
|
|
200
|
+
|
|
201
|
+
NodeChanger(findThis, Then.removeIt).visit(astModule)
|
|
202
|
+
|
|
203
|
+
NodeChanger(
|
|
204
|
+
findThis=Be.Assign.valueIs(IfThis.isCallIdentifier(identifierCallableSourceDEFAULT))
|
|
205
|
+
, doThat=Then.insertThisBelow(listAssignToMove)
|
|
206
|
+
).visit(astModule)
|
|
207
|
+
|
|
208
|
+
write_astModule(astModule, pathFilename, packageSettings.identifierPackage)
|
|
209
|
+
|
|
210
|
+
return pathFilename
|
|
211
|
+
|
|
212
|
+
def makeAsynchronousTheorem2(astModule: ast.Module, identifierModule: str, identifierCallable: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
213
|
+
"""Make the asynchronous theorem2 module."""
|
|
214
|
+
pathFilename: PurePath = makeTheorem2(astModule, identifierModule, identifierCallable, logicalPathInfix, sourceCallableDispatcher)
|
|
215
|
+
|
|
216
|
+
astModule = parsePathFilename2astModule(pathFilename)
|
|
217
|
+
|
|
218
|
+
astAttribute = Make.Attribute(Make.Name(identifierDataclassInstanceDEFAULT), identifierCountingDEFAULT)
|
|
219
|
+
astAssign = Make.Assign([astAttribute], value=Make.Constant(0))
|
|
220
|
+
|
|
221
|
+
NodeChanger[ast.Call, ast.Call](
|
|
222
|
+
findThis = IfThis.isCallIdentifier(identifier_initializeConcurrencyManager)
|
|
223
|
+
, doThat = Grab.argsAttribute(lambda args: [*args, astAttribute]) # pyright: ignore[reportArgumentType]
|
|
224
|
+
).visit(astModule)
|
|
225
|
+
|
|
226
|
+
NodeChanger(
|
|
227
|
+
findThis = Be.Expr.valueIs(IfThis.isCallIdentifier(identifier_initializeConcurrencyManager))
|
|
228
|
+
, doThat = Then.insertThisBelow([astAssign])
|
|
229
|
+
).visit(astModule)
|
|
230
|
+
|
|
231
|
+
identifierAnnex: identifierDotAttribute = getLogicalPath(packageSettings.identifierPackage, logicalPathInfix, identifier_asynchronous + 'Annex')
|
|
232
|
+
identifierAnnexNumba: identifierDotAttribute = identifierAnnex + 'Numba'
|
|
233
|
+
|
|
234
|
+
NodeChanger(
|
|
235
|
+
findThis=Be.ImportFrom.moduleIs(IfThis.isIdentifier(identifierAnnex))
|
|
236
|
+
, doThat=Grab.moduleAttribute(Then.replaceWith(identifierAnnexNumba))
|
|
237
|
+
).visit(astModule)
|
|
238
|
+
|
|
239
|
+
write_astModule(astModule, pathFilename, packageSettings.identifierPackage)
|
|
240
|
+
|
|
241
|
+
return pathFilename
|
|
242
|
+
|
|
182
243
|
def _makeA007822AsynchronousModules() -> None:
|
|
183
244
|
|
|
184
|
-
astModule = getModule(logicalPathInfix=logicalPathInfixAlgorithmDEFAULT)
|
|
185
|
-
pathFilename = addSymmetryCheckAsynchronous(astModule, 'asynchronous', None, logicalPathInfixA007822, sourceCallableDispatcherA007822)
|
|
245
|
+
astModule: ast.Module = getModule(logicalPathInfix=logicalPathInfixAlgorithmDEFAULT)
|
|
246
|
+
pathFilename: PurePath = addSymmetryCheckAsynchronous(astModule, 'asynchronous', None, logicalPathInfixA007822, sourceCallableDispatcherA007822)
|
|
186
247
|
|
|
187
|
-
astModule = getModule(logicalPathInfix=logicalPathInfixA007822,
|
|
188
|
-
pathFilename =
|
|
248
|
+
astModule = getModule(logicalPathInfix=logicalPathInfixA007822, identifierModule='asynchronous')
|
|
249
|
+
pathFilename = makeAsynchronousTheorem2(astModule, 'asynchronousTheorem2', None, logicalPathInfixA007822, identifierCallableSourceDispatcherDEFAULT)
|
|
189
250
|
|
|
190
251
|
astModule = parsePathFilename2astModule(pathFilename)
|
|
191
|
-
pathFilename = trimTheorem2(astModule, 'asynchronousTrimmed', None, logicalPathInfixA007822,
|
|
252
|
+
pathFilename = trimTheorem2(astModule, 'asynchronousTrimmed', None, logicalPathInfixA007822, identifierCallableSourceDispatcherDEFAULT)
|
|
192
253
|
|
|
193
254
|
astModule = parsePathFilename2astModule(pathFilename)
|
|
194
|
-
pathFilename =
|
|
255
|
+
pathFilename = makeAsynchronousNumbaOnTheorem2(astModule, 'asynchronousNumba', None, logicalPathInfixA007822, identifierCallableSourceDispatcherDEFAULT)
|
|
195
256
|
|
|
196
257
|
if __name__ == '__main__':
|
|
197
258
|
_makeA007822AsynchronousModules()
|
|
259
|
+
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"""addSymmetryCheck."""
|
|
2
|
-
from astToolkit import Be, Make, NodeChanger, NodeTourist, parsePathFilename2astModule, Then
|
|
2
|
+
from astToolkit import Be, identifierDotAttribute, Make, NodeChanger, NodeTourist, parsePathFilename2astModule, Then
|
|
3
3
|
from hunterMakesPy import raiseIfNone
|
|
4
4
|
from mapFolding import packageSettings
|
|
5
5
|
from mapFolding.someAssemblyRequired import (
|
|
6
|
-
identifierCallableSourceDEFAULT,
|
|
6
|
+
identifierCallableSourceDEFAULT, identifierCallableSourceDispatcherDEFAULT, identifierCountingDEFAULT,
|
|
7
|
+
identifierDataclassInstanceDEFAULT, IfThis)
|
|
7
8
|
from mapFolding.someAssemblyRequired.A007822.A007822rawMaterials import (
|
|
8
9
|
A007822adjustFoldsTotal, A007822incrementCount, FunctionDef_filterAsymmetricFolds, logicalPathInfixA007822,
|
|
9
10
|
sourceCallableDispatcherA007822, sourceCallableIdentifierA007822)
|
|
10
11
|
from mapFolding.someAssemblyRequired.makingModules_count import (
|
|
11
|
-
|
|
12
|
+
makeMapFoldingNumba, makeTheorem2, numbaOnTheorem2, trimTheorem2)
|
|
12
13
|
from mapFolding.someAssemblyRequired.makingModules_doTheNeedful import makeInitializeState, makeUnRePackDataclass
|
|
13
14
|
from mapFolding.someAssemblyRequired.toolkitMakeModules import (
|
|
14
15
|
getLogicalPath, getModule, getPathFilename, write_astModule)
|
|
@@ -16,7 +17,7 @@ from os import PathLike
|
|
|
16
17
|
from pathlib import PurePath
|
|
17
18
|
import ast
|
|
18
19
|
|
|
19
|
-
def addSymmetryCheck(astModule: ast.Module,
|
|
20
|
+
def addSymmetryCheck(astModule: ast.Module, identifierModule: str, identifierCallable: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath: # noqa: ARG001
|
|
20
21
|
"""Add logic to check for symmetric folds."""
|
|
21
22
|
# NOTE HEY HEY! Are you trying to figure out why there is more than one copy of `filterAsymmetricFolds`? See the TODO NOTE, below.
|
|
22
23
|
|
|
@@ -37,7 +38,7 @@ def addSymmetryCheck(astModule: ast.Module, moduleIdentifier: str, callableIdent
|
|
|
37
38
|
# system to replace the `Ingredients` paradigm.
|
|
38
39
|
NodeChanger(Be.ImportFrom, Then.insertThisBelow([FunctionDef_filterAsymmetricFolds])).visit(astModule)
|
|
39
40
|
|
|
40
|
-
pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix,
|
|
41
|
+
pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, identifierModule)
|
|
41
42
|
|
|
42
43
|
write_astModule(astModule, pathFilename, packageSettings.identifierPackage)
|
|
43
44
|
|
|
@@ -47,22 +48,22 @@ def _makeA007822Modules() -> None:
|
|
|
47
48
|
astModule = getModule(logicalPathInfix='algorithms')
|
|
48
49
|
pathFilename = addSymmetryCheck(astModule, 'algorithm', None, logicalPathInfixA007822, None)
|
|
49
50
|
|
|
50
|
-
astModule = getModule(logicalPathInfix=logicalPathInfixA007822,
|
|
51
|
-
pathFilename: PurePath =
|
|
51
|
+
astModule = getModule(logicalPathInfix=logicalPathInfixA007822, identifierModule='algorithm')
|
|
52
|
+
pathFilename: PurePath = makeMapFoldingNumba(astModule, 'algorithmNumba', None, logicalPathInfixA007822, sourceCallableDispatcherA007822)
|
|
52
53
|
|
|
53
54
|
# NOTE I can't handle parallel right now.
|
|
54
55
|
|
|
55
|
-
astModule = getModule(logicalPathInfix=logicalPathInfixA007822,
|
|
56
|
+
astModule = getModule(logicalPathInfix=logicalPathInfixA007822, identifierModule='algorithm')
|
|
56
57
|
makeInitializeState(astModule, 'initializeState', 'transitionOnGroupsOfFolds', logicalPathInfixA007822)
|
|
57
58
|
|
|
58
|
-
astModule = getModule(logicalPathInfix=logicalPathInfixA007822,
|
|
59
|
-
pathFilename = makeTheorem2(astModule, 'theorem2', None, logicalPathInfixA007822,
|
|
59
|
+
astModule = getModule(logicalPathInfix=logicalPathInfixA007822, identifierModule='algorithm')
|
|
60
|
+
pathFilename = makeTheorem2(astModule, 'theorem2', None, logicalPathInfixA007822, identifierCallableSourceDispatcherDEFAULT)
|
|
60
61
|
|
|
61
62
|
astModule = parsePathFilename2astModule(pathFilename)
|
|
62
|
-
pathFilename = trimTheorem2(astModule, 'theorem2Trimmed', None, logicalPathInfixA007822,
|
|
63
|
+
pathFilename = trimTheorem2(astModule, 'theorem2Trimmed', None, logicalPathInfixA007822, identifierCallableSourceDispatcherDEFAULT)
|
|
63
64
|
|
|
64
65
|
astModule = parsePathFilename2astModule(pathFilename)
|
|
65
|
-
pathFilename = numbaOnTheorem2(astModule, 'theorem2Numba', None, logicalPathInfixA007822,
|
|
66
|
+
pathFilename = numbaOnTheorem2(astModule, 'theorem2Numba', None, logicalPathInfixA007822, identifierCallableSourceDispatcherDEFAULT)
|
|
66
67
|
# TODO from mapFolding.syntheticModules.dataPackingA007822 import unRePackDataclass
|
|
67
68
|
# @unRePackDataclass
|
|
68
69
|
|
|
@@ -327,11 +327,11 @@ if __name__ == '__main__':
|
|
|
327
327
|
"""
|
|
328
328
|
|
|
329
329
|
if __name__ == '__main__':
|
|
330
|
-
state = transitionOnGroupsOfFolds(MapFoldingState((
|
|
330
|
+
state = transitionOnGroupsOfFolds(MapFoldingState((2,5)))
|
|
331
331
|
pathModule = PurePosixPath(packageSettings.pathPackage, 'jobs')
|
|
332
332
|
pathFilenameFoldsTotal = PurePosixPath(getPathFilenameFoldsTotal(state.mapShape, pathModule))
|
|
333
333
|
aJob = RecipeJobTheorem2(state, pathModule=pathModule, pathFilenameFoldsTotal=pathFilenameFoldsTotal)
|
|
334
|
-
spices = SpicesJobNumba(useNumbaProgressBar=
|
|
334
|
+
spices = SpicesJobNumba(useNumbaProgressBar=True, parametersNumba=parametersNumbaLight)
|
|
335
335
|
makeJobNumba(aJob, spices)
|
|
336
336
|
|
|
337
337
|
# TODO Improve this module with lessons learned in `makeJobTheorem2codon`.
|
|
@@ -11,8 +11,7 @@ from hunterMakesPy import raiseIfNone
|
|
|
11
11
|
from mapFolding import packageSettings
|
|
12
12
|
from mapFolding.someAssemblyRequired import (
|
|
13
13
|
identifierCallableSourceDEFAULT, identifierCountingDEFAULT, IfThis, ShatteredDataclass)
|
|
14
|
-
from mapFolding.someAssemblyRequired.
|
|
15
|
-
from mapFolding.someAssemblyRequired.toolkitMakeModules import findDataclass, getPathFilename
|
|
14
|
+
from mapFolding.someAssemblyRequired.toolkitMakeModules import findDataclass, getLogicalPath, getPathFilename
|
|
16
15
|
from mapFolding.someAssemblyRequired.toolkitNumba import decorateCallableWithNumba, parametersNumbaLight
|
|
17
16
|
from mapFolding.someAssemblyRequired.transformationTools import (
|
|
18
17
|
removeDataclassFromFunction, shatter_dataclassesDOTdataclass, unpackDataclassCallFunctionRepackDataclass)
|
|
@@ -21,29 +20,16 @@ from pathlib import PurePath
|
|
|
21
20
|
from typing import cast
|
|
22
21
|
import ast
|
|
23
22
|
|
|
24
|
-
def
|
|
25
|
-
"""Generate Numba-optimized sequential implementation of
|
|
26
|
-
|
|
27
|
-
(AI generated docstring)
|
|
28
|
-
|
|
29
|
-
Creates a high-performance sequential version of the map folding algorithm by
|
|
30
|
-
decomposing dataclass parameters into individual primitive values, removing
|
|
31
|
-
dataclass dependencies that are incompatible with Numba, applying Numba
|
|
32
|
-
decorators for just-in-time compilation, and optionally including a dispatcher
|
|
33
|
-
function for dataclass integration.
|
|
34
|
-
|
|
35
|
-
The generated module provides significant performance improvements over the
|
|
36
|
-
original dataclass-based implementation while maintaining algorithmic correctness.
|
|
37
|
-
The transformation preserves all computational logic while restructuring data
|
|
38
|
-
access patterns for optimal Numba compilation.
|
|
23
|
+
def makeMapFoldingNumba(astModule: ast.Module, identifierModule: str, identifierCallable: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
24
|
+
"""Generate Numba-optimized sequential implementation of an algorithm.
|
|
39
25
|
|
|
40
26
|
Parameters
|
|
41
27
|
----------
|
|
42
28
|
astModule : ast.Module
|
|
43
29
|
Source module containing the base algorithm.
|
|
44
|
-
|
|
30
|
+
identifierModule : str
|
|
45
31
|
Name for the generated optimized module.
|
|
46
|
-
|
|
32
|
+
identifierCallable : str | None = None
|
|
47
33
|
Name for the main computational function.
|
|
48
34
|
logicalPathInfix : PathLike[str] | PurePath | str | None = None
|
|
49
35
|
Directory path for organizing the generated module.
|
|
@@ -56,9 +42,9 @@ def makeDaoOfMapFoldingNumba(astModule: ast.Module, moduleIdentifier: str, calla
|
|
|
56
42
|
Filesystem path where the optimized module was written.
|
|
57
43
|
|
|
58
44
|
"""
|
|
59
|
-
sourceCallableIdentifier:
|
|
45
|
+
sourceCallableIdentifier: str = identifierCallableSourceDEFAULT
|
|
60
46
|
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
61
|
-
ingredientsFunction.astFunctionDef.name =
|
|
47
|
+
ingredientsFunction.astFunctionDef.name = identifierCallable or sourceCallableIdentifier
|
|
62
48
|
|
|
63
49
|
shatteredDataclass: ShatteredDataclass = shatter_dataclassesDOTdataclass(*findDataclass(ingredientsFunction))
|
|
64
50
|
|
|
@@ -88,46 +74,46 @@ def makeDaoOfMapFoldingNumba(astModule: ast.Module, moduleIdentifier: str, calla
|
|
|
88
74
|
|
|
89
75
|
ingredientsModule.removeImportFromModule('numpy')
|
|
90
76
|
|
|
91
|
-
pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix,
|
|
77
|
+
pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, identifierModule)
|
|
92
78
|
|
|
93
79
|
write_astModule(ingredientsModule, pathFilename, packageSettings.identifierPackage)
|
|
94
80
|
|
|
95
81
|
return pathFilename
|
|
96
82
|
|
|
97
|
-
def makeTheorem2(astModule: ast.Module,
|
|
83
|
+
def makeTheorem2(astModule: ast.Module, identifierModule: str, identifierCallable: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
|
|
98
84
|
"""Generate module by applying optimization predicted by Theorem 2.
|
|
99
85
|
|
|
100
86
|
Parameters
|
|
101
87
|
----------
|
|
102
88
|
astModule : ast.Module
|
|
103
89
|
Source module containing the base algorithm.
|
|
104
|
-
|
|
90
|
+
identifierModule : str
|
|
105
91
|
Name for the generated theorem-optimized module.
|
|
106
|
-
|
|
92
|
+
identifierCallable : str | None = None
|
|
107
93
|
Name for the optimized computational function.
|
|
108
94
|
logicalPathInfix : PathLike[str] | PurePath | str | None = None
|
|
109
95
|
Directory path for organizing the generated module.
|
|
110
96
|
sourceCallableDispatcher : str | None = None
|
|
111
|
-
|
|
97
|
+
Optional dispatcher function identifier.
|
|
112
98
|
|
|
113
99
|
Returns
|
|
114
100
|
-------
|
|
115
101
|
pathFilename : PurePath
|
|
116
102
|
Filesystem path where the theorem-optimized module was written.
|
|
103
|
+
"""
|
|
104
|
+
identifierCallableInitializeDataclassHARDCODED = 'transitionOnGroupsOfFolds'
|
|
105
|
+
identifierModuleInitializeDataclassHARDCODED = 'initializeState'
|
|
117
106
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
NotImplementedError
|
|
121
|
-
If `sourceCallableDispatcher` is provided.
|
|
107
|
+
identifierCallableInitializeDataclass = identifierCallableInitializeDataclassHARDCODED
|
|
108
|
+
identifierModuleInitializeDataclass = identifierModuleInitializeDataclassHARDCODED
|
|
122
109
|
|
|
123
|
-
"""
|
|
124
110
|
sourceCallableIdentifier = identifierCallableSourceDEFAULT
|
|
125
111
|
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
126
|
-
ingredientsFunction.astFunctionDef.name =
|
|
112
|
+
ingredientsFunction.astFunctionDef.name = identifierCallable or sourceCallableIdentifier
|
|
127
113
|
|
|
128
|
-
dataclassInstanceIdentifier:
|
|
114
|
+
dataclassInstanceIdentifier: str = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
129
115
|
|
|
130
|
-
theCountingIdentifier:
|
|
116
|
+
theCountingIdentifier: str = identifierCountingDEFAULT
|
|
131
117
|
doubleTheCount: ast.AugAssign = Make.AugAssign(Make.Attribute(Make.Name(dataclassInstanceIdentifier), theCountingIdentifier), Make.Mult(), Make.Constant(2))
|
|
132
118
|
|
|
133
119
|
NodeChanger(
|
|
@@ -171,40 +157,41 @@ def makeTheorem2(astModule: ast.Module, moduleIdentifier: str, callableIdentifie
|
|
|
171
157
|
ingredientsModule = IngredientsModule(ingredientsFunction)
|
|
172
158
|
|
|
173
159
|
if sourceCallableDispatcher is not None:
|
|
174
|
-
|
|
175
|
-
|
|
160
|
+
ingredientsFunctionDispatcher: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableDispatcher)
|
|
161
|
+
targetCallableIdentifier = ingredientsFunction.astFunctionDef.name
|
|
176
162
|
|
|
177
|
-
|
|
163
|
+
# Update any calls to the original function name with the new target function name
|
|
164
|
+
NodeChanger(
|
|
165
|
+
findThis = Be.Call.funcIs(Be.Name.idIs(IfThis.isIdentifier(identifierCallableSourceDEFAULT)))
|
|
166
|
+
, doThat = Grab.funcAttribute(Grab.idAttribute(Then.replaceWith(targetCallableIdentifier)))
|
|
167
|
+
).visit(ingredientsFunctionDispatcher.astFunctionDef)
|
|
178
168
|
|
|
179
|
-
|
|
169
|
+
AssignInitializedDataclass: ast.Assign = Make.Assign([Make.Name(dataclassInstanceIdentifier)], value=Make.Call(Make.Name(identifierCallableInitializeDataclass), [Make.Name(dataclassInstanceIdentifier)]))
|
|
180
170
|
|
|
181
|
-
|
|
171
|
+
# Insert the transitionOnGroupsOfFolds call at the beginning of the function
|
|
172
|
+
ingredientsFunctionDispatcher.astFunctionDef.body.insert(0, AssignInitializedDataclass)
|
|
182
173
|
|
|
183
|
-
|
|
184
|
-
|
|
174
|
+
dotModule: identifierDotAttribute = getLogicalPath(packageSettings.identifierPackage, logicalPathInfix, identifierModuleInitializeDataclass)
|
|
175
|
+
ingredientsFunctionDispatcher.imports.addImportFrom_asStr(dotModule, identifierCallableInitializeDataclass)
|
|
185
176
|
|
|
186
|
-
|
|
177
|
+
ingredientsModule.appendIngredientsFunction(ingredientsFunctionDispatcher)
|
|
187
178
|
|
|
188
|
-
|
|
189
|
-
mathematical optimizations of Theorem 2 with Numba just-in-time compilation.
|
|
190
|
-
The transformation includes dataclass decomposition to convert structured
|
|
191
|
-
parameters into primitives, removal of Python object dependencies incompatible
|
|
192
|
-
with Numba, application of Numba decorators for maximum performance, and type
|
|
193
|
-
annotation optimization for efficient compilation.
|
|
179
|
+
pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, identifierModule)
|
|
194
180
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
181
|
+
write_astModule(ingredientsModule, pathFilename, packageSettings.identifierPackage)
|
|
182
|
+
|
|
183
|
+
return pathFilename
|
|
184
|
+
|
|
185
|
+
def numbaOnTheorem2(astModule: ast.Module, identifierModule: str, identifierCallable: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath: # noqa: ARG001
|
|
186
|
+
"""Generate Numba-accelerated Theorem 2 implementation with dataclass decomposition.
|
|
200
187
|
|
|
201
188
|
Parameters
|
|
202
189
|
----------
|
|
203
190
|
astModule : ast.Module
|
|
204
191
|
Source module containing the Theorem 2 implementation.
|
|
205
|
-
|
|
192
|
+
identifierModule : str
|
|
206
193
|
Name for the generated Numba-accelerated module.
|
|
207
|
-
|
|
194
|
+
identifierCallable : str | None = None
|
|
208
195
|
Name for the accelerated computational function.
|
|
209
196
|
logicalPathInfix : PathLike[str] | PurePath | str | None = None
|
|
210
197
|
Directory path for organizing the generated module.
|
|
@@ -218,12 +205,12 @@ def numbaOnTheorem2(astModule: ast.Module, moduleIdentifier: str, callableIdenti
|
|
|
218
205
|
|
|
219
206
|
"""
|
|
220
207
|
sourceCallableIdentifier = identifierCallableSourceDEFAULT
|
|
221
|
-
if callableIdentifier is None:
|
|
222
|
-
callableIdentifier = sourceCallableIdentifier
|
|
223
208
|
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
224
|
-
ingredientsFunction.astFunctionDef.name =
|
|
209
|
+
ingredientsFunction.astFunctionDef.name = identifierCallable or sourceCallableIdentifier
|
|
225
210
|
|
|
226
|
-
|
|
211
|
+
logicalPathDataclass, identifierDataclass, identifierDataclassInstance = findDataclass(ingredientsFunction)
|
|
212
|
+
|
|
213
|
+
shatteredDataclass: ShatteredDataclass = shatter_dataclassesDOTdataclass(logicalPathDataclass, identifierDataclass, identifierDataclassInstance)
|
|
227
214
|
|
|
228
215
|
ingredientsFunction.imports.update(shatteredDataclass.imports)
|
|
229
216
|
ingredientsFunction: IngredientsFunction = removeDataclassFromFunction(ingredientsFunction, shatteredDataclass)
|
|
@@ -233,32 +220,40 @@ def numbaOnTheorem2(astModule: ast.Module, moduleIdentifier: str, callableIdenti
|
|
|
233
220
|
ingredientsModule = IngredientsModule(ingredientsFunction)
|
|
234
221
|
ingredientsModule.removeImportFromModule('numpy')
|
|
235
222
|
|
|
236
|
-
|
|
223
|
+
if sourceCallableDispatcher is not None:
|
|
224
|
+
ingredientsFunctionDispatcher: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableDispatcher)
|
|
225
|
+
ingredientsFunctionDispatcher.imports.update(shatteredDataclass.imports)
|
|
226
|
+
targetCallableIdentifier = ingredientsFunction.astFunctionDef.name
|
|
227
|
+
ingredientsFunctionDispatcher = unpackDataclassCallFunctionRepackDataclass(ingredientsFunctionDispatcher, targetCallableIdentifier, shatteredDataclass)
|
|
228
|
+
astTuple: ast.Tuple = cast('ast.Tuple', raiseIfNone(NodeTourist(Be.Return.valueIs(Be.Tuple)
|
|
229
|
+
, doThat=Then.extractIt(DOT.value)).captureLastMatch(ingredientsFunction.astFunctionDef)))
|
|
230
|
+
astTuple.ctx = Make.Store()
|
|
231
|
+
|
|
232
|
+
changeAssignCallToTarget = NodeChanger(
|
|
233
|
+
findThis = Be.Assign.valueIs(IfThis.isCallIdentifier(targetCallableIdentifier))
|
|
234
|
+
, doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts))))
|
|
235
|
+
changeAssignCallToTarget.visit(ingredientsFunctionDispatcher.astFunctionDef)
|
|
236
|
+
|
|
237
|
+
ingredientsModule.appendIngredientsFunction(ingredientsFunctionDispatcher)
|
|
238
|
+
|
|
239
|
+
ingredientsModule.removeImportFromModule('numpy')
|
|
240
|
+
|
|
241
|
+
pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, identifierModule)
|
|
237
242
|
|
|
238
243
|
write_astModule(ingredientsModule, pathFilename, packageSettings.identifierPackage)
|
|
239
244
|
|
|
240
245
|
return pathFilename
|
|
241
246
|
|
|
242
|
-
def trimTheorem2(astModule: ast.Module,
|
|
247
|
+
def trimTheorem2(astModule: ast.Module, identifierModule: str, identifierCallable: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath: # noqa: ARG001
|
|
243
248
|
"""Generate constrained Theorem 2 implementation by removing unnecessary logic.
|
|
244
249
|
|
|
245
|
-
(AI generated docstring)
|
|
246
|
-
|
|
247
|
-
Creates a trimmed version of the Theorem 2 implementation by eliminating conditional logic that is not needed under specific
|
|
248
|
-
constraint assumptions. This transformation removes checks for unconstrained dimensions, simplifying the algorithm for cases
|
|
249
|
-
where dimensional constraints are guaranteed to be satisfied by external conditions.
|
|
250
|
-
|
|
251
|
-
The trimming operation is particularly valuable for generating lean implementations where the calling context ensures that
|
|
252
|
-
certain conditions will always be met, allowing the removal of defensive programming constructs that add computational
|
|
253
|
-
overhead without providing benefits in the constrained environment.
|
|
254
|
-
|
|
255
250
|
Parameters
|
|
256
251
|
----------
|
|
257
252
|
astModule : ast.Module
|
|
258
253
|
Source module containing the Theorem 2 implementation.
|
|
259
|
-
|
|
254
|
+
identifierModule : str
|
|
260
255
|
Name for the generated trimmed module.
|
|
261
|
-
|
|
256
|
+
identifierCallable : str | None = None
|
|
262
257
|
Name for the trimmed computational function.
|
|
263
258
|
logicalPathInfix : PathLike[str] | PurePath | str | None = None
|
|
264
259
|
Directory path for organizing the generated module.
|
|
@@ -271,20 +266,33 @@ def trimTheorem2(astModule: ast.Module, moduleIdentifier: str, callableIdentifie
|
|
|
271
266
|
Filesystem path where the trimmed module was written.
|
|
272
267
|
|
|
273
268
|
"""
|
|
274
|
-
sourceCallableIdentifier = identifierCallableSourceDEFAULT
|
|
269
|
+
sourceCallableIdentifier: str = identifierCallableSourceDEFAULT
|
|
275
270
|
ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
|
|
276
|
-
ingredientsFunction.astFunctionDef.name =
|
|
271
|
+
ingredientsFunction.astFunctionDef.name = identifierCallable or sourceCallableIdentifier
|
|
277
272
|
|
|
278
|
-
|
|
273
|
+
identifierDataclassInstance: str = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
|
|
279
274
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
275
|
+
NodeChanger(
|
|
276
|
+
findThis = IfThis.isIfUnaryNotAttributeNamespaceIdentifier(identifierDataclassInstance, 'dimensionsUnconstrained')
|
|
277
|
+
, doThat = Then.removeIt
|
|
278
|
+
).visit(ingredientsFunction.astFunctionDef)
|
|
283
279
|
|
|
284
280
|
ingredientsModule = IngredientsModule(ingredientsFunction)
|
|
285
281
|
ingredientsModule.removeImportFromModule('numpy')
|
|
286
282
|
|
|
287
|
-
|
|
283
|
+
if sourceCallableDispatcher is not None:
|
|
284
|
+
ingredientsFunctionDispatcher: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableDispatcher)
|
|
285
|
+
targetCallableIdentifier = ingredientsFunction.astFunctionDef.name
|
|
286
|
+
|
|
287
|
+
# Update any calls to the original function name with the new target function name
|
|
288
|
+
NodeChanger(
|
|
289
|
+
findThis = Be.Call.funcIs(Be.Name.idIs(IfThis.isIdentifier(identifierCallableSourceDEFAULT)))
|
|
290
|
+
, doThat = Grab.funcAttribute(Grab.idAttribute(Then.replaceWith(targetCallableIdentifier)))
|
|
291
|
+
).visit(ingredientsFunctionDispatcher.astFunctionDef)
|
|
292
|
+
|
|
293
|
+
ingredientsModule.appendIngredientsFunction(ingredientsFunctionDispatcher)
|
|
294
|
+
|
|
295
|
+
pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, identifierModule)
|
|
288
296
|
|
|
289
297
|
write_astModule(ingredientsModule, pathFilename, packageSettings.identifierPackage)
|
|
290
298
|
|
|
@@ -17,7 +17,7 @@ from pathlib import PurePath
|
|
|
17
17
|
from typing import cast
|
|
18
18
|
import ast
|
|
19
19
|
|
|
20
|
-
def makeInitializeState(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix:
|
|
20
|
+
def makeInitializeState(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath: # noqa: ARG001
|
|
21
21
|
"""Generate initialization module for counting variable setup.
|
|
22
22
|
|
|
23
23
|
(AI generated docstring)
|
|
@@ -65,7 +65,7 @@ def makeInitializeState(astModule: ast.Module, moduleIdentifier: str, callableId
|
|
|
65
65
|
|
|
66
66
|
return pathFilename
|
|
67
67
|
|
|
68
|
-
def makeUnRePackDataclass(astImportFrom: ast.ImportFrom, moduleIdentifier: str = identifierModuleDataPackingDEFAULT) ->
|
|
68
|
+
def makeUnRePackDataclass(astImportFrom: ast.ImportFrom, moduleIdentifier: str = identifierModuleDataPackingDEFAULT) -> PurePath:
|
|
69
69
|
"""Generate interface module for dataclass unpacking and repacking operations.
|
|
70
70
|
|
|
71
71
|
Parameters
|
|
@@ -73,19 +73,21 @@ def makeUnRePackDataclass(astImportFrom: ast.ImportFrom, moduleIdentifier: str =
|
|
|
73
73
|
astImportFrom : ast.ImportFrom
|
|
74
74
|
Import statement specifying the target optimized function to call.
|
|
75
75
|
|
|
76
|
+
moduleIdentifier : str = identifierModuleDataPackingDEFAULT
|
|
77
|
+
Name for the generated interface module.
|
|
78
|
+
|
|
76
79
|
Returns
|
|
77
80
|
-------
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
pathFilename : PurePath
|
|
82
|
+
Filesystem path where the interface module was written.
|
|
81
83
|
"""
|
|
82
84
|
callableIdentifierHARDCODED: str = 'sequential'
|
|
83
85
|
|
|
84
86
|
algorithmSourceModule: identifierDotAttribute = identifierModuleSourceAlgorithmDEFAULT
|
|
85
|
-
callableIdentifier:
|
|
87
|
+
callableIdentifier: str = callableIdentifierHARDCODED
|
|
86
88
|
logicalPathInfix: identifierDotAttribute = logicalPathInfixDEFAULT
|
|
87
89
|
logicalPathInfixAlgorithm: identifierDotAttribute = logicalPathInfixAlgorithmDEFAULT
|
|
88
|
-
sourceCallableIdentifier:
|
|
90
|
+
sourceCallableIdentifier: str = identifierCallableSourceDispatcherDEFAULT
|
|
89
91
|
|
|
90
92
|
logicalPathSourceModule: identifierDotAttribute = '.'.join([packageSettings.identifierPackage, logicalPathInfixAlgorithm, algorithmSourceModule]) # noqa: FLY002
|
|
91
93
|
|
|
@@ -115,3 +117,5 @@ def makeUnRePackDataclass(astImportFrom: ast.ImportFrom, moduleIdentifier: str =
|
|
|
115
117
|
|
|
116
118
|
write_astModule(ingredientsModule, pathFilename, packageSettings.identifierPackage)
|
|
117
119
|
|
|
120
|
+
return pathFilename
|
|
121
|
+
|
|
@@ -10,7 +10,7 @@ from mapFolding.someAssemblyRequired import (
|
|
|
10
10
|
DeReConstructField2ast, identifierCallableSourceDEFAULT, identifierCallableSourceDispatcherDEFAULT, IfThis,
|
|
11
11
|
logicalPathInfixDEFAULT, ShatteredDataclass)
|
|
12
12
|
from mapFolding.someAssemblyRequired.makingModules_count import (
|
|
13
|
-
|
|
13
|
+
makeMapFoldingNumba, makeTheorem2, numbaOnTheorem2, trimTheorem2)
|
|
14
14
|
from mapFolding.someAssemblyRequired.makingModules_doTheNeedful import makeInitializeState, makeUnRePackDataclass
|
|
15
15
|
from mapFolding.someAssemblyRequired.toolkitMakeModules import getLogicalPath, getModule, getPathFilename
|
|
16
16
|
from mapFolding.someAssemblyRequired.toolkitNumba import decorateCallableWithNumba, parametersNumbaLight
|
|
@@ -196,7 +196,7 @@ def makeDaoOfMapFoldingParallelNumba(astModule: ast.Module, moduleIdentifier: st
|
|
|
196
196
|
def makeMapFoldingModules() -> None:
|
|
197
197
|
"""Make multidimensional map folding modules."""
|
|
198
198
|
astModule = getModule(logicalPathInfix='algorithms')
|
|
199
|
-
pathFilename: PurePath =
|
|
199
|
+
pathFilename: PurePath = makeMapFoldingNumba(astModule, 'daoOfMapFoldingNumba', None, logicalPathInfixDEFAULT, identifierCallableSourceDispatcherDEFAULT)
|
|
200
200
|
|
|
201
201
|
astModule = getModule(logicalPathInfix='algorithms')
|
|
202
202
|
pathFilename = makeDaoOfMapFoldingParallelNumba(astModule, 'countParallelNumba', None, logicalPathInfixDEFAULT, identifierCallableSourceDispatcherDEFAULT)
|
|
@@ -205,7 +205,7 @@ def makeMapFoldingModules() -> None:
|
|
|
205
205
|
makeInitializeState(astModule, 'initializeState', 'transitionOnGroupsOfFolds', logicalPathInfixDEFAULT)
|
|
206
206
|
|
|
207
207
|
astModule = getModule(logicalPathInfix='algorithms')
|
|
208
|
-
pathFilename = makeTheorem2(astModule, 'theorem2', None, logicalPathInfixDEFAULT,
|
|
208
|
+
pathFilename = makeTheorem2(astModule, 'theorem2', None, logicalPathInfixDEFAULT, identifierCallableSourceDispatcherDEFAULT)
|
|
209
209
|
|
|
210
210
|
astModule = parsePathFilename2astModule(pathFilename)
|
|
211
211
|
pathFilename = trimTheorem2(astModule, 'theorem2Trimmed', None, logicalPathInfixDEFAULT, None)
|