mapFolding 0.11.3__tar.gz → 0.11.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. {mapfolding-0.11.3 → mapfolding-0.11.4}/PKG-INFO +1 -1
  2. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/someAssemblyRequired/RecipeJob.py +14 -14
  3. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/someAssemblyRequired/Z0Z_makeAllModules.py +101 -108
  4. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/someAssemblyRequired/__init__.py +2 -2
  5. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/someAssemblyRequired/_toolIfThis.py +7 -7
  6. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/someAssemblyRequired/_toolkitContainers.py +8 -8
  7. mapfolding-0.11.4/mapFolding/someAssemblyRequired/infoBooth.py +20 -0
  8. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +11 -12
  9. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/someAssemblyRequired/toolkitNumba.py +3 -3
  10. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/someAssemblyRequired/transformationTools.py +4 -15
  11. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding.egg-info/PKG-INFO +1 -1
  12. {mapfolding-0.11.3 → mapfolding-0.11.4}/pyproject.toml +1 -1
  13. mapfolding-0.11.3/mapFolding/someAssemblyRequired/infoBooth.py +0 -70
  14. {mapfolding-0.11.3 → mapfolding-0.11.4}/LICENSE +0 -0
  15. {mapfolding-0.11.3 → mapfolding-0.11.4}/README.md +0 -0
  16. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/__init__.py +0 -0
  17. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/basecamp.py +0 -0
  18. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/beDRY.py +0 -0
  19. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/daoOfMapFolding.py +0 -0
  20. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/dataBaskets.py +0 -0
  21. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/datatypes.py +0 -0
  22. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/filesystemToolkit.py +0 -0
  23. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/oeis.py +0 -0
  24. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/py.typed +0 -0
  25. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/__init__.py +0 -0
  26. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/flattened.py +0 -0
  27. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/hunterNumba.py +0 -0
  28. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/irvineJavaPort.py +0 -0
  29. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/jaxCount.py +0 -0
  30. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/jobsCompleted/[2x19]/p2x19.py +0 -0
  31. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/jobsCompleted/__init__.py +0 -0
  32. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/jobsCompleted/p2x19/p2x19.py +0 -0
  33. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/lunnonNumpy.py +0 -0
  34. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/lunnonWhile.py +0 -0
  35. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/rotatedEntryPoint.py +0 -0
  36. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/reference/total_countPlus1vsPlusN.py +0 -0
  37. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/someAssemblyRequired/getLLVMforNoReason.py +0 -0
  38. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/syntheticModules/__init__.py +0 -0
  39. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/syntheticModules/countParallel.py +0 -0
  40. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/syntheticModules/daoOfMapFolding.py +0 -0
  41. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/syntheticModules/dataPacking.py +0 -0
  42. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/syntheticModules/initializeCount.py +0 -0
  43. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/syntheticModules/theorem2.py +0 -0
  44. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/syntheticModules/theorem2Numba.py +0 -0
  45. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/syntheticModules/theorem2Trimmed.py +0 -0
  46. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding/theSSOT.py +0 -0
  47. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding.egg-info/SOURCES.txt +0 -0
  48. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding.egg-info/dependency_links.txt +0 -0
  49. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding.egg-info/entry_points.txt +0 -0
  50. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding.egg-info/requires.txt +0 -0
  51. {mapfolding-0.11.3 → mapfolding-0.11.4}/mapFolding.egg-info/top_level.txt +0 -0
  52. {mapfolding-0.11.3 → mapfolding-0.11.4}/setup.cfg +0 -0
  53. {mapfolding-0.11.3 → mapfolding-0.11.4}/tests/__init__.py +0 -0
  54. {mapfolding-0.11.3 → mapfolding-0.11.4}/tests/conftest.py +0 -0
  55. {mapfolding-0.11.3 → mapfolding-0.11.4}/tests/test_computations.py +0 -0
  56. {mapfolding-0.11.3 → mapfolding-0.11.4}/tests/test_filesystem.py +0 -0
  57. {mapfolding-0.11.3 → mapfolding-0.11.4}/tests/test_oeis.py +0 -0
  58. {mapfolding-0.11.3 → mapfolding-0.11.4}/tests/test_other.py +0 -0
  59. {mapfolding-0.11.3 → mapfolding-0.11.4}/tests/test_tasks.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapFolding
3
- Version: 0.11.3
3
+ Version: 0.11.4
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
@@ -1,7 +1,7 @@
1
- from astToolkit import ast_Identifier, parseLogicalPath2astModule, str_nameDOTname
2
- from mapFolding import getPathFilenameFoldsTotal, getPathRootJobDEFAULT, MapFoldingState
1
+ from astToolkit import parseLogicalPath2astModule, str_nameDOTname
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 ShatteredDataclass, packageInformation
4
+ from mapFolding.someAssemblyRequired import dataclassInstanceIdentifierHardcoded, ShatteredDataclass
5
5
  from mapFolding.someAssemblyRequired.transformationTools import shatter_dataclassesDOTdataclass
6
6
  from pathlib import Path, PurePosixPath
7
7
  from typing import TypeAlias
@@ -17,32 +17,32 @@ class RecipeJobTheorem2Numba:
17
17
  # ========================================
18
18
  # Source
19
19
  source_astModule = parseLogicalPath2astModule('mapFolding.syntheticModules.theorem2Numba')
20
- sourceCountCallable: ast_Identifier = 'count'
20
+ sourceCountCallable: str = 'count'
21
21
 
22
22
  sourceLogicalPathModuleDataclass: str_nameDOTname = 'mapFolding.dataBaskets'
23
- sourceDataclassIdentifier: ast_Identifier = 'MapFoldingState'
24
- sourceDataclassInstance: ast_Identifier = packageInformation.dataclassInstance
23
+ sourceDataclassIdentifier: str = 'MapFoldingState'
24
+ sourceDataclassInstance: str = dataclassInstanceIdentifierHardcoded
25
25
 
26
- sourcePathPackage: PurePosixPath | None = PurePosixPath(packageInformation.pathPackage)
27
- sourcePackageIdentifier: ast_Identifier | None = packageInformation.packageName
26
+ sourcePathPackage: PurePosixPath | None = PurePosixPath(packageSettings.pathPackage)
27
+ sourcePackageIdentifier: str | None = packageSettings.packageName
28
28
 
29
29
  # ========================================
30
30
  # Filesystem (names of physical objects)
31
31
  pathPackage: PurePosixPath | None = None
32
32
  pathModule: PurePosixPath | None = PurePosixPath(getPathRootJobDEFAULT())
33
33
  """ `pathModule` will override `pathPackage` and `logicalPathRoot`."""
34
- fileExtension: str = packageInformation.fileExtension
34
+ fileExtension: str = packageSettings.fileExtension
35
35
  pathFilenameFoldsTotal: PurePosixPath = dataclasses.field(default=None, init=True) # pyright: ignore[reportAssignmentType]
36
36
 
37
37
  # ========================================
38
38
  # Logical identifiers (as opposed to physical identifiers)
39
- packageIdentifier: ast_Identifier | None = None
39
+ packageIdentifier: str | None = None
40
40
  logicalPathRoot: str_nameDOTname | None = None
41
41
  """ `logicalPathRoot` likely corresponds to a physical filesystem directory."""
