mapFolding 0.16.1__py3-none-any.whl → 0.16.4__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.
Files changed (78) hide show
  1. easyRun/A000682.py +1 -1
  2. easyRun/A005316.py +2 -3
  3. easyRun/NOTcountingFolds.py +6 -5
  4. easyRun/countFolds.py +1 -1
  5. easyRun/generateAllModules.py +14 -0
  6. easyRun/meanders.py +16 -18
  7. mapFolding/__init__.py +1 -0
  8. mapFolding/_theSSOT.py +3 -2
  9. mapFolding/_theTypes.py +3 -0
  10. mapFolding/algorithms/A086345.py +75 -0
  11. mapFolding/algorithms/matrixMeanders.py +15 -28
  12. mapFolding/algorithms/matrixMeandersBeDry.py +34 -116
  13. mapFolding/algorithms/matrixMeandersNumPy.py +117 -70
  14. mapFolding/algorithms/matrixMeandersPandas.py +113 -130
  15. mapFolding/algorithms/oeisIDbyFormula.py +25 -14
  16. mapFolding/algorithms/symmetricFolds.py +36 -0
  17. mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py +26 -12
  18. mapFolding/basecamp.py +152 -323
  19. mapFolding/dataBaskets.py +136 -34
  20. mapFolding/filesystemToolkit.py +4 -32
  21. mapFolding/oeis.py +5 -12
  22. mapFolding/reference/A000682facts.py +785 -1264
  23. mapFolding/reference/A005316facts.py +958 -923
  24. mapFolding/reference/A086345Wu.py +25 -0
  25. mapFolding/reference/matrixMeandersAnalysis/signatures.py +2033 -0
  26. mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +9 -44
  27. mapFolding/someAssemblyRequired/A007822/_asynchronousAnnex.py +51 -0
  28. mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +39 -136
  29. mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +44 -45
  30. mapFolding/someAssemblyRequired/RecipeJob.py +78 -18
  31. mapFolding/someAssemblyRequired/__init__.py +3 -8
  32. mapFolding/someAssemblyRequired/_toolkitContainers.py +32 -3
  33. mapFolding/someAssemblyRequired/infoBooth.py +40 -23
  34. mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +75 -154
  35. mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +56 -88
  36. mapFolding/someAssemblyRequired/makingModules_count.py +91 -85
  37. mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +7 -65
  38. mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/makeMapFoldingModules.py +25 -31
  39. mapFolding/someAssemblyRequired/meanders/makeMeandersModules.py +14 -13
  40. mapFolding/someAssemblyRequired/toolkitMakeModules.py +10 -10
  41. mapFolding/someAssemblyRequired/toolkitNumba.py +1 -1
  42. mapFolding/someAssemblyRequired/transformationTools.py +17 -19
  43. mapFolding/syntheticModules/A007822/algorithm.py +46 -50
  44. mapFolding/syntheticModules/A007822/asynchronous.py +93 -34
  45. mapFolding/syntheticModules/A007822/initializeState.py +15 -21
  46. mapFolding/syntheticModules/A007822/theorem2.py +21 -21
  47. mapFolding/syntheticModules/A007822/theorem2Numba.py +42 -23
  48. mapFolding/syntheticModules/A007822/theorem2Trimmed.py +21 -21
  49. mapFolding/syntheticModules/countParallelNumba.py +3 -7
  50. mapFolding/syntheticModules/daoOfMapFoldingNumba.py +3 -6
  51. mapFolding/syntheticModules/meanders/bigInt.py +15 -25
  52. mapFolding/syntheticModules/theorem2.py +6 -0
  53. mapFolding/syntheticModules/theorem2Numba.py +26 -2
  54. mapFolding/syntheticModules/theorem2Trimmed.py +6 -0
  55. mapFolding/tests/test_computations.py +1 -1
  56. mapFolding/zCuzDocStoopid/makeDocstrings.py +2 -0
  57. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/METADATA +4 -1
  58. mapfolding-0.16.4.dist-info/RECORD +106 -0
  59. mapFolding/_dataPacking.py +0 -68
  60. mapFolding/reference/meandersDumpingGround/A005316intOptimized.py +0 -122
  61. mapFolding/reference/meandersDumpingGround/A005316optimized128bit.py +0 -79
  62. mapFolding/reference/meandersDumpingGround/matrixMeandersBaseline.py +0 -65
  63. mapFolding/reference/meandersDumpingGround/matrixMeandersBaselineAnnex.py +0 -84
  64. mapFolding/reference/meandersDumpingGround/matrixMeandersSimpleQueue.py +0 -90
  65. mapFolding/syntheticModules/A007822/algorithmNumba.py +0 -94
  66. mapFolding/syntheticModules/A007822/asynchronousAnnex.py +0 -66
  67. mapFolding/syntheticModules/A007822/asynchronousAnnexNumba.py +0 -85
  68. mapFolding/syntheticModules/A007822/asynchronousNumba.py +0 -52
  69. mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +0 -53
  70. mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +0 -47
  71. mapFolding/syntheticModules/dataPacking.py +0 -28
  72. mapFolding/syntheticModules/dataPackingA007822.py +0 -92
  73. mapfolding-0.16.1.dist-info/RECORD +0 -114
  74. /mapFolding/someAssemblyRequired/{mapFolding → mapFoldingModules}/__init__.py +0 -0
  75. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/WHEEL +0 -0
  76. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/entry_points.txt +0 -0
  77. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/licenses/LICENSE +0 -0
  78. {mapfolding-0.16.1.dist-info → mapfolding-0.16.4.dist-info}/top_level.txt +0 -0
