mapFolding 0.11.2__py3-none-any.whl → 0.11.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,33 @@
1
- from collections.abc import Sequence
2
- from astToolkit import ClassIsAndAttribute, extractClassDef
3
- from mapFolding import raiseIfNoneGitHubIssueNumber3, The
4
- from mapFolding.someAssemblyRequired import (
5
- ast_Identifier,
1
+ from astToolkit import (
6
2
  astModuleToIngredientsFunction,
7
3
  Be,
4
+ ClassIsAndAttribute,
8
5
  DOT,
6
+ extractClassDef,
9
7
  extractFunctionDef,
10
8
  Grab,
11
- IfThis,
12
9
  IngredientsFunction,
13
10
  IngredientsModule,
14
- inlineFunctionDef,
15
11
  LedgerOfImports,
16
12
  Make,
17
13
  NodeChanger,
18
14
  NodeTourist,
19
15
  parseLogicalPath2astModule,
20
16
  parsePathFilename2astModule,
21
- removeUnusedParameters,
22
17
  str_nameDOTname,
23
18
  Then,
24
- write_astModule,
19
+ )
20
+ from astToolkit.transformationTools import inlineFunctionDef, removeUnusedParameters, write_astModule
21
+ from collections.abc import Sequence
22
+ from mapFolding import packageSettings
23
+ from mapFolding.someAssemblyRequired import (
25
24
  DeReConstructField2ast,
25
+ IfThis,
26
+ raiseIfNoneGitHubIssueNumber3,
26
27
  ShatteredDataclass,
28
+ sourceCallableDispatcherHARDCODED,
27
29
  )
30
+ from mapFolding.someAssemblyRequired.infoBooth import algorithmSourceModuleHARDCODED, dataPackingModuleIdentifierHARDCODED, logicalPathInfixHARDCODED, sourceCallableIdentifierHARDCODED, theCountingIdentifierHARDCODED
28
31
  from mapFolding.someAssemblyRequired.toolkitNumba import decorateCallableWithNumba, parametersNumbaLight
29
32
  from mapFolding.someAssemblyRequired.transformationTools import (
30
33
  removeDataclassFromFunction,
@@ -35,28 +38,25 @@ from pathlib import PurePath
35
38
  from Z0Z_tools import importLogicalPath2Callable
36
39
  import ast
37
40
  import dataclasses
41
+ from os import PathLike
38
42
 
39
- algorithmSourceModuleHARDCODED = 'daoOfMapFolding'
40
- sourceCallableIdentifierHARDCODED = 'count'
41
- logicalPathInfixHARDCODED: ast_Identifier = 'syntheticModules'
42
- theCountingIdentifierHARDCODED: ast_Identifier = 'groupsOfFolds'
43
- dataPackingModuleIdentifierHARDCODED: ast_Identifier = 'dataPacking'
44
-
45
- def makeInitializeGroupsOfFolds() -> None:
46
- callableIdentifierHARDCODED = 'initializeGroupsOfFolds'
47
- 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
48
52
 
53
+ def makeInitializeGroupsOfFolds(moduleIdentifier: str, callableIdentifier: str, logicalPathInfix: PathLike[str] | PurePath | str | None = None) -> None:
49
54
  algorithmSourceModule = algorithmSourceModuleHARDCODED
50
55
  sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
51
- logicalPathSourceModule = '.'.join([The.packageName, algorithmSourceModule])
52
-
53
- callableIdentifier = callableIdentifierHARDCODED
54
- logicalPathInfix = logicalPathInfixHARDCODED
55
- moduleIdentifier = moduleIdentifierHARDCODED
56
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
56
57
 
57
58
  astModule = parseLogicalPath2astModule(logicalPathSourceModule)
58
- countInitializeIngredients = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule)
59
- , LedgerOfImports(astModule))
59
+ countInitializeIngredients = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
60
60
 
61
61
  countInitializeIngredients.astFunctionDef.name = callableIdentifier
62
62
 
@@ -64,37 +64,35 @@ def makeInitializeGroupsOfFolds() -> None:
64
64
  if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
65
65
  theCountingIdentifier = theCountingIdentifierHARDCODED
66
66
 
67
- findThis = IfThis.isWhileAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
67
+ findThis = IfThis.isWhileAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
68
68
  doThat = Grab.testAttribute(Grab.andDoAllOf([ Grab.opsAttribute(Then.replaceWith([ast.Eq()])), Grab.leftAttribute(Grab.attrAttribute(Then.replaceWith(theCountingIdentifier))) ])) # type: ignore