42
- moduleIdentifier: ast_Identifier = dataclasses.field(default=None, init=True) # pyright: ignore[reportAssignmentType]
43
- countCallable: ast_Identifier = sourceCountCallable
44
- dataclassIdentifier: ast_Identifier | None = sourceDataclassIdentifier
45
- dataclassInstance: ast_Identifier | None = sourceDataclassInstance
42
+ moduleIdentifier: str = dataclasses.field(default=None, init=True) # pyright: ignore[reportAssignmentType]
43
+ countCallable: str = sourceCountCallable
44
+ dataclassIdentifier: str | None = sourceDataclassIdentifier
45
+ dataclassInstance: str | None = sourceDataclassInstance
46
46
  logicalPathModuleDataclass: str_nameDOTname | None = sourceLogicalPathModuleDataclass
47
47
 
48
48
  # ========================================
@@ -1,6 +1,4 @@
1
- from collections.abc import Sequence
2
1
  from astToolkit import (
3
- ast_Identifier,
4
2
  astModuleToIngredientsFunction,
5
3
  Be,
6
4
  ClassIsAndAttribute,
@@ -20,13 +18,16 @@ from astToolkit import (
20
18
  Then,
21
19
  )
22
20
  from astToolkit.transformationTools import inlineFunctionDef, removeUnusedParameters, write_astModule
21
+ from collections.abc import Sequence
22
+ from mapFolding import packageSettings
23
23
  from mapFolding.someAssemblyRequired import (
24
24
  DeReConstructField2ast,
25
25
  IfThis,
26
- packageInformation,
27
26
  raiseIfNoneGitHubIssueNumber3,
28
27
  ShatteredDataclass,
28
+ sourceCallableDispatcherHARDCODED,
29
29
  )
30
+ from mapFolding.someAssemblyRequired.infoBooth import algorithmSourceModuleHARDCODED, dataPackingModuleIdentifierHARDCODED, logicalPathInfixHARDCODED, sourceCallableIdentifierHARDCODED, theCountingIdentifierHARDCODED
30
31
  from mapFolding.someAssemblyRequired.toolkitNumba import decorateCallableWithNumba, parametersNumbaLight
31
32
  from mapFolding.someAssemblyRequired.transformationTools import (
32
33
  removeDataclassFromFunction,
@@ -37,28 +38,25 @@ from pathlib import PurePath
37
38
  from Z0Z_tools import importLogicalPath2Callable
38
39
  import ast
39
40
  import dataclasses
41
+ from os import PathLike
40
42
 
41
- algorithmSourceModuleHARDCODED = 'daoOfMapFolding'
42
- sourceCallableIdentifierHARDCODED = 'count'
43
- logicalPathInfixHARDCODED: ast_Identifier = 'syntheticModules'
44
- theCountingIdentifierHARDCODED: ast_Identifier = 'groupsOfFolds'
45
- dataPackingModuleIdentifierHARDCODED: ast_Identifier = 'dataPacking'
46
-
47
- def makeInitializeGroupsOfFolds() -> None:
48
- callableIdentifierHARDCODED = 'initializeGroupsOfFolds'
49
- moduleIdentifierHARDCODED: ast_Identifier = 'initializeCount'
43
+ def _getPathFilename(pathRoot: PathLike[str] | PurePath | None = packageSettings.pathPackage
44
+ , logicalPathInfix: PathLike[str] | PurePath | str | None = None
45
+ , moduleIdentifier: str = '', fileExtension: str = packageSettings.fileExtension) -> PurePath:
46
+ pathFilename = PurePath(moduleIdentifier + fileExtension)
47
+ if logicalPathInfix:
48
+ pathFilename = PurePath(logicalPathInfix, pathFilename)
49
+ if pathRoot:
50
+ pathFilename = PurePath(pathRoot, pathFilename)
51
+ return pathFilename
50
52
 
53
+ def makeInitializeGroupsOfFolds(moduleIdentifier: str, callableIdentifier: str, logicalPathInfix: PathLike[str] | PurePath | str | None = None) -> None:
51
54
  algorithmSourceModule = algorithmSourceModuleHARDCODED
52
55
  sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
53
- logicalPathSourceModule = '.'.join([packageInformation.packageName, algorithmSourceModule])
54
-
55
- callableIdentifier = callableIdentifierHARDCODED
56
- logicalPathInfix = logicalPathInfixHARDCODED
57
- moduleIdentifier = moduleIdentifierHARDCODED
56
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
58
57
 
59
58
  astModule = parseLogicalPath2astModule(logicalPathSourceModule)
60
- countInitializeIngredients = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule)
61
- , LedgerOfImports(astModule))
59
+ countInitializeIngredients = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
62
60
 
63
61
  countInitializeIngredients.astFunctionDef.name = callableIdentifier
64
62
 
@@ -66,37 +64,35 @@ def makeInitializeGroupsOfFolds() -> None:
66
64
  if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
67
65
  theCountingIdentifier = theCountingIdentifierHARDCODED
68
66
 
69
- findThis = IfThis.isWhileAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
67
+ findThis = IfThis.isWhileAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
70
68
  doThat = Grab.testAttribute(Grab.andDoAllOf([ Grab.opsAttribute(Then.replaceWith([ast.Eq()])), Grab.leftAttribute(Grab.attrAttribute(Then.replaceWith(theCountingIdentifier))) ])) # type: ignore
71
69
  NodeChanger(findThis, doThat).visit(countInitializeIngredients.astFunctionDef.body[0])
72
70
 
73
71
  ingredientsModule = IngredientsModule(countInitializeIngredients)
74
72
 
75
- pathFilename = PurePath(packageInformation.pathPackage, logicalPathInfix, moduleIdentifier + packageInformation.fileExtension)
76
-
77
- write_astModule(ingredientsModule, pathFilename, packageInformation.packageName)
73
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
78
74
 
79
- def makeDaoOfMapFolding() -> PurePath:
80
- moduleIdentifierHARDCODED: ast_Identifier = 'daoOfMapFolding'
75
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
81
76
 
77
+ def makeDaoOfMapFolding(moduleIdentifier: str, callableIdentifier: str | None = None
78
+ , logicalPathInfix: PathLike[str] | PurePath | str | None = None
79
+ , sourceCallableDispatcher: str | None = None) -> PurePath:
82
80
  algorithmSourceModule = algorithmSourceModuleHARDCODED
83
81
  sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
84
- logicalPathSourceModule = '.'.join([packageInformation.packageName, algorithmSourceModule])
85
-
86
- logicalPathInfix = logicalPathInfixHARDCODED
87
- moduleIdentifier = moduleIdentifierHARDCODED
82
+ if callableIdentifier is None:
83
+ callableIdentifier = sourceCallableIdentifier
84
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
88
85
 
89
86
  astModule = parseLogicalPath2astModule(logicalPathSourceModule)
90
- daoOfMapFolding = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule)
91
- , LedgerOfImports(astModule))
87
+ ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
92
88
 
93
- dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(daoOfMapFolding.astFunctionDef)
89
+ dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(ingredientsFunction.astFunctionDef)
94
90
  if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
95
- dataclass_Identifier: ast_Identifier | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
91
+ dataclass_Identifier: str | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
96
92
  if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
97
93
 
98
94
  dataclassLogicalPathModule = None
99
- for moduleWithLogicalPath, listNameTuples in daoOfMapFolding.imports.dictionaryImportFrom.items():
95
+ for moduleWithLogicalPath, listNameTuples in ingredientsFunction.imports.dictionaryImportFrom.items():
100
96
  for nameTuple in listNameTuples:
101
97
  if nameTuple[0] == dataclass_Identifier:
102
98
  dataclassLogicalPathModule = moduleWithLogicalPath
@@ -104,54 +100,50 @@ def makeDaoOfMapFolding() -> PurePath:
104
100
  if dataclassLogicalPathModule:
105
101
  break
106
102
  if dataclassLogicalPathModule is None: raise raiseIfNoneGitHubIssueNumber3
107
- dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(daoOfMapFolding.astFunctionDef)
103
+ dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
108
104
  if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
109
105
  shatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclass_Identifier, dataclassInstanceIdentifier)
110
106
 
111
- # theCountingIdentifier = theCountingIdentifierHARDCODED
112
- # doubleTheCount = Make.AugAssign(Make.Attribute(ast.Name(dataclassInstanceIdentifier), theCountingIdentifier), ast.Mult(), Make.Constant(2))
113
- # findThis = be.Return
114
- # doThat = Then.insertThisAbove([doubleTheCount])
115
- # NodeChanger(findThis, doThat).visit(daoOfMapFolding.astFunctionDef)
107
+ ingredientsFunction.imports.update(shatteredDataclass.imports)
108
+ ingredientsFunction = removeDataclassFromFunction(ingredientsFunction, shatteredDataclass)
109
+
110
+ ingredientsFunction = removeUnusedParameters(ingredientsFunction)
116
111
 
117
- daoOfMapFolding.imports.update(shatteredDataclass.imports)
118
- daoOfMapFolding = removeDataclassFromFunction(daoOfMapFolding, shatteredDataclass)
112
+ ingredientsFunction = decorateCallableWithNumba(ingredientsFunction, parametersNumbaLight)
119
113
 
120
- daoOfMapFolding = removeUnusedParameters(daoOfMapFolding)
114
+ ingredientsModule = IngredientsModule(ingredientsFunction)
121
115
 
122
- daoOfMapFolding = decorateCallableWithNumba(daoOfMapFolding, parametersNumbaLight)
116
+ if sourceCallableDispatcher is not None:
123
117
 
124
- sourceCallableIdentifier = packageInformation.sourceCallableDispatcher
118
+ ingredientsFunctionDispatcher: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableDispatcher)
119
+ ingredientsFunctionDispatcher.imports.update(shatteredDataclass.imports)
120
+ targetCallableIdentifier = ingredientsFunction.astFunctionDef.name
121
+ ingredientsFunctionDispatcher = unpackDataclassCallFunctionRepackDataclass(ingredientsFunctionDispatcher, targetCallableIdentifier, shatteredDataclass)
122
+ astTuple: ast.Tuple | None = NodeTourist(Be.Return, Then.extractIt(DOT.value)).captureLastMatch(ingredientsFunction.astFunctionDef) # type: ignore
123
+ if astTuple is None: raise raiseIfNoneGitHubIssueNumber3
124
+ astTuple.ctx = ast.Store()
125
125
 
126
- doTheNeedful: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableIdentifier)
127
- doTheNeedful.imports.update(shatteredDataclass.imports)
128
- targetCallableIdentifier = daoOfMapFolding.astFunctionDef.name
129
- doTheNeedful = unpackDataclassCallFunctionRepackDataclass(doTheNeedful, targetCallableIdentifier, shatteredDataclass)
130
- astTuple: ast.Tuple | None = NodeTourist(Be.Return, Then.extractIt(DOT.value)).captureLastMatch(daoOfMapFolding.astFunctionDef) # type: ignore
131
- if astTuple is None: raise raiseIfNoneGitHubIssueNumber3
132
- astTuple.ctx = ast.Store()
133
- ast.Return()
126
+ findThis = ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCall_Identifier(targetCallableIdentifier))
127
+ doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts)))
128
+ changeAssignCallToTarget = NodeChanger(findThis, doThat)
129
+ changeAssignCallToTarget.visit(ingredientsFunctionDispatcher.astFunctionDef)
134
130
 
135
- findThis = ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCall_Identifier(targetCallableIdentifier))
136
- doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts)))
137
- changeAssignCallToTarget = NodeChanger(findThis, doThat)
138
- changeAssignCallToTarget.visit(doTheNeedful.astFunctionDef)
131
+ ingredientsModule.appendIngredientsFunction(ingredientsFunctionDispatcher)
139
132
 
140
- ingredientsModule = IngredientsModule([daoOfMapFolding, doTheNeedful])
141
133
  ingredientsModule.removeImportFromModule('numpy')
142
134
 
143
- pathFilename = PurePath(packageInformation.pathPackage, logicalPathInfix, moduleIdentifier + packageInformation.fileExtension)
135
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
144
136
 
145
- write_astModule(ingredientsModule, pathFilename, packageInformation.packageName)
137
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
146
138
 
147
139
  return pathFilename
148
140
 
149
141
  def makeDaoOfMapFoldingParallel() -> PurePath:
150
- moduleIdentifierHARDCODED: ast_Identifier = 'countParallel'
142
+ moduleIdentifierHARDCODED: str = 'countParallel'
151
143
 
152
144
  algorithmSourceModule = algorithmSourceModuleHARDCODED
153
145
  sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
154
- logicalPathSourceModule = '.'.join([packageInformation.packageName, algorithmSourceModule])
146
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
155
147
 
156
148
  logicalPathInfix = logicalPathInfixHARDCODED
157
149
  moduleIdentifier = moduleIdentifierHARDCODED
@@ -161,7 +153,7 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
161
153
 
162
154
  dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(ingredientsFunction.astFunctionDef)
163
155
  if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
164
- dataclass_Identifier: ast_Identifier | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
156
+ dataclass_Identifier: str | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
165
157
  if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
166
158
 
167
159
  dataclassLogicalPathModule = None
@@ -183,8 +175,8 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
183
175
  dataclassFieldsParallel = dataclasses.fields(importLogicalPath2Callable(dataclassLogicalPathModule, dataclass_IdentifierParallel)) # pyright: ignore [reportArgumentType]
184
176
  onlyParallelFields = [field for field in dataclassFieldsParallel if field.name not in [fieldBase.name for fieldBase in dataclassBaseFields]]
185
177
 
186
- Official_fieldOrder: list[ast_Identifier] = []
187
- dictionaryDeReConstruction: dict[ast_Identifier, DeReConstructField2ast] = {}
178
+ Official_fieldOrder: list[str] = []
179
+ dictionaryDeReConstruction: dict[str, DeReConstructField2ast] = {}
188
180
 
189
181
  dataclassClassDef = extractClassDef(parseLogicalPath2astModule(dataclassLogicalPathModule), dataclass_IdentifierParallel)
190
182
  if not isinstance(dataclassClassDef, ast.ClassDef): raise ValueError(f"I could not find `{dataclass_IdentifierParallel = }` in `{dataclassLogicalPathModule = }`.")
@@ -244,7 +236,7 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
244
236
  ingredientsFunction = decorateCallableWithNumba(ingredientsFunction, parametersNumbaLight)
245
237
 
246
238
  # Start unpack/repack the dataclass function ================================================
247
- sourceCallableIdentifier = packageInformation.sourceCallableDispatcher
239
+ sourceCallableIdentifier = sourceCallableDispatcherHARDCODED
248
240
 