@@ -1,23 +1,16 @@
1
1
  """Make functions that are complementary to the `count` function and are often called by `doTheNeedful`."""
2
2
  from astToolkit import (
3
- astModuleToIngredientsFunction, Be, DOT, extractFunctionDef, Grab, identifierDotAttribute, IngredientsFunction,
4
- IngredientsModule, LedgerOfImports, Make, NodeChanger, NodeTourist, parseLogicalPath2astModule, Then)
3
+ Be, DOT, Grab, identifierDotAttribute, IngredientsFunction, IngredientsModule, LedgerOfImports, NodeChanger,
4
+ NodeTourist, Then)
5
5
  from astToolkit.transformationTools import inlineFunctionDef, write_astModule
6
6
  from hunterMakesPy import raiseIfNone
7
7
  from mapFolding import packageSettings
8
- from mapFolding.someAssemblyRequired import (
9
- identifierCallableSourceDEFAULT, identifierCallableSourceDispatcherDEFAULT, identifierCountingDEFAULT,
10
- identifierModuleDataPackingDEFAULT, identifierModuleSourceAlgorithmDEFAULT, IfThis, logicalPathInfixAlgorithmDEFAULT,
11
- logicalPathInfixDEFAULT, ShatteredDataclass)
12
- from mapFolding.someAssemblyRequired.toolkitMakeModules import findDataclass, getPathFilename
13
- from mapFolding.someAssemblyRequired.transformationTools import (
14
- shatter_dataclassesDOTdataclass, unpackDataclassCallFunctionRepackDataclass)
15
- from os import PathLike
8
+ from mapFolding.someAssemblyRequired import default, IfThis
9
+ from mapFolding.someAssemblyRequired.toolkitMakeModules import getPathFilename
16
10
  from pathlib import PurePath
17
- from typing import cast
18
11
  import ast
19
12
 
20
- def makeInitializeState(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: PathLike[str] | PurePath | identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath: # noqa: ARG001
13
+ def makeInitializeState(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath: # noqa: ARG001
21
14
  """Generate initialization module for counting variable setup.
22
15
 
23
16
  (AI generated docstring)
@@ -49,12 +42,12 @@ def makeInitializeState(astModule: ast.Module, moduleIdentifier: str, callableId
49
42
  Filesystem path where the initialization module was written.
50
43
 
51
44
  """
52
- sourceCallableIdentifier: identifierDotAttribute = identifierCallableSourceDEFAULT
45
+ sourceCallableIdentifier: identifierDotAttribute = default['function']['counting']
53
46
  ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
54
47
  ingredientsFunction.astFunctionDef.name = callableIdentifier or sourceCallableIdentifier
55
48
 
56
49
  dataclassInstanceIdentifier: identifierDotAttribute = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
57
- theCountingIdentifier: identifierDotAttribute = identifierCountingDEFAULT
50
+ theCountingIdentifier: identifierDotAttribute = default['variable']['counting']
58
51
 
59
52
  findThis = IfThis.isWhileAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
60
53
  doThat = Grab.testAttribute(Grab.andDoAllOf([Grab.opsAttribute(Then.replaceWith([ast.Eq()])), Grab.leftAttribute(Grab.attrAttribute(Then.replaceWith(theCountingIdentifier)))]))
@@ -64,54 +57,3 @@ def makeInitializeState(astModule: ast.Module, moduleIdentifier: str, callableId
64
57
  write_astModule(IngredientsModule(ingredientsFunction), pathFilename, packageSettings.identifierPackage)
65
58
 
66
59
  return pathFilename
67
-
68
- def makeUnRePackDataclass(astImportFrom: ast.ImportFrom, moduleIdentifier: str = identifierModuleDataPackingDEFAULT) -> None:
69
- """Generate interface module for dataclass unpacking and repacking operations.
70
-
71
- Parameters
72
- ----------
73
- astImportFrom : ast.ImportFrom
74
- Import statement specifying the target optimized function to call.
75
-
76
- Returns
77
- -------
78
- None
79
- The generated module is written directly to the filesystem.
80
-
81
- """
82
- callableIdentifierHARDCODED: str = 'sequential'
83
-
84
- algorithmSourceModule: identifierDotAttribute = identifierModuleSourceAlgorithmDEFAULT
85
- callableIdentifier: identifierDotAttribute = callableIdentifierHARDCODED
86
- logicalPathInfix: identifierDotAttribute = logicalPathInfixDEFAULT
87
- logicalPathInfixAlgorithm: identifierDotAttribute = logicalPathInfixAlgorithmDEFAULT
88
- sourceCallableIdentifier: identifierDotAttribute = identifierCallableSourceDispatcherDEFAULT
89
-
90
- logicalPathSourceModule: identifierDotAttribute = '.'.join([packageSettings.identifierPackage, logicalPathInfixAlgorithm, algorithmSourceModule]) # noqa: FLY002
91
-
92
- ingredientsFunction: IngredientsFunction = astModuleToIngredientsFunction(parseLogicalPath2astModule(logicalPathSourceModule), sourceCallableIdentifier)
93
- ingredientsFunction.astFunctionDef.name = callableIdentifier
94
-
95
- shatteredDataclass: ShatteredDataclass = shatter_dataclassesDOTdataclass(*findDataclass(ingredientsFunction))
96
-
97
- ingredientsFunction.imports.update(shatteredDataclass.imports)
98
- ingredientsFunction.imports.addAst(astImportFrom)
99
- targetCallableIdentifier: str = astImportFrom.names[0].name
100
- ingredientsFunction = raiseIfNone(unpackDataclassCallFunctionRepackDataclass(ingredientsFunction, targetCallableIdentifier, shatteredDataclass))
101
- targetFunctionDef: ast.FunctionDef = raiseIfNone(extractFunctionDef(parseLogicalPath2astModule(raiseIfNone(astImportFrom.module)), targetCallableIdentifier))
102
- astTuple: ast.Tuple = cast('ast.Tuple', raiseIfNone(NodeTourist(Be.Return.valueIs(Be.Tuple)
103
- , doThat=Then.extractIt(DOT.value)).captureLastMatch(targetFunctionDef)))
104
- astTuple.ctx = Make.Store()
105
-
106
- changeAssignCallToTarget = NodeChanger(
107
- findThis = Be.Assign.valueIs(IfThis.isCallIdentifier(targetCallableIdentifier))
108
- , doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts))))
109
- changeAssignCallToTarget.visit(ingredientsFunction.astFunctionDef)
110
-
111
- ingredientsModule = IngredientsModule(ingredientsFunction)
112
- ingredientsModule.removeImportFromModule('numpy')
113
-
114
- pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier)
115
-
116
- write_astModule(ingredientsModule, pathFilename, packageSettings.identifierPackage)
117
-
@@ -6,17 +6,14 @@ from astToolkit import (
6
6
  from astToolkit.transformationTools import inlineFunctionDef, removeUnusedParameters, write_astModule
7
7
  from hunterMakesPy import importLogicalPath2Identifier, raiseIfNone
8
8
  from mapFolding import packageSettings
9
- from mapFolding.someAssemblyRequired import (
10
- DeReConstructField2ast, identifierCallableSourceDEFAULT, identifierCallableSourceDispatcherDEFAULT, IfThis,
11
- logicalPathInfixDEFAULT, ShatteredDataclass)
9
+ from mapFolding.someAssemblyRequired import default, DeReConstructField2ast, IfThis, ShatteredDataclass
12
10
  from mapFolding.someAssemblyRequired.makingModules_count import (
13
- makeDaoOfMapFoldingNumba, makeTheorem2, numbaOnTheorem2, trimTheorem2)
14
- from mapFolding.someAssemblyRequired.makingModules_doTheNeedful import makeInitializeState, makeUnRePackDataclass
15
- from mapFolding.someAssemblyRequired.toolkitMakeModules import getLogicalPath, getModule, getPathFilename
11
+ makeMapFoldingNumba, makeTheorem2, numbaOnTheorem2, trimTheorem2)
12
+ from mapFolding.someAssemblyRequired.makingModules_doTheNeedful import makeInitializeState
13
+ from mapFolding.someAssemblyRequired.toolkitMakeModules import getModule, getPathFilename
16
14
  from mapFolding.someAssemblyRequired.toolkitNumba import decorateCallableWithNumba, parametersNumbaLight