69
69
  NodeChanger(findThis, doThat).visit(countInitializeIngredients.astFunctionDef.body[0])
70
70
 
71
71
  ingredientsModule = IngredientsModule(countInitializeIngredients)
72
72
 
73
- pathFilename = PurePath(The.pathPackage, logicalPathInfix, moduleIdentifier + The.fileExtension)
74
-
75
- write_astModule(ingredientsModule, pathFilename, The.packageName)
73
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
76
74
 
77
- def makeDaoOfMapFolding() -> PurePath:
78
- moduleIdentifierHARDCODED: ast_Identifier = 'daoOfMapFolding'
75
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
79
76
 
77
+ def makeDaoOfMapFolding(moduleIdentifier: str, callableIdentifier: str | None = None
78
+ , logicalPathInfix: PathLike[str] | PurePath | str | None = None
79
+ , sourceCallableDispatcher: str | None = None) -> PurePath:
80
80
  algorithmSourceModule = algorithmSourceModuleHARDCODED
81
81
  sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
82
- logicalPathSourceModule = '.'.join([The.packageName, algorithmSourceModule])
83
-
84
- logicalPathInfix = logicalPathInfixHARDCODED
85
- moduleIdentifier = moduleIdentifierHARDCODED
82
+ if callableIdentifier is None:
83
+ callableIdentifier = sourceCallableIdentifier
84
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
86
85
 
87
86
  astModule = parseLogicalPath2astModule(logicalPathSourceModule)
88
- daoOfMapFolding = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule)
89
- , LedgerOfImports(astModule))
87
+ ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
90
88
 
91
- 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)
92
90
  if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
93
- 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)
94
92
  if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
95
93
 
96
94
  dataclassLogicalPathModule = None
97
- for moduleWithLogicalPath, listNameTuples in daoOfMapFolding.imports.dictionaryImportFrom.items():
95
+ for moduleWithLogicalPath, listNameTuples in ingredientsFunction.imports.dictionaryImportFrom.items():
98
96
  for nameTuple in listNameTuples:
99
97
  if nameTuple[0] == dataclass_Identifier:
100
98
  dataclassLogicalPathModule = moduleWithLogicalPath
@@ -102,54 +100,50 @@ def makeDaoOfMapFolding() -> PurePath:
102
100
  if dataclassLogicalPathModule:
103
101
  break
104
102
  if dataclassLogicalPathModule is None: raise raiseIfNoneGitHubIssueNumber3
105
- dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(daoOfMapFolding.astFunctionDef)
103
+ dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
106
104
  if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
107
105
  shatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclass_Identifier, dataclassInstanceIdentifier)
108
106
 
109
- # theCountingIdentifier = theCountingIdentifierHARDCODED
110
- # doubleTheCount = Make.AugAssign(Make.Attribute(ast.Name(dataclassInstanceIdentifier), theCountingIdentifier), ast.Mult(), Make.Constant(2))
111
- # findThis = be.Return
112
- # doThat = Then.insertThisAbove([doubleTheCount])
113
- # NodeChanger(findThis, doThat).visit(daoOfMapFolding.astFunctionDef)
107
+ ingredientsFunction.imports.update(shatteredDataclass.imports)
108
+ ingredientsFunction = removeDataclassFromFunction(ingredientsFunction, shatteredDataclass)
114
109
 
115
- daoOfMapFolding.imports.update(shatteredDataclass.imports)
116
- daoOfMapFolding = removeDataclassFromFunction(daoOfMapFolding, shatteredDataclass)
110
+ ingredientsFunction = removeUnusedParameters(ingredientsFunction)
117
111
 
118
- daoOfMapFolding = removeUnusedParameters(daoOfMapFolding)
112
+ ingredientsFunction = decorateCallableWithNumba(ingredientsFunction, parametersNumbaLight)
119
113
 
120
- daoOfMapFolding = decorateCallableWithNumba(daoOfMapFolding, parametersNumbaLight)
114
+ ingredientsModule = IngredientsModule(ingredientsFunction)
121
115
 
122
- sourceCallableIdentifier = The.sourceCallableDispatcher
116
+ if sourceCallableDispatcher is not None:
123
117
 