249
241
  unRepackDataclass: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableIdentifier)
250
242
  unRepackDataclass.astFunctionDef.name = 'unRepack' + dataclass_IdentifierParallel
@@ -295,58 +287,59 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
295
287
  )
296
288
  ingredientsModule.removeImportFromModule('numpy')
297
289
 
298
- pathFilename = PurePath(packageInformation.pathPackage, logicalPathInfix, moduleIdentifier + packageInformation.fileExtension)
290
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
299
291
 
300
- write_astModule(ingredientsModule, pathFilename, packageInformation.packageName)
292
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
301
293
  return pathFilename
302
294
 
303
- def makeTheorem2() -> PurePath:
304
- moduleIdentifierHARDCODED: ast_Identifier = 'theorem2'
305
-
295
+ def makeTheorem2(moduleIdentifier: str, callableIdentifier: str | None = None
296
+ , logicalPathInfix: PathLike[str] | PurePath | str | None = None
297
+ , sourceCallableDispatcher: str | None = None) -> PurePath:
306
298
  algorithmSourceModule = algorithmSourceModuleHARDCODED
307
299
  sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
308
- logicalPathSourceModule = '.'.join([packageInformation.packageName, algorithmSourceModule])
309
-
310
- logicalPathInfix = logicalPathInfixHARDCODED
311
- moduleIdentifier = moduleIdentifierHARDCODED
300
+ if callableIdentifier is None:
301
+ callableIdentifier = sourceCallableIdentifier
302
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
312
303
 
313
304
  astModule = parseLogicalPath2astModule(logicalPathSourceModule)
314
- countTheorem2 = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule)
315
- , LedgerOfImports(astModule))
305
+ ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
316
306
 
317
- dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(countTheorem2.astFunctionDef)
307
+ dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
318
308
  if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
319
309
 
320
- findThis = IfThis.isWhileAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
310
+ findThis = IfThis.isWhileAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
321
311
  doThat = Grab.testAttribute(Grab.comparatorsAttribute(Then.replaceWith([Make.Constant(4)]))) # type: ignore
322
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
312
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
323
313
 
324
- findThis = IfThis.isIfAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
314
+ findThis = IfThis.isIfAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
325
315
  doThat = Then.extractIt(DOT.body)
326
- insertLeaf = NodeTourist(findThis, doThat).captureLastMatch(countTheorem2.astFunctionDef)
327
- findThis = IfThis.isIfAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
316
+ insertLeaf = NodeTourist(findThis, doThat).captureLastMatch(ingredientsFunction.astFunctionDef)
317
+ findThis = IfThis.isIfAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
328
318
  doThat = Then.replaceWith(insertLeaf)
329
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
319
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
330
320
 
331
- findThis = IfThis.isAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
321
+ findThis = IfThis.isAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
332
322
  doThat = Then.removeIt
333
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
323
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
334
324
 
335
- findThis = IfThis.isAttributeNamespace_IdentifierLessThanOrEqual0(dataclassInstanceIdentifier, 'leaf1ndex')
325
+ findThis = IfThis.isAttributeNamespaceIdentifierLessThanOrEqual0(dataclassInstanceIdentifier, 'leaf1ndex')
336
326
  doThat = Then.removeIt
337
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
327
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
338
328
 
339
329
  theCountingIdentifier = theCountingIdentifierHARDCODED
340
330
  doubleTheCount = Make.AugAssign(Make.Attribute(ast.Name(dataclassInstanceIdentifier), theCountingIdentifier), ast.Mult(), Make.Constant(2))
341
331
  findThis = Be.Return
342
332
  doThat = Then.insertThisAbove([doubleTheCount])
343
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
333
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
334
+
335
+ ingredientsModule = IngredientsModule(ingredientsFunction)
344
336
 
345
- ingredientsModule = IngredientsModule(countTheorem2)
337
+ if sourceCallableDispatcher is not None:
338
+ raise NotImplementedError('sourceCallableDispatcher is not implemented yet')
346
339
 
347
- pathFilename = PurePath(packageInformation.pathPackage, logicalPathInfix, moduleIdentifier + packageInformation.fileExtension)
340
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
348
341
 
349
- write_astModule(ingredientsModule, pathFilename, packageInformation.packageName)
342
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
350
343
 
351
344
  return pathFilename
352
345
 
@@ -367,11 +360,11 @@ def trimTheorem2(pathFilenameSource: PurePath) -> PurePath:
367
360
 
368
361
  pathFilename = pathFilenameSource.with_stem(pathFilenameSource.stem + 'Trimmed')
369
362
 
370
- write_astModule(ingredientsModule, pathFilename, packageInformation.packageName)
363
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
371
364
 
372
365
  logicalPath: list[str] = []
373
- if packageInformation.packageName:
374
- logicalPath.append(packageInformation.packageName)
366
+ if packageSettings.packageName:
367
+ logicalPath.append(packageSettings.packageName)
375
368
  if logicalPathInfix:
376
369
  logicalPath.append(logicalPathInfix)
377
370
  logicalPath.append(pathFilename.stem)
@@ -387,7 +380,7 @@ def numbaOnTheorem2(pathFilenameSource: PurePath) -> ast.ImportFrom:
387
380
  countNumbaTheorem2 = astModuleToIngredientsFunction(parsePathFilename2astModule(pathFilenameSource), sourceCallableIdentifier)
388
381
  dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(countNumbaTheorem2.astFunctionDef)
389
382
  if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
390
- dataclass_Identifier: ast_Identifier | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
383
+ dataclass_Identifier: str | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
391
384
  if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
392
385
 
393
386
  dataclassLogicalPathModule = None
@@ -415,11 +408,11 @@ def numbaOnTheorem2(pathFilenameSource: PurePath) -> ast.ImportFrom:
415
408
 
416
409
  pathFilename = pathFilenameSource.with_stem(pathFilenameSource.stem.replace('Trimmed', '') + 'Numba')
417
410
 
418
- write_astModule(ingredientsModule, pathFilename, packageInformation.packageName)
411
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
419
412
 
420
413
  logicalPath: list[str] = []
421
- if packageInformation.packageName:
422
- logicalPath.append(packageInformation.packageName)
414
+ if packageSettings.packageName:
415
+ logicalPath.append(packageSettings.packageName)
423
416
  if logicalPathInfix:
424
417
  logicalPath.append(logicalPathInfix)
425
418
  logicalPath.append(pathFilename.stem)
@@ -430,11 +423,11 @@ def numbaOnTheorem2(pathFilenameSource: PurePath) -> ast.ImportFrom:
430
423
  return astImportFrom
431
424
 
432
425
  def makeUnRePackDataclass(astImportFrom: ast.ImportFrom) -> None:
433
- callableIdentifierHARDCODED: ast_Identifier = 'sequential'
426
+ callableIdentifierHARDCODED: str = 'sequential'
434
427
 
435
428
  algorithmSourceModule = algorithmSourceModuleHARDCODED
436
- sourceCallableIdentifier = packageInformation.sourceCallableDispatcher
437
- logicalPathSourceModule = '.'.join([packageInformation.packageName, algorithmSourceModule])
429
+ sourceCallableIdentifier = sourceCallableDispatcherHARDCODED
430
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
438
431
 
439
432
  logicalPathInfix = logicalPathInfixHARDCODED
440
433
  moduleIdentifier = dataPackingModuleIdentifierHARDCODED