17
15
  from mapFolding.someAssemblyRequired.transformationTools import (
18
16
  removeDataclassFromFunction, shatter_dataclassesDOTdataclass, unpackDataclassCallFunctionRepackDataclass)
19
- from os import PathLike
20
17
  from pathlib import PurePath
21
18
  from typing import Any, TYPE_CHECKING
22
19
  import ast
@@ -25,7 +22,7 @@ import dataclasses
25
22
  if TYPE_CHECKING:
26
23
  from collections.abc import Sequence
27
24
 
28
- def makeDaoOfMapFoldingParallelNumba(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: PathLike[str] | PurePath | str | None = None, sourceCallableDispatcher: str | None = None) -> PurePath: # noqa: ARG001
25
+ def makeDaoOfMapFoldingParallelNumba(astModule: ast.Module, identifierModule: str, identifierCallable: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath: # noqa: ARG001
29
26
  """Generate parallel implementation with concurrent execution and task division.
30
27
 
31
28
  Parameters
@@ -47,11 +44,11 @@ def makeDaoOfMapFoldingParallelNumba(astModule: ast.Module, moduleIdentifier: st
47
44
  Filesystem path where the parallel module was written.
48
45
 
49
46
  """
50
- sourceCallableIdentifier = identifierCallableSourceDEFAULT
51
- if callableIdentifier is None:
52
- callableIdentifier = sourceCallableIdentifier
47
+ sourceCallableIdentifier = default['function']['counting']
48
+ if identifierCallable is None:
49
+ identifierCallable = sourceCallableIdentifier
53
50
  ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
54
- ingredientsFunction.astFunctionDef.name = callableIdentifier
51
+ ingredientsFunction.astFunctionDef.name = identifierCallable
55
52
 
56
53
  dataclassName: ast.expr = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(ingredientsFunction.astFunctionDef))
57
54
  dataclassIdentifier: str = raiseIfNone(NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName))
@@ -69,10 +66,10 @@ def makeDaoOfMapFoldingParallelNumba(astModule: ast.Module, moduleIdentifier: st
69
66
  dataclassInstanceIdentifier: identifierDotAttribute = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
70
67
  shatteredDataclass: ShatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclassIdentifier, dataclassInstanceIdentifier)
71
68
 