124
- doTheNeedful: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableIdentifier)
125
- doTheNeedful.imports.update(shatteredDataclass.imports)
126
- targetCallableIdentifier = daoOfMapFolding.astFunctionDef.name
127
- doTheNeedful = unpackDataclassCallFunctionRepackDataclass(doTheNeedful, targetCallableIdentifier, shatteredDataclass)
128
- astTuple: ast.Tuple | None = NodeTourist(Be.Return, Then.extractIt(DOT.value)).captureLastMatch(daoOfMapFolding.astFunctionDef) # type: ignore
129
- if astTuple is None: raise raiseIfNoneGitHubIssueNumber3
130
- astTuple.ctx = ast.Store()
131
- ast.Return()
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()
132
125
 
133
- findThis = ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCall_Identifier(targetCallableIdentifier))
134
- doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts)))
135
- changeAssignCallToTarget = NodeChanger(findThis, doThat)
136
- changeAssignCallToTarget.visit(doTheNeedful.astFunctionDef)
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)
130
+
131
+ ingredientsModule.appendIngredientsFunction(ingredientsFunctionDispatcher)
137
132
 
138
- ingredientsModule = IngredientsModule([daoOfMapFolding, doTheNeedful])
139
133
  ingredientsModule.removeImportFromModule('numpy')
140
134
 
141
- pathFilename = PurePath(The.pathPackage, logicalPathInfix, moduleIdentifier + The.fileExtension)
135
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
142
136
 
143
- write_astModule(ingredientsModule, pathFilename, The.packageName)
137
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
144
138
 
145
139
  return pathFilename
146
140
 
147
141
  def makeDaoOfMapFoldingParallel() -> PurePath:
148
- moduleIdentifierHARDCODED: ast_Identifier = 'countParallel'
142
+ moduleIdentifierHARDCODED: str = 'countParallel'
149
143
 
150
144
  algorithmSourceModule = algorithmSourceModuleHARDCODED
151
145
  sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
152
- logicalPathSourceModule = '.'.join([The.packageName, algorithmSourceModule])
146
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
153
147
 
154
148
  logicalPathInfix = logicalPathInfixHARDCODED
155
149
  moduleIdentifier = moduleIdentifierHARDCODED
@@ -159,7 +153,7 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
159
153
 
160
154
  dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(ingredientsFunction.astFunctionDef)
161
155
  if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
162
- 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)
163
157
  if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
164
158
 
165
159
  dataclassLogicalPathModule = None
@@ -181,8 +175,8 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
181
175
  dataclassFieldsParallel = dataclasses.fields(importLogicalPath2Callable(dataclassLogicalPathModule, dataclass_IdentifierParallel)) # pyright: ignore [reportArgumentType]
182
176
  onlyParallelFields = [field for field in dataclassFieldsParallel if field.name not in [fieldBase.name for fieldBase in dataclassBaseFields]]
183
177
 
184
- Official_fieldOrder: list[ast_Identifier] = []
185
- dictionaryDeReConstruction: dict[ast_Identifier, DeReConstructField2ast] = {}
178
+ Official_fieldOrder: list[str] = []
179
+ dictionaryDeReConstruction: dict[str, DeReConstructField2ast] = {}
186
180
 
187
181
  dataclassClassDef = extractClassDef(parseLogicalPath2astModule(dataclassLogicalPathModule), dataclass_IdentifierParallel)
188
182
  if not isinstance(dataclassClassDef, ast.ClassDef): raise ValueError(f"I could not find `{dataclass_IdentifierParallel = }` in `{dataclassLogicalPathModule = }`.")
@@ -242,7 +236,7 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
242
236
  ingredientsFunction = decorateCallableWithNumba(ingredientsFunction, parametersNumbaLight)
243
237
 
244
238
  # Start unpack/repack the dataclass function ================================================
245
- sourceCallableIdentifier = The.sourceCallableDispatcher
239
+ sourceCallableIdentifier = sourceCallableDispatcherHARDCODED
246
240
 
247
241
  unRepackDataclass: IngredientsFunction = astModuleToIngredientsFunction(astModule, sourceCallableIdentifier)
248
242
  unRepackDataclass.astFunctionDef.name = 'unRepack' + dataclass_IdentifierParallel
@@ -293,58 +287,59 @@ def makeDaoOfMapFoldingParallel() -> PurePath:
293
287
  )
294
288
  ingredientsModule.removeImportFromModule('numpy')
295
289
 
296
- pathFilename = PurePath(The.pathPackage, logicalPathInfix, moduleIdentifier + The.fileExtension)
290
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
297
291
 