@@ -444,7 +437,7 @@ def makeUnRePackDataclass(astImportFrom: ast.ImportFrom) -> None:
444
437
  ingredientsFunction.astFunctionDef.name = callableIdentifier
445
438
  dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(ingredientsFunction.astFunctionDef)
446
439
  if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
447
- dataclass_Identifier: ast_Identifier | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
440
+ dataclass_Identifier: str | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
448
441
  if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
449
442
 
450
443
  dataclassLogicalPathModule = None
@@ -478,15 +471,15 @@ def makeUnRePackDataclass(astImportFrom: ast.ImportFrom) -> None:
478
471
  ingredientsModule = IngredientsModule(ingredientsFunction)
479
472
  ingredientsModule.removeImportFromModule('numpy')
480
473
 
481
- pathFilename = PurePath(packageInformation.pathPackage, logicalPathInfix, moduleIdentifier + packageInformation.fileExtension)
474
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
482
475
 
483
- write_astModule(ingredientsModule, pathFilename, packageInformation.packageName)
476
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
484
477
 
485
478
  if __name__ == '__main__':
486
- makeInitializeGroupsOfFolds()
487
- pathFilename = makeTheorem2()
479
+ makeInitializeGroupsOfFolds('initializeCount', 'initializeGroupsOfFolds', logicalPathInfixHARDCODED)
480
+ pathFilename = makeTheorem2('theorem2', None, logicalPathInfixHARDCODED)
488
481
  pathFilename = trimTheorem2(pathFilename)
489
482
  astImportFrom = numbaOnTheorem2(pathFilename)
490
483
  makeUnRePackDataclass(astImportFrom)
491
- pathFilename = makeDaoOfMapFolding()
484
+ pathFilename = makeDaoOfMapFolding('daoOfMapFolding', None, logicalPathInfixHARDCODED, sourceCallableDispatcherHARDCODED)
492
485
  makeDaoOfMapFoldingParallel()
@@ -45,9 +45,9 @@ test suite.
45
45
  """
46
46
 
47
47
  from mapFolding.someAssemblyRequired.infoBooth import (
48
- PackageInformation as PackageInformation,
48
+ dataclassInstanceIdentifierHardcoded as dataclassInstanceIdentifierHardcoded,
49
49
  raiseIfNoneGitHubIssueNumber3 as raiseIfNoneGitHubIssueNumber3,
50
- packageInformation as packageInformation,
50
+ sourceCallableDispatcherHARDCODED as sourceCallableDispatcherHARDCODED,
51
51
  )
52
52
 
53
53
  from mapFolding.someAssemblyRequired._toolIfThis import IfThis as IfThis
@@ -19,7 +19,7 @@ they implement a declarative approach to AST manipulation that separates node id
19
19
  (be), and data access (DOT).
20
20
  """
21
21
 
22
- from astToolkit import ast_Identifier, Be, DOT, IfThis as astToolkit_IfThis
22
+ from astToolkit import Be, DOT, IfThis as astToolkit_IfThis
23
23
  from collections.abc import Callable
24
24
  from typing import TypeGuard
25
25
  import ast
@@ -36,23 +36,23 @@ class IfThis(astToolkit_IfThis):
36
36
  enabling precise targeting of AST elements for analysis or transformation.
37
37
  """
38
38
  @staticmethod
39
- def isAttributeNamespace_IdentifierGreaterThan0(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Compare] | bool]:
39
+ def isAttributeNamespaceIdentifierGreaterThan0(namespace: str, identifier: str) -> Callable[[ast.AST], TypeGuard[ast.Compare] | bool]:
40
40
  return lambda node: (Be.Compare(node)
41
41
  and IfThis.isAttributeNamespace_Identifier(namespace, identifier)(DOT.left(node))
42
42
  and Be.Gt(node.ops[0])
43
43
  and IfThis.isConstant_value(0)(node.comparators[0]))
44
44
  @staticmethod
45
- def isIfAttributeNamespace_IdentifierGreaterThan0(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.If] | bool]:
45
+ def isIfAttributeNamespaceIdentifierGreaterThan0(namespace: str, identifier: str) -> Callable[[ast.AST], TypeGuard[ast.If] | bool]:
46
46
  return lambda node: (Be.If(node)
47
- and IfThis.isAttributeNamespace_IdentifierGreaterThan0(namespace, identifier)(DOT.test(node)))
47
+ and IfThis.isAttributeNamespaceIdentifierGreaterThan0(namespace, identifier)(DOT.test(node)))
48
48
 
49
49
  @staticmethod
50
- def isWhileAttributeNamespace_IdentifierGreaterThan0(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.While] | bool]:
50
+ def isWhileAttributeNamespaceIdentifierGreaterThan0(namespace: str, identifier: str) -> Callable[[ast.AST], TypeGuard[ast.While] | bool]:
51
51
  return lambda node: (Be.While(node)
52
- and IfThis.isAttributeNamespace_IdentifierGreaterThan0(namespace, identifier)(DOT.test(node)))
52
+ and IfThis.isAttributeNamespaceIdentifierGreaterThan0(namespace, identifier)(DOT.test(node)))
53
53
 
54
54
  @staticmethod
55
- def isAttributeNamespace_IdentifierLessThanOrEqual0(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Compare] | bool]:
55
+ def isAttributeNamespaceIdentifierLessThanOrEqual0(namespace: str, identifier: str) -> Callable[[ast.AST], TypeGuard[ast.Compare] | bool]:
56
56
  return lambda node: (Be.Compare(node)
57
57
  and IfThis.isAttributeNamespace_Identifier(namespace, identifier)(DOT.left(node))
58
58
  and Be.LtE(node.ops[0]))
@@ -18,7 +18,7 @@ The containers work in conjunction with transformation tools that manipulate the
18
18
  specific optimizations and transformations.
19
19
  """
20
20
 
21
- from astToolkit import ast_Identifier, ClassIsAndAttribute, DOT, LedgerOfImports, Make, NodeTourist, str_nameDOTname, Then
21
+ from astToolkit import ClassIsAndAttribute, DOT, LedgerOfImports, Make, NodeTourist, str_nameDOTname, Then
22
22
  from collections.abc import Callable
23
23
  from copy import deepcopy
24
24
  from mapFolding.someAssemblyRequired import IfThis, raiseIfNoneGitHubIssueNumber3
@@ -38,10 +38,10 @@ class ShatteredDataclass:
38
38
  countingVariableName: ast.Name
39
39
  """AST name node representing the counting variable identifier."""
40
40
 
41
- field2AnnAssign: dict[ast_Identifier, ast.AnnAssign | ast.Assign] = dataclasses.field(default_factory=lambda: dict[ast_Identifier, ast.AnnAssign | ast.Assign]())
41
+ field2AnnAssign: dict[str, ast.AnnAssign | ast.Assign] = dataclasses.field(default_factory=lambda: dict[str, ast.AnnAssign | ast.Assign]())
42
42
  """Maps field names to their corresponding AST call expressions."""
43
43
 
44
- Z0Z_field2AnnAssign: dict[ast_Identifier, tuple[ast.AnnAssign | ast.Assign, str]] = dataclasses.field(default_factory=lambda: dict[ast_Identifier, tuple[ast.AnnAssign | ast.Assign, str]]())
44
+ Z0Z_field2AnnAssign: dict[str, tuple[ast.AnnAssign | ast.Assign, str]] = dataclasses.field(default_factory=lambda: dict[str, tuple[ast.AnnAssign | ast.Assign, str]]())
45
45
 
