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