298
- write_astModule(ingredientsModule, pathFilename, The.packageName)
292
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
299
293
  return pathFilename
300
294
 
301
- def makeTheorem2() -> PurePath:
302
- moduleIdentifierHARDCODED: ast_Identifier = 'theorem2'
303
-
295
+ def makeTheorem2(moduleIdentifier: str, callableIdentifier: str | None = None
296
+ , logicalPathInfix: PathLike[str] | PurePath | str | None = None
297
+ , sourceCallableDispatcher: str | None = None) -> PurePath:
304
298
  algorithmSourceModule = algorithmSourceModuleHARDCODED
305
299
  sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
306
- logicalPathSourceModule = '.'.join([The.packageName, algorithmSourceModule])
307
-
308
- logicalPathInfix = logicalPathInfixHARDCODED
309
- moduleIdentifier = moduleIdentifierHARDCODED
300
+ if callableIdentifier is None:
301
+ callableIdentifier = sourceCallableIdentifier
302
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
310
303
 
311
304
  astModule = parseLogicalPath2astModule(logicalPathSourceModule)
312
- countTheorem2 = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule)
313
- , LedgerOfImports(astModule))
305
+ ingredientsFunction = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule), LedgerOfImports(astModule))
314
306
 
315
- dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(countTheorem2.astFunctionDef)
307
+ dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
316
308
  if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
317
309
 
318
- findThis = IfThis.isWhileAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
310
+ findThis = IfThis.isWhileAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
319
311
  doThat = Grab.testAttribute(Grab.comparatorsAttribute(Then.replaceWith([Make.Constant(4)]))) # type: ignore
320
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
312
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
321
313
 
322
- findThis = IfThis.isIfAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
314
+ findThis = IfThis.isIfAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
323
315
  doThat = Then.extractIt(DOT.body)
324
- insertLeaf = NodeTourist(findThis, doThat).captureLastMatch(countTheorem2.astFunctionDef)
325
- findThis = IfThis.isIfAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
316
+ insertLeaf = NodeTourist(findThis, doThat).captureLastMatch(ingredientsFunction.astFunctionDef)
317
+ findThis = IfThis.isIfAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
326
318
  doThat = Then.replaceWith(insertLeaf)
327
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
319
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
328
320
 
329
- findThis = IfThis.isAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
321
+ findThis = IfThis.isAttributeNamespaceIdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
330
322
  doThat = Then.removeIt
331
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
323
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
332
324
 
333
- findThis = IfThis.isAttributeNamespace_IdentifierLessThanOrEqual0(dataclassInstanceIdentifier, 'leaf1ndex')
325
+ findThis = IfThis.isAttributeNamespaceIdentifierLessThanOrEqual0(dataclassInstanceIdentifier, 'leaf1ndex')
334
326
  doThat = Then.removeIt
335
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
327
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
336
328
 
337
329
  theCountingIdentifier = theCountingIdentifierHARDCODED
338
330
  doubleTheCount = Make.AugAssign(Make.Attribute(ast.Name(dataclassInstanceIdentifier), theCountingIdentifier), ast.Mult(), Make.Constant(2))
339
331
  findThis = Be.Return
340
332
  doThat = Then.insertThisAbove([doubleTheCount])
341
- NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
333
+ NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
334
+
335
+ ingredientsModule = IngredientsModule(ingredientsFunction)
342
336
 
343
- ingredientsModule = IngredientsModule(countTheorem2)
337
+ if sourceCallableDispatcher is not None:
338
+ raise NotImplementedError('sourceCallableDispatcher is not implemented yet')
344
339
 
345
- pathFilename = PurePath(The.pathPackage, logicalPathInfix, moduleIdentifier + The.fileExtension)
340
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
346
341
 
347
- write_astModule(ingredientsModule, pathFilename, The.packageName)
342
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
348
343
 
349
344
  return pathFilename
350
345
 
@@ -365,11 +360,11 @@ def trimTheorem2(pathFilenameSource: PurePath) -> PurePath:
365
360
 
366
361
  pathFilename = pathFilenameSource.with_stem(pathFilenameSource.stem + 'Trimmed')
367
362
 
368
- write_astModule(ingredientsModule, pathFilename, The.packageName)
363
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
369
364
 
370
365
  logicalPath: list[str] = []
371
- if The.packageName:
372
- logicalPath.append(The.packageName)
366
+ if packageSettings.packageName:
367
+ logicalPath.append(packageSettings.packageName)
373
368
  if logicalPathInfix:
374
369
  logicalPath.append(logicalPathInfix)
375
370
  logicalPath.append(pathFilename.stem)
@@ -385,7 +380,7 @@ def numbaOnTheorem2(pathFilenameSource: PurePath) -> ast.ImportFrom:
385
380
  countNumbaTheorem2 = astModuleToIngredientsFunction(parsePathFilename2astModule(pathFilenameSource), sourceCallableIdentifier)
386
381
  dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(countNumbaTheorem2.astFunctionDef)
387
382
  if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
388
- 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)
389
384
  if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
390
385
 
391
386
  dataclassLogicalPathModule = None
@@ -413,11 +408,11 @@ def numbaOnTheorem2(pathFilenameSource: PurePath) -> ast.ImportFrom:
413
408
 
414
409
  pathFilename = pathFilenameSource.with_stem(pathFilenameSource.stem.replace('Trimmed', '') + 'Numba')
415
410
 
416
- write_astModule(ingredientsModule, pathFilename, The.packageName)
411
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
417
412
 
418
413
  logicalPath: list[str] = []
419
- if The.packageName:
420
- logicalPath.append(The.packageName)
414
+ if packageSettings.packageName:
415
+ logicalPath.append(packageSettings.packageName)
421
416
  if logicalPathInfix:
422
417
  logicalPath.append(logicalPathInfix)
423
418
  logicalPath.append(pathFilename.stem)
@@ -428,11 +423,11 @@ def numbaOnTheorem2(pathFilenameSource: PurePath) -> ast.ImportFrom:
428
423
  return astImportFrom
429
424
 
430
425
  def makeUnRePackDataclass(astImportFrom: ast.ImportFrom) -> None:
431
- callableIdentifierHARDCODED: ast_Identifier = 'sequential'
426
+ callableIdentifierHARDCODED: str = 'sequential'
432
427
 
433
428
  algorithmSourceModule = algorithmSourceModuleHARDCODED
434
- sourceCallableIdentifier = The.sourceCallableDispatcher
435
- logicalPathSourceModule = '.'.join([The.packageName, algorithmSourceModule])
429
+ sourceCallableIdentifier = sourceCallableDispatcherHARDCODED
430
+ logicalPathSourceModule = '.'.join([packageSettings.packageName, algorithmSourceModule])
436
431
 
437
432
  logicalPathInfix = logicalPathInfixHARDCODED
438
433
  moduleIdentifier = dataPackingModuleIdentifierHARDCODED
@@ -442,7 +437,7 @@ def makeUnRePackDataclass(astImportFrom: ast.ImportFrom) -> None:
442
437
  ingredientsFunction.astFunctionDef.name = callableIdentifier
443
438
  dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(ingredientsFunction.astFunctionDef)
444
439
  if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
445
- 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)
446
441
  if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
447
442
 
448
443
  dataclassLogicalPathModule = None
@@ -476,15 +471,15 @@ def makeUnRePackDataclass(astImportFrom: ast.ImportFrom) -> None:
476
471
  ingredientsModule = IngredientsModule(ingredientsFunction)
477
472
  ingredientsModule.removeImportFromModule('numpy')
478
473
 
479
- pathFilename = PurePath(The.pathPackage, logicalPathInfix, moduleIdentifier + The.fileExtension)
474
+ pathFilename = _getPathFilename(packageSettings.pathPackage, logicalPathInfix, moduleIdentifier + packageSettings.fileExtension)
480
475
 
481
- write_astModule(ingredientsModule, pathFilename, The.packageName)
476
+ write_astModule(ingredientsModule, pathFilename, packageSettings.packageName)
482
477
 
483
478
  if __name__ == '__main__':
484
- makeInitializeGroupsOfFolds()
485
- pathFilename = makeTheorem2()
479
+ makeInitializeGroupsOfFolds('initializeCount', 'initializeGroupsOfFolds', logicalPathInfixHARDCODED)
480
+ pathFilename = makeTheorem2('theorem2', None, logicalPathInfixHARDCODED)
486
481
  pathFilename = trimTheorem2(pathFilename)
487
482
  astImportFrom = numbaOnTheorem2(pathFilename)
488
483
  makeUnRePackDataclass(astImportFrom)
489
- pathFilename = makeDaoOfMapFolding()
484
+ pathFilename = makeDaoOfMapFolding('daoOfMapFolding', None, logicalPathInfixHARDCODED, sourceCallableDispatcherHARDCODED)
490
485
  makeDaoOfMapFoldingParallel()