46
46
  fragments4AssignmentOrParameters: ast.Tuple = dummyTuple
47
47
  """AST tuple used as target for assignment to capture returned fragments."""
@@ -93,12 +93,12 @@ class DeReConstructField2ast:
93
93
  """
94
94
  dataclassesDOTdataclassLogicalPathModule: dataclasses.InitVar[str_nameDOTname]
95
95
  dataclassClassDef: dataclasses.InitVar[ast.ClassDef]
96
- dataclassesDOTdataclassInstance_Identifier: dataclasses.InitVar[ast_Identifier]
96
+ dataclassesDOTdataclassInstance_Identifier: dataclasses.InitVar[str]
97
97
  field: dataclasses.InitVar[dataclasses.Field[Any]]
98
98
 
99
99
  ledger: LedgerOfImports = dataclasses.field(default_factory=LedgerOfImports)
100
100
 
101
- name: ast_Identifier = dataclasses.field(init=False)
101
+ name: str = dataclasses.field(init=False)
102
102
  typeBuffalo: type[Any] | str | Any = dataclasses.field(init=False)
103
103
  default: Any | None = dataclasses.field(init=False)
104
104
  default_factory: Callable[..., Any] | None = dataclasses.field(init=False)
@@ -117,7 +117,7 @@ class DeReConstructField2ast:
117
117
  astAnnAssignConstructor: ast.AnnAssign|ast.Assign = dataclasses.field(init=False)
118
118
  Z0Z_hack: tuple[ast.AnnAssign|ast.Assign, str] = dataclasses.field(init=False)
119
119
 
120
- def __post_init__(self, dataclassesDOTdataclassLogicalPathModule: str_nameDOTname, dataclassClassDef: ast.ClassDef, dataclassesDOTdataclassInstance_Identifier: ast_Identifier, field: dataclasses.Field[Any]) -> None:
120
+ def __post_init__(self, dataclassesDOTdataclassLogicalPathModule: str_nameDOTname, dataclassClassDef: ast.ClassDef, dataclassesDOTdataclassInstance_Identifier: str, field: dataclasses.Field[Any]) -> None:
121
121
  self.compare = field.compare
122
122
  self.default = field.default if field.default is not dataclasses.MISSING else None
123
123
  self.default_factory = field.default_factory if field.default_factory is not dataclasses.MISSING else None
@@ -156,7 +156,7 @@ class DeReConstructField2ast:
156
156
  ast_expr = Make.Subscript(Make.Name(annotationType), Make.Tuple([axesSubscript, Make.Subscript(Make.Name('dtype'), dtype_asnameName)]))
157
157
  constructor = 'array'
158
158
  self.ledger.addImportFrom_asStr(moduleWithLogicalPath, constructor)
159
- dtypeIdentifier: ast_Identifier = dtype.__name__
159
+ dtypeIdentifier: str = dtype.__name__
160
160
  self.ledger.addImportFrom_asStr(moduleWithLogicalPath, dtypeIdentifier, dtype_asnameName.id)
161
161
  self.astAnnAssignConstructor = Make.AnnAssign(self.astName, ast_expr, Make.Call(Make.Name(constructor), list_keyword=[Make.keyword('dtype', dtype_asnameName)]))
162
162
  self.astAnnAssignConstructor = Make.Assign([self.astName], Make.Call(Make.Name(constructor), list_keyword=[Make.keyword('dtype', dtype_asnameName)]))
@@ -165,7 +165,7 @@ class DeReConstructField2ast:
165
165
  self.astAnnAssignConstructor = Make.AnnAssign(self.astName, self.astAnnotation, Make.Call(self.astAnnotation, [Make.Constant(-1)]))
166
166
  self.Z0Z_hack = (self.astAnnAssignConstructor, 'scalar')
167
167
  elif isinstance(self.astAnnotation, ast.Subscript):
168
- elementConstructor: ast_Identifier = self.metadata['elementConstructor']
168
+ elementConstructor: str = self.metadata['elementConstructor']
169
169
  self.ledger.addImportFrom_asStr(dataclassesDOTdataclassLogicalPathModule, elementConstructor)
170
170
  takeTheTuple = deepcopy(self.astAnnotation.slice)
171
171
  self.astAnnAssignConstructor = Make.AnnAssign(self.astName, self.astAnnotation, takeTheTuple)
@@ -0,0 +1,20 @@
1
+ from mapFolding import PackageSettings
2
+ import dataclasses
3
+
4
+ dataclassInstanceIdentifierHardcoded: str = 'state'
5
+ sourceCallableDispatcherHARDCODED: str = 'doTheNeedful'
6
+
7
+ class raiseIfNoneGitHubIssueNumber3(Exception): pass
8
+
9
+ dictionaryEstimates: dict[tuple[int, ...], int] = {
10
+ (2,2,2,2,2,2,2,2): 798148657152000,
11
+ (2,21): 776374224866624,
12
+ (3,15): 824761667826225,
13
+ (3,3,3,3): 85109616000000000000000000000000,
14
+ (8,8): 791274195985524900,
15
+ }
16
+ algorithmSourceModuleHARDCODED: str = 'daoOfMapFolding'
17
+ sourceCallableIdentifierHARDCODED: str = 'count'
18
+ logicalPathInfixHARDCODED: str = 'syntheticModules'
19
+ theCountingIdentifierHARDCODED: str = 'groupsOfFolds'
20
+ dataPackingModuleIdentifierHARDCODED: str = 'dataPacking'
@@ -1,7 +1,6 @@
1
- from mapFolding import getPathFilenameFoldsTotal, MapFoldingState
2
- from mapFolding.someAssemblyRequired import IfThis, packageInformation, raiseIfNoneGitHubIssueNumber3
1
+ from mapFolding import getPathFilenameFoldsTotal, MapFoldingState, packageSettings
2
+ from mapFolding.someAssemblyRequired import IfThis, raiseIfNoneGitHubIssueNumber3
3
3
  from astToolkit import (
4
- ast_Identifier,
5
4
  Be,
6
5
  ClassIsAndAttribute,
7
6
  extractFunctionDef,
@@ -69,8 +68,8 @@ if __name__ == '__main__':
69
68
  writeStream.write(str(foldsTotal))
70
69
  writeStream.close()
71
70
  """
72
- numba_progressPythonClass: ast_Identifier = 'ProgressBar'
73
- numba_progressNumbaType: ast_Identifier = 'ProgressBarType'
71
+ numba_progressPythonClass: str = 'ProgressBar'
72
+ numba_progressNumbaType: str = 'ProgressBarType'
74
73
  ingredientsModule.imports.addImportFrom_asStr('numba_progress', numba_progressPythonClass)
75
74
  ingredientsModule.imports.addImportFrom_asStr('numba_progress', numba_progressNumbaType)
76
75
 