72
- # START add the parallel state fields to the count function ------------------------------------------------
73
- dataclassBaseFields: tuple[dataclasses.Field[Any], ...] = dataclasses.fields(importLogicalPath2Identifier(dataclassLogicalPathModule, dataclassIdentifier)) # pyright: ignore [reportArgumentType]
69
+ # START add the parallel state fields to the count function ------------------------------------------------
70
+ dataclassBaseFields: tuple[dataclasses.Field[Any], ...] = dataclasses.fields(importLogicalPath2Identifier(dataclassLogicalPathModule, dataclassIdentifier))
74
71
  dataclassIdentifierParallel: identifierDotAttribute = 'Parallel' + dataclassIdentifier
75
- dataclassFieldsParallel: tuple[dataclasses.Field[Any], ...] = dataclasses.fields(importLogicalPath2Identifier(dataclassLogicalPathModule, dataclassIdentifierParallel)) # pyright: ignore [reportArgumentType]
72
+ dataclassFieldsParallel: tuple[dataclasses.Field[Any], ...] = dataclasses.fields(importLogicalPath2Identifier(dataclassLogicalPathModule, dataclassIdentifierParallel))
76
73
  onlyParallelFields: list[dataclasses.Field[Any]] = [field for field in dataclassFieldsParallel if field.name not in [fieldBase.name for fieldBase in dataclassBaseFields]]
77
74
 
78
75
  Official_fieldOrder: list[str] = []
@@ -108,12 +105,12 @@ def makeDaoOfMapFoldingParallelNumba(astModule: ast.Module, moduleIdentifier: st
108
105
  shatteredDataclassParallel.imports.update(shatteredDataclass.imports)
109
106
  shatteredDataclassParallel.imports.removeImportFrom(dataclassLogicalPathModule, dataclassIdentifier)
110
107
 
111
- # END add the parallel state fields to the count function ------------------------------------------------
108
+ # END add the parallel state fields to the count function ------------------------------------------------
112
109
 
113
110
  ingredientsFunction.imports.update(shatteredDataclassParallel.imports)
114
111
  ingredientsFunction: IngredientsFunction = removeDataclassFromFunction(ingredientsFunction, shatteredDataclassParallel)
115
112
 
116
- # START add the parallel logic to the count function ------------------------------------------------
113
+ # START add the parallel logic to the count function ------------------------------------------------
117
114
 
118
115
  findThis = Be.While.testIs(Be.Compare.leftIs(IfThis.isNameIdentifier('leafConnectee')))
119
116
  captureCountGapsCodeBlock: NodeTourist[ast.While, Sequence[ast.stmt]] = NodeTourist(findThis, doThat = Then.extractIt(DOT.body))
@@ -127,20 +124,20 @@ def makeDaoOfMapFoldingParallelNumba(astModule: ast.Module, moduleIdentifier: st
127
124
  countGapsCodeBlockNew: list[ast.stmt] = [thisIsMyTaskIndexCodeBlock, countGapsCodeBlock[-1]]
128
125
  NodeChanger[ast.While, hasDOTbody](findThis, doThat = Grab.bodyAttribute(Then.replaceWith(countGapsCodeBlockNew))).visit(ingredientsFunction.astFunctionDef)
129
126
 
130
- # END add the parallel logic to the count function ------------------------------------------------
127
+ # END add the parallel logic to the count function ------------------------------------------------
131
128
 
132
129
  ingredientsFunction = removeUnusedParameters(ingredientsFunction)
133
130
 
134
131
  ingredientsFunction = decorateCallableWithNumba(ingredientsFunction, parametersNumbaLight)
135
132
 
136
- # START unpack/repack the dataclass function ------------------------------------------------
137
- sourceCallableIdentifier = identifierCallableSourceDispatcherDEFAULT
133
+ # START unpack/repack the dataclass function ------------------------------------------------
134
+ sourceCallableIdentifier = default['function']['dispatcher']
138
135
 
139
136
  unRepackDataclass: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableIdentifier)
140
137
  unRepackDataclass.astFunctionDef.name = 'unRepack' + dataclassIdentifierParallel
141
138
  unRepackDataclass.imports.update(shatteredDataclassParallel.imports)
142
139
  NodeChanger(
143
- findThis = Be.arg.annotationIs(Be.Name.idIs(lambda thisAttribute: thisAttribute == dataclassIdentifier)) # pyright: ignore[reportArgumentType]
140
+ findThis = Be.arg.annotationIs(Be.Name.idIs(lambda thisAttribute: thisAttribute == dataclassIdentifier))
144
141
  , doThat = Grab.annotationAttribute(Grab.idAttribute(Then.replaceWith(dataclassIdentifierParallel)))
145
142
  ).visit(unRepackDataclass.astFunctionDef)
146
143
  unRepackDataclass.astFunctionDef.returns = Make.Name(dataclassIdentifierParallel)
@@ -187,7 +184,7 @@ def makeDaoOfMapFoldingParallelNumba(astModule: ast.Module, moduleIdentifier: st
187
184
  )
188
185
  ingredientsModule.removeImportFromModule('numpy')
189
186
 
190
- pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier)
187
+ pathFilename: PurePath = getPathFilename(packageSettings.pathPackage, logicalPathInfix, identifierModule)
191
188
 
192
189
  write_astModule(ingredientsModule, pathFilename, packageSettings.identifierPackage)
193
190
 