@@ -44,41 +44,15 @@ optimizations - while maintaining the ability to verify correctness at each tran
44
44
  test suite.
45
45
  """
46
46
 
47
- from astToolkit import (
48
- ast_expr_Slice as ast_expr_Slice,
49
- ast_Identifier as ast_Identifier,
50
- astModuleToIngredientsFunction as astModuleToIngredientsFunction,
51
- Be as Be,
52
- DOT as DOT,
53
- extractClassDef as extractClassDef,
54
- extractFunctionDef as extractFunctionDef,
55
- Grab as Grab,
56
- IngredientsFunction as IngredientsFunction,
57
- IngredientsModule as IngredientsModule,
58
- LedgerOfImports as LedgerOfImports,
59
- Make as Make,
60
- NodeChanger as NodeChanger,
61
- NodeORattribute as NodeORattribute,
62
- NodeTourist as NodeTourist,
63
- parseLogicalPath2astModule as parseLogicalPath2astModule,
64
- parsePathFilename2astModule as parsePathFilename2astModule,
65
- str_nameDOTname as str_nameDOTname,
66
- Then as Then,
67
- )
68
-
69
- from Z0Z_tools import importLogicalPath2Callable as importLogicalPath2Callable, importPathFilename2Callable as importPathFilename2Callable
70
-
71
- from astToolkit.transformationTools import (
72
- inlineFunctionDef as inlineFunctionDef,
73
- removeUnusedParameters as removeUnusedParameters,
74
- unparseFindReplace as unparseFindReplace,
75
- write_astModule as write_astModule,
47
+ from mapFolding.someAssemblyRequired.infoBooth import (
48
+ dataclassInstanceIdentifierHardcoded as dataclassInstanceIdentifierHardcoded,
49
+ raiseIfNoneGitHubIssueNumber3 as raiseIfNoneGitHubIssueNumber3,
50
+ sourceCallableDispatcherHARDCODED as sourceCallableDispatcherHARDCODED,
76
51
  )
77
52
 
78
53
  from mapFolding.someAssemblyRequired._toolIfThis import IfThis as IfThis
79
54
 
80
55
  from mapFolding.someAssemblyRequired._toolkitContainers import (
81
56
  DeReConstructField2ast as DeReConstructField2ast,
82
- RecipeSynthesizeFlow as RecipeSynthesizeFlow,
83
57
  ShatteredDataclass as ShatteredDataclass,
84
58
  )
@@ -19,9 +19,8 @@ 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 IfThis as astToolkit_IfThis
22
+ from astToolkit import Be, DOT, IfThis as astToolkit_IfThis
23
23
  from collections.abc import Callable
24
- from mapFolding.someAssemblyRequired import ast_Identifier, Be, DOT
25
24
  from typing import TypeGuard
26
25
  import ast
27
26
 
@@ -37,23 +36,23 @@ class IfThis(astToolkit_IfThis):
37
36
  enabling precise targeting of AST elements for analysis or transformation.
38
37
  """
39
38
  @staticmethod
40
- 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]:
41
40
  return lambda node: (Be.Compare(node)
42
41
  and IfThis.isAttributeNamespace_Identifier(namespace, identifier)(DOT.left(node))
43
42
  and Be.Gt(node.ops[0])
44
43
  and IfThis.isConstant_value(0)(node.comparators[0]))
45
44
  @staticmethod
46
- 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]:
47
46
  return lambda node: (Be.If(node)
48
- and IfThis.isAttributeNamespace_IdentifierGreaterThan0(namespace, identifier)(DOT.test(node)))
47
+ and IfThis.isAttributeNamespaceIdentifierGreaterThan0(namespace, identifier)(DOT.test(node)))
49
48
 
50
49
  @staticmethod
51
- 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]:
52
51
  return lambda node: (Be.While(node)
53
- and IfThis.isAttributeNamespace_IdentifierGreaterThan0(namespace, identifier)(DOT.test(node)))
52
+ and IfThis.isAttributeNamespaceIdentifierGreaterThan0(namespace, identifier)(DOT.test(node)))
54
53
 
55
54
  @staticmethod
56
- 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]:
57
56
  return lambda node: (Be.Compare(node)
58
57
  and IfThis.isAttributeNamespace_Identifier(namespace, identifier)(DOT.left(node))
59
58
  and Be.LtE(node.ops[0]))