@@ -117,11 +116,11 @@ def move_arg2FunctionDefDOTbodyAndAssignInitialValues(ingredientsFunction: Ingre
117
116
  ingredientsFunction.imports.update(job.shatteredDataclass.imports)
118
117
 
119
118
  list_argCuzMyBrainRefusesToThink = ingredientsFunction.astFunctionDef.args.args + ingredientsFunction.astFunctionDef.args.posonlyargs + ingredientsFunction.astFunctionDef.args.kwonlyargs
120
- list_arg_arg: list[ast_Identifier] = [ast_arg.arg for ast_arg in list_argCuzMyBrainRefusesToThink]
119
+ list_arg_arg: list[str] = [ast_arg.arg for ast_arg in list_argCuzMyBrainRefusesToThink]
121
120
  listName: list[ast.Name] = []
122
121
  NodeTourist(Be.Name, Then.appendTo(listName)).visit(ingredientsFunction.astFunctionDef)
123
- list_Identifiers: list[ast_Identifier] = [astName.id for astName in listName]
124
- list_IdentifiersNotUsed: list[ast_Identifier] = list(set(list_arg_arg) - set(list_Identifiers))
122
+ list_Identifiers: list[str] = [astName.id for astName in listName]
123
+ list_IdentifiersNotUsed: list[str] = list(set(list_arg_arg) - set(list_Identifiers))
125
124
 
126
125
  for ast_arg in list_argCuzMyBrainRefusesToThink:
127
126
  if ast_arg.arg in job.shatteredDataclass.field2AnnAssign:
@@ -202,9 +201,9 @@ if __name__ == '__main__':
202
201
 
203
202
  class DatatypeConfig(NamedTuple):
204
203
  Z0Z_module: str_nameDOTname
205
- fml: ast_Identifier
206
- Z0Z_type_name: ast_Identifier
207
- Z0Z_asname: ast_Identifier | None = None
204
+ fml: str
205
+ Z0Z_type_name: str
206
+ Z0Z_asname: str | None = None
208
207
 
209
208
  listDatatypeConfigs = [
210
209
  DatatypeConfig(fml='DatatypeLeavesTotal', Z0Z_module='numba', Z0Z_type_name='uint8'),
@@ -267,7 +266,7 @@ if __name__ == '__main__':
267
266
  # foldsTotalEstimated = getFoldsTotalKnown(state.mapShape) // state.leavesTotal
268
267
  # foldsTotalEstimated = dictionaryEstimates[state.mapShape] // state.leavesTotal
269
268
  foldsTotalEstimated = 0
270
- pathModule = PurePosixPath(packageInformation.pathPackage, 'jobs')
269
+ pathModule = PurePosixPath(packageSettings.pathPackage, 'jobs')
271
270
  pathFilenameFoldsTotal = PurePosixPath(getPathFilenameFoldsTotal(state.mapShape, pathModule))
272
271
  aJob = RecipeJobTheorem2Numba(state, foldsTotalEstimated, pathModule=pathModule, pathFilenameFoldsTotal=pathFilenameFoldsTotal)
273
272
  spices = SpicesJobNumba(useNumbaProgressBar=False, parametersNumba=parametersNumbaLight)
@@ -17,7 +17,7 @@ performance improvements while preserving code semantics and correctness.
17
17
 
18
18
  from collections.abc import Callable, Sequence
19
19
  from mapFolding import NotRequired, TypedDict
20
- from astToolkit import ast_Identifier, IngredientsFunction, Make, str_nameDOTname
20
+ from astToolkit import IngredientsFunction, Make, str_nameDOTname
21
21
  from astToolkit.transformationTools import write_astModule
22
22
  from numba.core.compiler import CompilerBase as numbaCompilerBase
23
23
  from typing import Any, cast, Final
@@ -53,7 +53,7 @@ parametersNumbaDefault: Final[ParametersNumba] = { '_nrt': True, 'boundscheck':
53
53
  parametersNumbaLight: Final[ParametersNumba] = {'cache': True, 'error_model': 'numpy', 'fastmath': True, 'forceinline': True}
54
54
 
55
55
  Z0Z_numbaDataTypeModule: str_nameDOTname = 'numba'
56
- Z0Z_decoratorCallable: ast_Identifier = 'jit'
56
+ Z0Z_decoratorCallable: str = 'jit'
57
57
 
58
58
  def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, parametersNumba: ParametersNumba | None = None) -> IngredientsFunction:
59
59
  def Z0Z_UnhandledDecorators(astCallable: ast.FunctionDef) -> ast.FunctionDef:
@@ -128,5 +128,5 @@ def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, paramete
128
128
  @dataclasses.dataclass
129
129
  class SpicesJobNumba:
130
130
  useNumbaProgressBar: bool = True
131
- numbaProgressBarIdentifier: ast_Identifier = 'ProgressBarGroupsOfFolds'
131
+ numbaProgressBarIdentifier: str = 'ProgressBarGroupsOfFolds'
132
132
  parametersNumba: ParametersNumba = dataclasses.field(default_factory=ParametersNumba) # type: ignore
@@ -25,7 +25,6 @@ from mapFolding.someAssemblyRequired import (
25
25
  ShatteredDataclass,
26
26
  )
27
27
  from astToolkit import(
28
- ast_Identifier,
29
28
  Be,
30
29
  extractClassDef,
31
30
  IngredientsFunction,
@@ -40,7 +39,7 @@ from Z0Z_tools import importLogicalPath2Callable
40
39
  import ast
41
40
  import dataclasses
42
41
 
43
- def shatter_dataclassesDOTdataclass(logicalPathModule: str_nameDOTname, dataclass_Identifier: ast_Identifier, instance_Identifier: ast_Identifier) -> ShatteredDataclass:
42
+ def shatter_dataclassesDOTdataclass(logicalPathModule: str_nameDOTname, dataclass_Identifier: str, instance_Identifier: str) -> ShatteredDataclass:
44
43
  """
45
44
  Decompose a dataclass definition into AST components for manipulation and code generation.
46
45
 
@@ -70,8 +69,8 @@ def shatter_dataclassesDOTdataclass(logicalPathModule: str_nameDOTname, dataclas
70
69
  Raises:
71
70
  ValueError: If the dataclass cannot be found in the specified module or if no counting variable is identified in the dataclass.
72
71
  """
73
- Official_fieldOrder: list[ast_Identifier] = []
74
- dictionaryDeReConstruction: dict[ast_Identifier, DeReConstructField2ast] = {}
72
+ Official_fieldOrder: list[str] = []
73
+ dictionaryDeReConstruction: dict[str, DeReConstructField2ast] = {}
75
74
 
76
75
  dataclassClassDef = extractClassDef(parseLogicalPath2astModule(logicalPathModule), dataclass_Identifier)
77
76
  if not isinstance(dataclassClassDef, ast.ClassDef): raise ValueError(f"I could not find `{dataclass_Identifier = }` in `{logicalPathModule = }`.")
@@ -109,8 +108,6 @@ def shatter_dataclassesDOTdataclass(logicalPathModule: str_nameDOTname, dataclas
109
108
 
110
109
  return shatteredDataclass
111
110
 
112
- # END of acceptable classes and functions ======================================================
113
-
114
111
  def removeDataclassFromFunction(ingredientsTarget: IngredientsFunction, shatteredDataclass: ShatteredDataclass) -> IngredientsFunction:
115
112
  ingredientsTarget.astFunctionDef.args = Make.arguments(args=shatteredDataclass.list_argAnnotated4ArgumentsSpecification)
116
113
  ingredientsTarget.astFunctionDef.returns = shatteredDataclass.signatureReturnAnnotation
@@ -119,7 +116,7 @@ def removeDataclassFromFunction(ingredientsTarget: IngredientsFunction, shattere
119
116
  ingredientsTarget.astFunctionDef = unparseFindReplace(ingredientsTarget.astFunctionDef, shatteredDataclass.map_stateDOTfield2Name)
120
117
  return ingredientsTarget
121
118
 
122
- def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFunction, targetCallableIdentifier: ast_Identifier, shatteredDataclass: ShatteredDataclass) -> IngredientsFunction:
119
+ def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFunction, targetCallableIdentifier: str, shatteredDataclass: ShatteredDataclass) -> IngredientsFunction:
123
120
  astCallTargetCallable = Make.Call(Make.Name(targetCallableIdentifier), shatteredDataclass.listName4Parameters)
124
121
  replaceAssignTargetCallable = NodeChanger(ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCall_Identifier(targetCallableIdentifier)), Then.replaceWith(Make.Assign([shatteredDataclass.fragments4AssignmentOrParameters], value=astCallTargetCallable)))
125
122
  unpack4targetCallable = NodeChanger(ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCall_Identifier(targetCallableIdentifier)), Then.insertThisAbove(shatteredDataclass.listUnpack))
@@ -128,11 +125,3 @@ def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFun
128
125
  unpack4targetCallable.visit(ingredientsCaller.astFunctionDef)
129
126
  repack4targetCallable.visit(ingredientsCaller.astFunctionDef)
130
127
  return ingredientsCaller
131
-
132
- dictionaryEstimates: dict[tuple[int, ...], int] = {
133
- (2,2,2,2,2,2,2,2): 798148657152000,
134
- (2,21): 776374224866624,
135
- (3,15): 824761667826225,
136
- (3,3,3,3): 85109616000000000000000000000000,
137
- (8,8): 791274195985524900,
138
- }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapFolding
3
- Version: 0.11.3
3
+ Version: 0.11.4
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
@@ -72,7 +72,7 @@ readme = { file = "README.md", content-type = "text/markdown" }
72
72
  requires-python = ">=3.10"
73
73
  scripts = { getOEISids = "mapFolding.oeis:getOEISids", clearOEIScache = "mapFolding.oeis:clearOEIScache", OEIS_for_n = "mapFolding.oeis:OEIS_for_n" }
74
74
  urls = { Donate = "https://www.patreon.com/integrated", Homepage = "https://github.com/hunterhogan/mapFolding", Repository = "https://github.com/hunterhogan/mapFolding.git", Issues = "https://github.com/hunterhogan/mapFolding/issues"}
75
- version = "0.11.3"
75
+ version = "0.11.4"
76
76
 
77
77
  [tool.coverage]
78
78
  report = { exclude_lines = [
@@ -1,70 +0,0 @@
1
- from mapFolding import PackageSettings
2
- import dataclasses
3
-
4
- @dataclasses.dataclass
5
- class PackageInformation(PackageSettings):
6
- callableDispatcher: str = 'doTheNeedful'
7
- """Name of the function within the dispatcher module that will be called."""
8
-
9
- # "Evaluate When Packaging" and "Evaluate When Installing"
10
- # https://github.com/hunterhogan/mapFolding/issues/18
11
- dataclassIdentifier: str = dataclasses.field(default='ComputationState', metadata={'evaluateWhen': 'packaging'})
12
- """Name of the dataclass used to track computation state."""
13
-
14
- dataclassInstance: str = dataclasses.field(default='state', metadata={'evaluateWhen': 'packaging'})
15
- """Default variable name for instances of the computation state dataclass."""
16
-
17
- dataclassInstanceTaskDistributionSuffix: str = dataclasses.field(default='Parallel', metadata={'evaluateWhen': 'packaging'})
18
- """Suffix added to dataclassInstance for parallel task distribution."""
19
-
20
- dataclassModule: str = dataclasses.field(default='beDRY', metadata={'evaluateWhen': 'packaging'})
21
- """Module containing the computation state dataclass definition."""
22
-
23
- datatypePackage: str = dataclasses.field(default='numpy', metadata={'evaluateWhen': 'packaging'})
24
- """Package providing the numeric data types used in computation."""
25
-
26
- sourceAlgorithm: str = dataclasses.field(default='theDao', metadata={'evaluateWhen': 'packaging'})
27
- """Module containing the reference implementation of the algorithm."""
28
-
29
- sourceCallableDispatcher: str = dataclasses.field(default='doTheNeedful', metadata={'evaluateWhen': 'packaging'})
30
- """Name of the function that dispatches computation in the source algorithm."""
31
-
32
- sourceCallableInitialize: str = dataclasses.field(default='countInitialize', metadata={'evaluateWhen': 'packaging'})
33
- """Name of the function that initializes computation in the source algorithm."""
34
-
35
- sourceCallableParallel: str = dataclasses.field(default='countParallel', metadata={'evaluateWhen': 'packaging'})
36
- """Name of the function that performs parallel computation in the source algorithm."""
37
-
38
- sourceCallableSequential: str = dataclasses.field(default='countSequential', metadata={'evaluateWhen': 'packaging'})
39
- """Name of the function that performs sequential computation in the source algorithm."""
40
-
41
- sourceConcurrencyManagerIdentifier: str = dataclasses.field(default='submit', metadata={'evaluateWhen': 'packaging'})
42
- """Method name used to submit tasks to the concurrency manager."""
43
-
44
- sourceConcurrencyManagerNamespace: str = dataclasses.field(default='concurrencyManager', metadata={'evaluateWhen': 'packaging'})
45
- """Variable name used for the concurrency manager instance."""
46
-
47
- sourceConcurrencyPackage: str = dataclasses.field(default='multiprocessing', metadata={'evaluateWhen': 'packaging'})
48
- """Default package used for concurrency in the source algorithm."""
49
-
50
- dataclassInstanceTaskDistribution: str = dataclasses.field(default=None, metadata={'evaluateWhen': 'packaging'}) # pyright: ignore[reportAssignmentType]
51
- """Variable name for the parallel distribution instance of the computation state."""
52
-
53
- logicalPathModuleDataclass: str = dataclasses.field(default=None, metadata={'evaluateWhen': 'packaging'}) # pyright: ignore[reportAssignmentType]
54
- """Fully qualified import path to the module containing the computation state dataclass."""
55
-
56
- logicalPathModuleSourceAlgorithm: str = dataclasses.field(default=None, metadata={'evaluateWhen': 'packaging'}) # pyright: ignore[reportAssignmentType]
57
- """Fully qualified import path to the module containing the source algorithm."""
58
-
59
- def __post_init__(self) -> None:
60
- if self.dataclassInstanceTaskDistribution is None: # pyright: ignore[reportUnnecessaryComparison]
61
- self.dataclassInstanceTaskDistribution = self.dataclassInstance + self.dataclassInstanceTaskDistributionSuffix
62
-
63
- if self.logicalPathModuleDataclass is None: # pyright: ignore[reportUnnecessaryComparison]
64
- self.logicalPathModuleDataclass = '.'.join([self.packageName, self.dataclassModule])
65
- if self.logicalPathModuleSourceAlgorithm is None: # pyright: ignore[reportUnnecessaryComparison]
66
- self.logicalPathModuleSourceAlgorithm = '.'.join([self.packageName, self.sourceAlgorithm])
67
-
68
- class raiseIfNoneGitHubIssueNumber3(Exception): pass
69
-
70
- packageInformation = PackageInformation()
File without changes
File without changes
File without changes