@@ -196,25 +193,22 @@ def makeDaoOfMapFoldingParallelNumba(astModule: ast.Module, moduleIdentifier: st
196
193
  def makeMapFoldingModules() -> None:
197
194
  """Make multidimensional map folding modules."""
198
195
  astModule = getModule(logicalPathInfix='algorithms')
199
- pathFilename: PurePath = makeDaoOfMapFoldingNumba(astModule, 'daoOfMapFoldingNumba', None, logicalPathInfixDEFAULT, identifierCallableSourceDispatcherDEFAULT)
196
+ pathFilename: PurePath = makeMapFoldingNumba(astModule, 'daoOfMapFoldingNumba', None, default['logicalPath']['synthetic'], default['function']['dispatcher'])
200
197
 
201
198
  astModule = getModule(logicalPathInfix='algorithms')
202
- pathFilename = makeDaoOfMapFoldingParallelNumba(astModule, 'countParallelNumba', None, logicalPathInfixDEFAULT, identifierCallableSourceDispatcherDEFAULT)
199
+ pathFilename = makeDaoOfMapFoldingParallelNumba(astModule, 'countParallelNumba', None, default['logicalPath']['synthetic'], default['function']['dispatcher'])
203
200
 
204
201
  astModule: ast.Module = getModule(logicalPathInfix='algorithms')
205
- makeInitializeState(astModule, 'initializeState', 'transitionOnGroupsOfFolds', logicalPathInfixDEFAULT)
202
+ makeInitializeState(astModule, default['module']['initializeState'], default['function']['initializeState'], default['logicalPath']['synthetic'])
206
203
 
207
204
  astModule = getModule(logicalPathInfix='algorithms')
208
- pathFilename = makeTheorem2(astModule, 'theorem2', None, logicalPathInfixDEFAULT, None)
205
+ pathFilename = makeTheorem2(astModule, 'theorem2', None, default['logicalPath']['synthetic'], default['function']['dispatcher'])
209
206
 
210
207
  astModule = parsePathFilename2astModule(pathFilename)
211
- pathFilename = trimTheorem2(astModule, 'theorem2Trimmed', None, logicalPathInfixDEFAULT, None)
208
+ pathFilename = trimTheorem2(astModule, 'theorem2Trimmed', None, default['logicalPath']['synthetic'], default['function']['dispatcher'])
212
209
 
213
210
  astModule = parsePathFilename2astModule(pathFilename)
214
- pathFilename = numbaOnTheorem2(astModule, 'theorem2Numba', None, logicalPathInfixDEFAULT, None)
215
-
216
- astImportFrom: ast.ImportFrom = Make.ImportFrom(getLogicalPath(packageSettings.identifierPackage, logicalPathInfixDEFAULT, 'theorem2Numba'), list_alias=[Make.alias(identifierCallableSourceDEFAULT)])
217
- makeUnRePackDataclass(astImportFrom)
211
+ pathFilename = numbaOnTheorem2(astModule, 'theorem2Numba', None, default['logicalPath']['synthetic'], default['function']['dispatcher'])
218
212
 
219
213
  if __name__ == '__main__':
220
214
  makeMapFoldingModules()
@@ -3,24 +3,22 @@ from astToolkit import (
3
3
  astModuleToIngredientsFunction, Be, Grab, identifierDotAttribute, Make, NodeChanger, NodeTourist, Then)
4
4
  from hunterMakesPy import raiseIfNone
5
5
  from mapFolding import packageSettings
6
- from mapFolding.someAssemblyRequired import (
7
- identifierCallableSourceDEFAULT, identifierCallableSourceDispatcherDEFAULT, IfThis, logicalPathInfixDEFAULT)
6
+ from mapFolding.someAssemblyRequired import default, IfThis
8
7
  from mapFolding.someAssemblyRequired.toolkitMakeModules import (
9
8
  findDataclass, getModule, getPathFilename, write_astModule)
10
- from os import PathLike
11
9
  from pathlib import PurePath
12
10
  import ast
13
11
 
14
12
  identifierDataclassNumPyHARDCODED = 'MatrixMeandersNumPyState'
15
13
 
16
- logicalPathInfixMeanders: str = logicalPathInfixDEFAULT + '.meanders'
14
+ logicalPathInfixMeanders: str = default['logicalPath']['synthetic'] + '.meanders'
17
15
 
18
- def makeCountBigInt(astModule: ast.Module, moduleIdentifier: str, callableIdentifier: str | None = None, logicalPathInfix: PathLike[str] | PurePath | identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
16
+ def makeCountBigInt(astModule: ast.Module, identifierModule: str, callableIdentifier: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, sourceCallableDispatcher: str | None = None) -> PurePath:
19
17
  """Make `countBigInt` module for meanders using `MatrixMeandersNumPyState` dataclass."""
20
18
  identifierDataclassNumPy: str = identifierDataclassNumPyHARDCODED
21
19
  _logicalPathDataclass, identifierDataclassOld, identifierDataclassInstance = findDataclass(astModuleToIngredientsFunction(astModule, raiseIfNone(sourceCallableDispatcher)))
22
20
 
23
- NodeChanger(findThis=Be.FunctionDef.nameIs(IfThis.isIdentifier(identifierCallableSourceDEFAULT))
21
+ NodeChanger(findThis=Be.FunctionDef.nameIs(IfThis.isIdentifier(default['function']['counting']))
24
22
  , doThat=Grab.nameAttribute(Then.replaceWith(raiseIfNone(callableIdentifier)))
25
23
  ).visit(astModule)
26
24
 
@@ -36,29 +34,32 @@ def makeCountBigInt(astModule: ast.Module, moduleIdentifier: str, callableIdenti
36
34
  , Grab.nameAttribute(Then.replaceWith(identifierDataclassNumPy))
37
35
  ).visit(astModule)
38
36
 
39
- # while (state.kOfMatrix > 0 and areIntegersWide(state)): # noqa: ERA001
37
+ # while (state.boundary > 0 and areIntegersWide(state)): # noqa: ERA001
40
38
  Call_areIntegersWide: ast.Call = Make.Call(Make.Name('areIntegersWide'), listParameters=[Make.Name('state')])
41
39
  astCompare: ast.Compare = raiseIfNone(NodeTourist(
42
- findThis=IfThis.isAttributeNamespaceIdentifierGreaterThan0(identifierDataclassInstance, 'kOfMatrix')
40
+ findThis=IfThis.isAttributeNamespaceIdentifierGreaterThan0(identifierDataclassInstance, 'boundary')
43
41
  , doThat=Then.extractIt
44
42
  ).captureLastMatch(astModule))
45
43
  newTest: ast.expr = Make.And.join([astCompare, Call_areIntegersWide])
46
44
 
47
- NodeChanger(IfThis.isWhileAttributeNamespaceIdentifierGreaterThan0(identifierDataclassInstance, 'kOfMatrix')
45
+ NodeChanger(IfThis.isWhileAttributeNamespaceIdentifierGreaterThan0(identifierDataclassInstance, 'boundary')
48
46
  , Grab.testAttribute(Then.replaceWith(newTest))
49
47
  ).visit(astModule)
50
48
 
51
49
  # from mapFolding.algorithms.matrixMeandersBeDry import areIntegersWide # noqa: ERA001
52
50
  astModule.body.insert(0, Make.ImportFrom('mapFolding.algorithms.matrixMeandersBeDry', list_alias=[Make.alias('areIntegersWide')]))
53
51
 
54
- pathFilename = getPathFilename(logicalPathInfix=logicalPathInfix, moduleIdentifier=moduleIdentifier)
52
+ pathFilename: PurePath = getPathFilename(logicalPathInfix=logicalPathInfix, identifierModule=identifierModule)
55
53
 
56
54
  write_astModule(astModule, pathFilename, packageSettings.identifierPackage)
57
55
 
58
56
  return pathFilename
59
57
 
60
- if __name__ == '__main__':
61
- astModule = getModule(logicalPathInfix='algorithms', moduleIdentifier='matrixMeanders')
62
- pathFilename = makeCountBigInt(astModule, 'bigInt', 'countBigInt', logicalPathInfixMeanders, identifierCallableSourceDispatcherDEFAULT)
58
+ def makeMeandersModules() -> None:
59
+ """Make meanders modules."""
60
+ astModule: ast.Module = getModule(logicalPathInfix='algorithms', identifierModule='matrixMeanders')
61
+ pathFilename: PurePath = makeCountBigInt(astModule, 'bigInt', 'countBigInt', logicalPathInfixMeanders, default['function']['dispatcher'])
63
62
 
63
+ if __name__ == '__main__':
64
+ makeMeandersModules()
64
65
 
@@ -36,7 +36,7 @@ from astToolkit import (
36
36
  from autoflake import fix_code as autoflake_fix_code
37
37
  from hunterMakesPy import raiseIfNone, writeStringToHere
38
38
  from mapFolding import packageSettings
39
- from mapFolding.someAssemblyRequired import identifierModuleSourceAlgorithmDEFAULT, logicalPathInfixDEFAULT
39
+ from mapFolding.someAssemblyRequired import default
40
40
  from os import PathLike
41
41
  from pathlib import PurePath
42
42
  from typing import Any
@@ -85,32 +85,32 @@ def findDataclass(ingredientsFunction: IngredientsFunction) -> tuple[identifierD
85
85
  identifierDataclassInstance: identifierDotAttribute = raiseIfNone(NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef))
86
86
  return raiseIfNone(logicalPathDataclass), identifierDataclass, identifierDataclassInstance
87
87
 
88
- def getLogicalPath(identifierPackage: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, *moduleIdentifier: str | None) -> identifierDotAttribute:
88
+ def getLogicalPath(identifierPackage: str | None = None, logicalPathInfix: identifierDotAttribute | None = None, *identifierModule: str | None) -> identifierDotAttribute:
89
89
  """Get logical path from components."""
90
90
  listLogicalPathParts: list[str] = []
91
91
  if identifierPackage:
92
92
  listLogicalPathParts.append(identifierPackage)
93
93
  if logicalPathInfix:
94
94
  listLogicalPathParts.append(logicalPathInfix)
95
- if moduleIdentifier:
96
- listLogicalPathParts.extend([module for module in moduleIdentifier if module is not None])
95
+ if identifierModule:
96
+ listLogicalPathParts.extend([module for module in identifierModule if module is not None])
97
97
  return '.'.join(listLogicalPathParts)
98
98
 
99
- def getModule(identifierPackage: str | None = packageSettings.identifierPackage, logicalPathInfix: identifierDotAttribute | None = logicalPathInfixDEFAULT, moduleIdentifier: str | None = identifierModuleSourceAlgorithmDEFAULT) -> ast.Module:
99
+ def getModule(identifierPackage: str | None = packageSettings.identifierPackage, logicalPathInfix: identifierDotAttribute | None = default['logicalPath']['synthetic'], identifierModule: str | None = default['module']['algorithm']) -> ast.Module:
100
100
  """Get Module."""
101
- logicalPathSourceModule: identifierDotAttribute = getLogicalPath(identifierPackage, logicalPathInfix, moduleIdentifier)
101
+ logicalPathSourceModule: identifierDotAttribute = getLogicalPath(identifierPackage, logicalPathInfix, identifierModule)
102
102
  astModule: ast.Module = parseLogicalPath2astModule(logicalPathSourceModule)
103
103
  return astModule
104
104
 
105
- def getPathFilename(pathRoot: PathLike[str] | PurePath | None = packageSettings.pathPackage, logicalPathInfix: PathLike[str] | PurePath | str | None = None, moduleIdentifier: str = '', fileExtension: str = packageSettings.fileExtension) -> PurePath:
105
+ def getPathFilename(pathRoot: PathLike[str] | PurePath | None = packageSettings.pathPackage, logicalPathInfix: identifierDotAttribute | None = None, identifierModule: str = '', fileExtension: str = packageSettings.fileExtension) -> PurePath:
106
106
  """Construct filesystem path from logical path.
107
107
 
108
108
  Parameters
109
109
  ----------
110
110
  pathRoot : PathLike[str] | PurePath | None = packageSettings.pathPackage
111
111
  Base directory for the package structure.
112
- logicalPathInfix : PathLike[str] | PurePath | str | None = None
113
- Subdirectory for organizing generated modules.
112
+ logicalPathInfix : identifierDotAttribute | None = None
113
+ Logical path in dot notation.
114
114
  moduleIdentifier : str = ''
115
115
  Name of the specific module file.
116
116
  fileExtension : str = packageSettings.fileExtension
@@ -122,7 +122,7 @@ def getPathFilename(pathRoot: PathLike[str] | PurePath | None = packageSettings.
122
122
  Complete filesystem path for the generated module file.
123
123
 
124
124
  """
125
- pathFilename = PurePath(moduleIdentifier + fileExtension)
125
+ pathFilename = PurePath(identifierModule + fileExtension)
126
126
  if logicalPathInfix:
127
127
  pathFilename = PurePath(*(str(logicalPathInfix).split('.')), pathFilename)
128
128
  if pathRoot:
@@ -281,7 +281,7 @@ def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, paramete
281
281
  return ingredientsFunction
282
282
 
283
283
  @dataclasses.dataclass
284
- class SpicesJobNumba:
284
+ class SpicesJobNumba: # slots?
285
285
  """Configuration container for Numba-specific job processing options.
286
286
 
287
287
  (AI generated docstring)
@@ -34,7 +34,7 @@ from mapFolding.someAssemblyRequired import DeReConstructField2ast, IfThis, Shat
34
34
  import ast
35
35
  import dataclasses
36
36
 
37
- def shatter_dataclassesDOTdataclass(logicalPathModule: identifierDotAttribute, dataclassIdentifier: str, instanceIdentifier: str) -> ShatteredDataclass:
37
+ def shatter_dataclassesDOTdataclass(logicalPathDataclass: identifierDotAttribute, identifierDataclass: str, identifierDataclassInstance: str) -> ShatteredDataclass:
38
38
  """Decompose a dataclass definition into AST components for manipulation and code generation.
39
39
 
40
40
  (AI generated docstring)
@@ -77,19 +77,19 @@ def shatter_dataclassesDOTdataclass(logicalPathModule: identifierDotAttribute, d
77
77
  Official_fieldOrder: list[str] = []
78
78
  dictionaryDeReConstruction: dict[str, DeReConstructField2ast] = {}
79
79
 
80
- dataclassClassDef: ast.ClassDef | None = extractClassDef(parseLogicalPath2astModule(logicalPathModule), dataclassIdentifier)
80
+ dataclassClassDef: ast.ClassDef | None = extractClassDef(parseLogicalPath2astModule(logicalPathDataclass), identifierDataclass)
81
81
  if not dataclassClassDef:
82
- message = f"I could not find `{dataclassIdentifier = }` in `{logicalPathModule = }`."
82
+ message: str = f"I could not find `{identifierDataclass = }` in `{logicalPathDataclass = }`."
83
83
  raise ValueError(message)
84
84
 
85
- countingVariable = None
86
- for aField in dataclasses.fields(importLogicalPath2Identifier(logicalPathModule, dataclassIdentifier)): # pyright: ignore [reportArgumentType]
85
+ countingVariable: str | None = None
86
+ for aField in dataclasses.fields(importLogicalPath2Identifier(logicalPathDataclass, identifierDataclass)): # pyright: ignore [reportArgumentType]
87
87
  Official_fieldOrder.append(aField.name)
88
- dictionaryDeReConstruction[aField.name] = DeReConstructField2ast(logicalPathModule, dataclassClassDef, instanceIdentifier, aField)
88
+ dictionaryDeReConstruction[aField.name] = DeReConstructField2ast(logicalPathDataclass, dataclassClassDef, identifierDataclassInstance, aField)
89
89
  if aField.metadata.get('theCountingIdentifier', False):
90
90
  countingVariable = dictionaryDeReConstruction[aField.name].name
91
91
  if countingVariable is None:
92
- message = f"I could not find the counting variable in `{dataclassIdentifier = }` in `{logicalPathModule = }`."
92
+ message = f"I could not find the counting variable in `{identifierDataclass = }` in `{logicalPathDataclass = }`."
93
93
  raise ValueError(message)
94
94
 
95
95
  shatteredDataclass = ShatteredDataclass(
@@ -99,17 +99,18 @@ def shatter_dataclassesDOTdataclass(logicalPathModule: identifierDotAttribute, d
99
99
  Z0Z_field2AnnAssign={dictionaryDeReConstruction[field].name: dictionaryDeReConstruction[field].Z0Z_hack for field in Official_fieldOrder},
100
100
  list_argAnnotated4ArgumentsSpecification=[dictionaryDeReConstruction[field].ast_argAnnotated for field in Official_fieldOrder],
101
101
  list_keyword_field__field4init=[dictionaryDeReConstruction[field].ast_keyword_field__field for field in Official_fieldOrder if dictionaryDeReConstruction[field].init],
102
+ listIdentifiersStaticScalars=[dictionaryDeReConstruction[field].name for field in Official_fieldOrder if (dictionaryDeReConstruction[field].Z0Z_hack[1] == 'scalar' and not dictionaryDeReConstruction[field].init)],
102
103
  listAnnotations=[dictionaryDeReConstruction[field].astAnnotation for field in Official_fieldOrder],
103
104
  listName4Parameters=[dictionaryDeReConstruction[field].astName for field in Official_fieldOrder],
104
105
  listUnpack=[Make.AnnAssign(dictionaryDeReConstruction[field].astName, dictionaryDeReConstruction[field].astAnnotation, dictionaryDeReConstruction[field].ast_nameDOTname) for field in Official_fieldOrder],
105
106
  map_stateDOTfield2Name={dictionaryDeReConstruction[field].ast_nameDOTname: dictionaryDeReConstruction[field].astName for field in Official_fieldOrder},
106
107
  )
107
108
  shatteredDataclass.fragments4AssignmentOrParameters = Make.Tuple(shatteredDataclass.listName4Parameters, ast.Store())
108
- shatteredDataclass.repack = Make.Assign([Make.Name(instanceIdentifier)], value=Make.Call(Make.Name(dataclassIdentifier), list_keyword=shatteredDataclass.list_keyword_field__field4init))
109
+ shatteredDataclass.repack = Make.Assign([Make.Name(identifierDataclassInstance)], value=Make.Call(Make.Name(identifierDataclass), list_keyword=shatteredDataclass.list_keyword_field__field4init))
109
110
  shatteredDataclass.signatureReturnAnnotation = Make.Subscript(Make.Name('tuple'), Make.Tuple(shatteredDataclass.listAnnotations))
110
111
 
111
112
  shatteredDataclass.imports.update(*(dictionaryDeReConstruction[field].ledger for field in Official_fieldOrder))
112
- shatteredDataclass.imports.addImportFrom_asStr(logicalPathModule, dataclassIdentifier)
113
+ shatteredDataclass.imports.addImportFrom_asStr(logicalPathDataclass, identifierDataclass)
113
114
 
114
115
  return shatteredDataclass
115
116
 
@@ -145,12 +146,11 @@ def removeDataclassFromFunction(ingredientsTarget: IngredientsFunction, shattere
145
146
  """
146
147
  ingredientsTarget.astFunctionDef.args = Make.arguments(list_arg=shatteredDataclass.list_argAnnotated4ArgumentsSpecification)
147
148
  ingredientsTarget.astFunctionDef.returns = shatteredDataclass.signatureReturnAnnotation
148
- changeReturnCallable = NodeChanger(Be.Return, Then.replaceWith(Make.Return(shatteredDataclass.fragments4AssignmentOrParameters)))
149
- changeReturnCallable.visit(ingredientsTarget.astFunctionDef)
149
+ NodeChanger(Be.Return, Then.replaceWith(Make.Return(shatteredDataclass.fragments4AssignmentOrParameters))).visit(ingredientsTarget.astFunctionDef)
150
150
  ingredientsTarget.astFunctionDef = unparseFindReplace(ingredientsTarget.astFunctionDef, shatteredDataclass.map_stateDOTfield2Name)
151
151
  return ingredientsTarget
152
152
 
153
- def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFunction, targetCallableIdentifier: str, shatteredDataclass: ShatteredDataclass) -> IngredientsFunction:
153
+ def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFunction, identifierCallee: str, shatteredDataclass: ShatteredDataclass) -> IngredientsFunction:
154
154
  """Transform a caller function to interface with a dataclass-free target function.
155
155
 
156
156
  (AI generated docstring)
@@ -184,12 +184,10 @@ def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFun
184
184
  The modified caller function with appropriate unpacking and repacking around the target call.
185
185
 
186
186
  """
187
- astCallTargetCallable = Make.Call(Make.Name(targetCallableIdentifier), shatteredDataclass.listName4Parameters)
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]))
191
- replaceAssignTargetCallable.visit(ingredientsCaller.astFunctionDef)
192
- unpack4targetCallable.visit(ingredientsCaller.astFunctionDef)
193
- repack4targetCallable.visit(ingredientsCaller.astFunctionDef)
187
+ AssignAndCall: ast.Assign = Make.Assign([shatteredDataclass.fragments4AssignmentOrParameters], value=Make.Call(Make.Name(identifierCallee), shatteredDataclass.listName4Parameters))
188
+ NodeChanger(Be.Assign.valueIs(IfThis.isCallIdentifier(identifierCallee)), Then.replaceWith(AssignAndCall)).visit(ingredientsCaller.astFunctionDef)
189
+ NodeChanger(Be.Assign.valueIs(IfThis.isCallIdentifier(identifierCallee)), Then.insertThisAbove(shatteredDataclass.listUnpack)).visit(ingredientsCaller.astFunctionDef)
190
+ NodeChanger(Be.Assign.valueIs(IfThis.isCallIdentifier(identifierCallee)), Then.insertThisBelow([shatteredDataclass.repack])).visit(ingredientsCaller.astFunctionDef)
194
191
  return ingredientsCaller
195
192
 
193
+