mapFolding 0.9.5__py3-none-any.whl → 0.10.0__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.
- mapFolding/someAssemblyRequired/Z0Z_makeSomeModules.py +43 -42
- mapFolding/someAssemblyRequired/__init__.py +12 -21
- mapFolding/someAssemblyRequired/_astTypes.py +117 -0
- mapFolding/someAssemblyRequired/_theTypes.py +4 -27
- mapFolding/someAssemblyRequired/_toolBe.py +524 -0
- mapFolding/someAssemblyRequired/_toolDOT.py +493 -0
- mapFolding/someAssemblyRequired/_toolGrab.py +653 -0
- mapFolding/someAssemblyRequired/_toolIfThis.py +193 -0
- mapFolding/someAssemblyRequired/_toolMake.py +339 -0
- mapFolding/someAssemblyRequired/_toolThen.py +63 -0
- mapFolding/someAssemblyRequired/_toolboxAST.py +3 -3
- mapFolding/someAssemblyRequired/_toolboxContainers.py +4 -4
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +9 -9
- mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +9 -9
- mapFolding/someAssemblyRequired/toolboxNumba.py +1 -1
- mapFolding/someAssemblyRequired/transformationTools.py +39 -36
- mapFolding/toolFactory/astFactory.py +493 -0
- mapFolding/toolFactory/astFactory_annex.py +63 -0
- mapFolding/toolFactory/astFactory_docstrings.py +63 -0
- {mapfolding-0.9.5.dist-info → mapfolding-0.10.0.dist-info}/METADATA +2 -1
- {mapfolding-0.9.5.dist-info → mapfolding-0.10.0.dist-info}/RECORD +25 -18
- {mapfolding-0.9.5.dist-info → mapfolding-0.10.0.dist-info}/WHEEL +1 -1
- mapFolding/someAssemblyRequired/_tool_Make.py +0 -132
- mapFolding/someAssemblyRequired/_tool_Then.py +0 -152
- mapFolding/someAssemblyRequired/_toolboxAntecedents.py +0 -404
- {mapfolding-0.9.5.dist-info → mapfolding-0.10.0.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.9.5.dist-info → mapfolding-0.10.0.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.9.5.dist-info → mapfolding-0.10.0.dist-info}/top_level.txt +0 -0
|
@@ -2,11 +2,11 @@ from mapFolding import raiseIfNoneGitHubIssueNumber3, The
|
|
|
2
2
|
from mapFolding.someAssemblyRequired import (
|
|
3
3
|
ast_Identifier,
|
|
4
4
|
astModuleToIngredientsFunction,
|
|
5
|
-
|
|
5
|
+
Be,
|
|
6
6
|
DOT,
|
|
7
7
|
extractFunctionDef,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Grab,
|
|
9
|
+
IfThis,
|
|
10
10
|
IngredientsFunction,
|
|
11
11
|
IngredientsModule,
|
|
12
12
|
LedgerOfImports,
|
|
@@ -35,7 +35,7 @@ sourceCallableIdentifierHARDCODED = 'count'
|
|
|
35
35
|
logicalPathInfixHARDCODED: ast_Identifier = 'syntheticModules'
|
|
36
36
|
theCountingIdentifierHARDCODED: ast_Identifier = 'groupsOfFolds'
|
|
37
37
|
|
|
38
|
-
def makeInitializeGroupsOfFolds():
|
|
38
|
+
def makeInitializeGroupsOfFolds() -> None:
|
|
39
39
|
callableIdentifierHARDCODED = 'initializeGroupsOfFolds'
|
|
40
40
|
moduleIdentifierHARDCODED: ast_Identifier = 'initializeCount'
|
|
41
41
|
|
|
@@ -53,14 +53,14 @@ def makeInitializeGroupsOfFolds():
|
|
|
53
53
|
|
|
54
54
|
countInitializeIngredients.astFunctionDef.name = callableIdentifier
|
|
55
55
|
|
|
56
|
-
dataclassInstanceIdentifier = NodeTourist(
|
|
56
|
+
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(countInitializeIngredients.astFunctionDef)
|
|
57
57
|
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
58
58
|
theCountingIdentifier = theCountingIdentifierHARDCODED
|
|
59
59
|
|
|
60
|
-
findThis =
|
|
61
|
-
doThat =
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
findThis = IfThis.isWhileAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
|
|
61
|
+
doThat = Grab.testAttribute(Grab.andDoAllOf([
|
|
62
|
+
Grab.opsAttribute(Then.replaceWith([ast.Eq()])), # type: ignore
|
|
63
|
+
Grab.leftAttribute(Grab.attrAttribute(Then.replaceWith(theCountingIdentifier))) # type: ignore
|
|
64
64
|
]))
|
|
65
65
|
NodeChanger(findThis, doThat).visit(countInitializeIngredients.astFunctionDef.body[0])
|
|
66
66
|
|
|
@@ -70,7 +70,7 @@ def makeInitializeGroupsOfFolds():
|
|
|
70
70
|
|
|
71
71
|
write_astModule(ingredientsModule, pathFilename, The.packageName)
|
|
72
72
|
|
|
73
|
-
def makeDaoOfMapFolding():
|
|
73
|
+
def makeDaoOfMapFolding() -> PurePath:
|
|
74
74
|
moduleIdentifierHARDCODED: ast_Identifier = 'daoOfMapFolding'
|
|
75
75
|
|
|
76
76
|
algorithmSourceModule = algorithmSourceModuleHARDCODED
|
|
@@ -84,9 +84,9 @@ def makeDaoOfMapFolding():
|
|
|
84
84
|
daoOfMapFolding = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule)
|
|
85
85
|
, LedgerOfImports(astModule))
|
|
86
86
|
|
|
87
|
-
dataclassName: ast.expr | None = NodeTourist(
|
|
87
|
+
dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(daoOfMapFolding.astFunctionDef)
|
|
88
88
|
if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
|
|
89
|
-
dataclass_Identifier: ast_Identifier | None = NodeTourist(
|
|
89
|
+
dataclass_Identifier: ast_Identifier | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
|
|
90
90
|
if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
91
91
|
|
|
92
92
|
dataclassLogicalPathModule = None
|
|
@@ -98,7 +98,7 @@ def makeDaoOfMapFolding():
|
|
|
98
98
|
if dataclassLogicalPathModule:
|
|
99
99
|
break
|
|
100
100
|
if dataclassLogicalPathModule is None: raise raiseIfNoneGitHubIssueNumber3
|
|
101
|
-
dataclassInstanceIdentifier = NodeTourist(
|
|
101
|
+
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(daoOfMapFolding.astFunctionDef)
|
|
102
102
|
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
103
103
|
shatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclass_Identifier, dataclassInstanceIdentifier)
|
|
104
104
|
|
|
@@ -121,13 +121,14 @@ def makeDaoOfMapFolding():
|
|
|
121
121
|
doTheNeedful.imports.update(shatteredDataclass.imports)
|
|
122
122
|
targetCallableIdentifier = daoOfMapFolding.astFunctionDef.name
|
|
123
123
|
doTheNeedful = unpackDataclassCallFunctionRepackDataclass(doTheNeedful, targetCallableIdentifier, shatteredDataclass)
|
|
124
|
-
astTuple: ast.Tuple | None = NodeTourist(
|
|
124
|
+
astTuple: ast.Tuple | None = NodeTourist(Be.Return, Then.extractIt(DOT.value)).captureLastMatch(daoOfMapFolding.astFunctionDef)
|
|
125
125
|
if astTuple is None: raise raiseIfNoneGitHubIssueNumber3
|
|
126
126
|
astTuple.ctx = ast.Store()
|
|
127
127
|
|
|
128
|
-
findThis =
|
|
129
|
-
doThat = Then.replaceWith(Make.Assign(
|
|
130
|
-
NodeChanger(findThis, doThat)
|
|
128
|
+
findThis = IfThis.isAssignAndValueIs(IfThis.isCall_Identifier(targetCallableIdentifier))
|
|
129
|
+
doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts)))
|
|
130
|
+
changeAssignCallToTarget = NodeChanger(findThis, doThat)
|
|
131
|
+
changeAssignCallToTarget.visit(doTheNeedful.astFunctionDef)
|
|
131
132
|
|
|
132
133
|
ingredientsModule = IngredientsModule([daoOfMapFolding, doTheNeedful])
|
|
133
134
|
ingredientsModule.removeImportFromModule('numpy')
|
|
@@ -138,7 +139,7 @@ def makeDaoOfMapFolding():
|
|
|
138
139
|
|
|
139
140
|
return pathFilename
|
|
140
141
|
|
|
141
|
-
def makeTheorem2():
|
|
142
|
+
def makeTheorem2() -> PurePath:
|
|
142
143
|
moduleIdentifierHARDCODED: ast_Identifier = 'theorem2'
|
|
143
144
|
|
|
144
145
|
algorithmSourceModule = algorithmSourceModuleHARDCODED
|
|
@@ -152,31 +153,31 @@ def makeTheorem2():
|
|
|
152
153
|
countTheorem2 = IngredientsFunction(inlineFunctionDef(sourceCallableIdentifier, astModule)
|
|
153
154
|
, LedgerOfImports(astModule))
|
|
154
155
|
|
|
155
|
-
dataclassInstanceIdentifier = NodeTourist(
|
|
156
|
+
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(countTheorem2.astFunctionDef)
|
|
156
157
|
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
157
158
|
|
|
158
|
-
findThis =
|
|
159
|
-
doThat =
|
|
159
|
+
findThis = IfThis.isWhileAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
|
|
160
|
+
doThat = Grab.testAttribute(Grab.comparatorsAttribute(Then.replaceWith([Make.Constant(4)]))) # type: ignore
|
|
160
161
|
NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
|
|
161
162
|
|
|
162
|
-
findThis =
|
|
163
|
+
findThis = IfThis.isIfAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
|
|
163
164
|
doThat = Then.extractIt(DOT.body)
|
|
164
165
|
insertLeaf = NodeTourist(findThis, doThat).captureLastMatch(countTheorem2.astFunctionDef)
|
|
165
|
-
findThis =
|
|
166
|
+
findThis = IfThis.isIfAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
|
|
166
167
|
doThat = Then.replaceWith(insertLeaf)
|
|
167
168
|
NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
|
|
168
169
|
|
|
169
|
-
findThis =
|
|
170
|
+
findThis = IfThis.isAttributeNamespace_IdentifierGreaterThan0(dataclassInstanceIdentifier, 'leaf1ndex')
|
|
170
171
|
doThat = Then.removeIt
|
|
171
172
|
NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
|
|
172
173
|
|
|
173
|
-
findThis =
|
|
174
|
+
findThis = IfThis.isAttributeNamespace_IdentifierLessThanOrEqual(dataclassInstanceIdentifier, 'leaf1ndex')
|
|
174
175
|
doThat = Then.removeIt
|
|
175
176
|
NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
|
|
176
177
|
|
|
177
178
|
theCountingIdentifier = theCountingIdentifierHARDCODED
|
|
178
179
|
doubleTheCount = Make.AugAssign(Make.Attribute(ast.Name(dataclassInstanceIdentifier), theCountingIdentifier), ast.Mult(), Make.Constant(2))
|
|
179
|
-
findThis =
|
|
180
|
+
findThis = Be.Return
|
|
180
181
|
doThat = Then.insertThisAbove([doubleTheCount])
|
|
181
182
|
NodeChanger(findThis, doThat).visit(countTheorem2.astFunctionDef)
|
|
182
183
|
|
|
@@ -188,15 +189,15 @@ def makeTheorem2():
|
|
|
188
189
|
|
|
189
190
|
return pathFilename
|
|
190
191
|
|
|
191
|
-
def trimTheorem2(pathFilenameSource: PurePath):
|
|
192
|
+
def trimTheorem2(pathFilenameSource: PurePath) -> PurePath:
|
|
192
193
|
logicalPathInfix = logicalPathInfixHARDCODED
|
|
193
194
|
sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
|
|
194
195
|
ingredientsFunction = astModuleToIngredientsFunction(parsePathFilename2astModule(pathFilenameSource), sourceCallableIdentifier)
|
|
195
196
|
|
|
196
|
-
dataclassInstanceIdentifier = NodeTourist(
|
|
197
|
+
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(ingredientsFunction.astFunctionDef)
|
|
197
198
|
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
198
199
|
|
|
199
|
-
findThis =
|
|
200
|
+
findThis = IfThis.isIfUnaryNotAttributeNamespace_Identifier(dataclassInstanceIdentifier, 'dimensionsUnconstrained')
|
|
200
201
|
doThat = Then.removeIt
|
|
201
202
|
NodeChanger(findThis, doThat).visit(ingredientsFunction.astFunctionDef)
|
|
202
203
|
|
|
@@ -215,17 +216,17 @@ def trimTheorem2(pathFilenameSource: PurePath):
|
|
|
215
216
|
logicalPath.append(pathFilename.stem)
|
|
216
217
|
moduleWithLogicalPath: str_nameDOTname = '.'.join(logicalPath)
|
|
217
218
|
|
|
218
|
-
astImportFrom: ast.ImportFrom = Make.ImportFrom(moduleWithLogicalPath,
|
|
219
|
+
astImportFrom: ast.ImportFrom = Make.ImportFrom(moduleWithLogicalPath, list_alias=[Make.alias(ingredientsFunction.astFunctionDef.name)])
|
|
219
220
|
|
|
220
221
|
return pathFilename
|
|
221
222
|
|
|
222
|
-
def numbaOnTheorem2(pathFilenameSource: PurePath):
|
|
223
|
+
def numbaOnTheorem2(pathFilenameSource: PurePath) -> ast.ImportFrom:
|
|
223
224
|
logicalPathInfix = logicalPathInfixHARDCODED
|
|
224
225
|
sourceCallableIdentifier = sourceCallableIdentifierHARDCODED
|
|
225
226
|
countNumbaTheorem2 = astModuleToIngredientsFunction(parsePathFilename2astModule(pathFilenameSource), sourceCallableIdentifier)
|
|
226
|
-
dataclassName: ast.expr | None = NodeTourist(
|
|
227
|
+
dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(countNumbaTheorem2.astFunctionDef)
|
|
227
228
|
if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
|
|
228
|
-
dataclass_Identifier: ast_Identifier | None = NodeTourist(
|
|
229
|
+
dataclass_Identifier: ast_Identifier | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
|
|
229
230
|
if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
230
231
|
|
|
231
232
|
dataclassLogicalPathModule = None
|
|
@@ -237,7 +238,7 @@ def numbaOnTheorem2(pathFilenameSource: PurePath):
|
|
|
237
238
|
if dataclassLogicalPathModule:
|
|
238
239
|
break
|
|
239
240
|
if dataclassLogicalPathModule is None: raise raiseIfNoneGitHubIssueNumber3
|
|
240
|
-
dataclassInstanceIdentifier = NodeTourist(
|
|
241
|
+
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(countNumbaTheorem2.astFunctionDef)
|
|
241
242
|
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
242
243
|
shatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclass_Identifier, dataclassInstanceIdentifier)
|
|
243
244
|
|
|
@@ -263,11 +264,11 @@ def numbaOnTheorem2(pathFilenameSource: PurePath):
|
|
|
263
264
|
logicalPath.append(pathFilename.stem)
|
|
264
265
|
moduleWithLogicalPath: str_nameDOTname = '.'.join(logicalPath)
|
|
265
266
|
|
|
266
|
-
astImportFrom: ast.ImportFrom = Make.ImportFrom(moduleWithLogicalPath,
|
|
267
|
+
astImportFrom: ast.ImportFrom = Make.ImportFrom(moduleWithLogicalPath, list_alias=[Make.alias(countNumbaTheorem2.astFunctionDef.name)])
|
|
267
268
|
|
|
268
269
|
return astImportFrom
|
|
269
270
|
|
|
270
|
-
def makeUnRePackDataclass(astImportFrom: ast.ImportFrom):
|
|
271
|
+
def makeUnRePackDataclass(astImportFrom: ast.ImportFrom) -> None:
|
|
271
272
|
moduleIdentifierHARDCODED: ast_Identifier = 'dataPacking'
|
|
272
273
|
|
|
273
274
|
algorithmSourceModule = algorithmSourceModuleHARDCODED
|
|
@@ -278,9 +279,9 @@ def makeUnRePackDataclass(astImportFrom: ast.ImportFrom):
|
|
|
278
279
|
moduleIdentifier = moduleIdentifierHARDCODED
|
|
279
280
|
|
|
280
281
|
doTheNeedful: IngredientsFunction = astModuleToIngredientsFunction(parseLogicalPath2astModule(logicalPathSourceModule), sourceCallableIdentifier)
|
|
281
|
-
dataclassName: ast.expr | None = NodeTourist(
|
|
282
|
+
dataclassName: ast.expr | None = NodeTourist(Be.arg, Then.extractIt(DOT.annotation)).captureLastMatch(doTheNeedful.astFunctionDef)
|
|
282
283
|
if dataclassName is None: raise raiseIfNoneGitHubIssueNumber3
|
|
283
|
-
dataclass_Identifier: ast_Identifier | None = NodeTourist(
|
|
284
|
+
dataclass_Identifier: ast_Identifier | None = NodeTourist(Be.Name, Then.extractIt(DOT.id)).captureLastMatch(dataclassName)
|
|
284
285
|
if dataclass_Identifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
285
286
|
|
|
286
287
|
dataclassLogicalPathModule = None
|
|
@@ -292,7 +293,7 @@ def makeUnRePackDataclass(astImportFrom: ast.ImportFrom):
|
|
|
292
293
|
if dataclassLogicalPathModule:
|
|
293
294
|
break
|
|
294
295
|
if dataclassLogicalPathModule is None: raise raiseIfNoneGitHubIssueNumber3
|
|
295
|
-
dataclassInstanceIdentifier = NodeTourist(
|
|
296
|
+
dataclassInstanceIdentifier = NodeTourist(Be.arg, Then.extractIt(DOT.arg)).captureLastMatch(doTheNeedful.astFunctionDef)
|
|
296
297
|
if dataclassInstanceIdentifier is None: raise raiseIfNoneGitHubIssueNumber3
|
|
297
298
|
shatteredDataclass = shatter_dataclassesDOTdataclass(dataclassLogicalPathModule, dataclass_Identifier, dataclassInstanceIdentifier)
|
|
298
299
|
|
|
@@ -302,12 +303,12 @@ def makeUnRePackDataclass(astImportFrom: ast.ImportFrom):
|
|
|
302
303
|
doTheNeedful = unpackDataclassCallFunctionRepackDataclass(doTheNeedful, targetCallableIdentifier, shatteredDataclass)
|
|
303
304
|
targetFunctionDef = extractFunctionDef(parseLogicalPath2astModule(astImportFrom.module), targetCallableIdentifier) # type: ignore
|
|
304
305
|
if targetFunctionDef is None: raise raiseIfNoneGitHubIssueNumber3
|
|
305
|
-
astTuple: ast.Tuple | None = NodeTourist(
|
|
306
|
+
astTuple: ast.Tuple | None = NodeTourist(Be.Return, Then.extractIt(DOT.value)).captureLastMatch(targetFunctionDef)
|
|
306
307
|
if astTuple is None: raise raiseIfNoneGitHubIssueNumber3
|
|
307
308
|
astTuple.ctx = ast.Store()
|
|
308
309
|
|
|
309
|
-
findThis =
|
|
310
|
-
doThat = Then.replaceWith(Make.Assign(
|
|
310
|
+
findThis = IfThis.isAssignAndValueIs(IfThis.isCall_Identifier(targetCallableIdentifier))
|
|
311
|
+
doThat = Then.replaceWith(Make.Assign([astTuple], value=Make.Call(Make.Name(targetCallableIdentifier), astTuple.elts)))
|
|
311
312
|
NodeChanger(findThis, doThat).visit(doTheNeedful.astFunctionDef)
|
|
312
313
|
|
|
313
314
|
ingredientsModule = IngredientsModule(doTheNeedful)
|
|
@@ -47,26 +47,13 @@ test suite.
|
|
|
47
47
|
from mapFolding.someAssemblyRequired._theTypes import (
|
|
48
48
|
ast_expr_Slice as ast_expr_Slice,
|
|
49
49
|
ast_Identifier as ast_Identifier,
|
|
50
|
-
astClassHasDOTbody as astClassHasDOTbody,
|
|
51
|
-
astClassHasDOTbody_expr as astClassHasDOTbody_expr,
|
|
52
|
-
astClassHasDOTbodyList_stmt as astClassHasDOTbodyList_stmt,
|
|
53
|
-
astClassHasDOTnameNotName as astClassHasDOTnameNotName,
|
|
54
|
-
astClassHasDOTnameNotNameAlways as astClassHasDOTnameNotNameAlways,
|
|
55
|
-
astClassHasDOTnameNotNameOptionally as astClassHasDOTnameNotNameOptionally,
|
|
56
|
-
astClassHasDOTtarget as astClassHasDOTtarget,
|
|
57
|
-
astClassHasDOTtarget_expr as astClassHasDOTtarget_expr,
|
|
58
|
-
astClassHasDOTtargetAttributeNameSubscript as astClassHasDOTtargetAttributeNameSubscript,
|
|
59
|
-
astClassHasDOTvalue as astClassHasDOTvalue,
|
|
60
|
-
astClassHasDOTvalue_expr as astClassHasDOTvalue_expr,
|
|
61
|
-
astClassHasDOTvalue_exprNone as astClassHasDOTvalue_exprNone,
|
|
62
50
|
ImaCallToName as ImaCallToName,
|
|
63
|
-
intORlist_ast_type_paramORstr_orNone as intORlist_ast_type_paramORstr_orNone,
|
|
64
|
-
intORstr_orNone as intORstr_orNone,
|
|
65
|
-
list_ast_type_paramORstr_orNone as list_ast_type_paramORstr_orNone,
|
|
66
51
|
NodeORattribute as NodeORattribute,
|
|
67
52
|
str_nameDOTname as str_nameDOTname,
|
|
68
53
|
个 as 个,
|
|
69
|
-
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
from mapFolding.someAssemblyRequired._astTypes import * # noqa: F403
|
|
70
57
|
|
|
71
58
|
from mapFolding.someAssemblyRequired._toolboxPython import (
|
|
72
59
|
importLogicalPath2Callable as importLogicalPath2Callable,
|
|
@@ -75,11 +62,15 @@ from mapFolding.someAssemblyRequired._toolboxPython import (
|
|
|
75
62
|
NodeTourist as NodeTourist,
|
|
76
63
|
parseLogicalPath2astModule as parseLogicalPath2astModule,
|
|
77
64
|
parsePathFilename2astModule as parsePathFilename2astModule,
|
|
78
|
-
|
|
65
|
+
)
|
|
79
66
|
|
|
80
|
-
from mapFolding.someAssemblyRequired.
|
|
81
|
-
from mapFolding.someAssemblyRequired.
|
|
82
|
-
from mapFolding.someAssemblyRequired.
|
|
67
|
+
from mapFolding.someAssemblyRequired._toolBe import Be as Be
|
|
68
|
+
from mapFolding.someAssemblyRequired._toolDOT import DOT as DOT
|
|
69
|
+
from mapFolding.someAssemblyRequired._toolGrab import Grab as Grab
|
|
70
|
+
from mapFolding.someAssemblyRequired._toolMake import Make as Make
|
|
71
|
+
|
|
72
|
+
from mapFolding.someAssemblyRequired._toolIfThis import IfThis as IfThis
|
|
73
|
+
from mapFolding.someAssemblyRequired._toolThen import Then as Then
|
|
83
74
|
|
|
84
75
|
from mapFolding.someAssemblyRequired._toolboxContainers import (
|
|
85
76
|
DeReConstructField2ast as DeReConstructField2ast,
|
|
@@ -94,4 +85,4 @@ from mapFolding.someAssemblyRequired._toolboxAST import (
|
|
|
94
85
|
astModuleToIngredientsFunction as astModuleToIngredientsFunction,
|
|
95
86
|
extractClassDef as extractClassDef,
|
|
96
87
|
extractFunctionDef as extractFunctionDef,
|
|
97
|
-
|
|
88
|
+
)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""This file is generated automatically, so changes to this file will be lost."""
|
|
2
|
+
from mapFolding import astDOTParamSpec, astDOTTryStar, astDOTTypeAlias, astDOTTypeVar, astDOTTypeVarTuple, astDOTtype_param
|
|
3
|
+
from typing import Any, TypeAlias as typing_TypeAlias
|
|
4
|
+
import ast
|
|
5
|
+
intORstr: typing_TypeAlias = Any
|
|
6
|
+
intORstrORtype_params: typing_TypeAlias = Any
|
|
7
|
+
intORtype_params: typing_TypeAlias = Any
|
|
8
|
+
hasDOTannotation_expr: typing_TypeAlias = ast.AnnAssign
|
|
9
|
+
hasDOTannotation_exprOrNone: typing_TypeAlias = ast.arg
|
|
10
|
+
hasDOTannotation: typing_TypeAlias = hasDOTannotation_expr | hasDOTannotation_exprOrNone
|
|
11
|
+
hasDOTarg_Identifier: typing_TypeAlias = ast.arg
|
|
12
|
+
hasDOTarg_IdentifierOrNone: typing_TypeAlias = ast.keyword
|
|
13
|
+
hasDOTarg: typing_TypeAlias = hasDOTarg_Identifier | hasDOTarg_IdentifierOrNone
|
|
14
|
+
hasDOTargs_arguments: typing_TypeAlias = ast.FunctionDef | ast.AsyncFunctionDef | ast.Lambda
|
|
15
|
+
hasDOTargs_list_expr: typing_TypeAlias = ast.Call
|
|
16
|
+
hasDOTargs_list_arg: typing_TypeAlias = ast.arguments
|
|
17
|
+
hasDOTargs: typing_TypeAlias = hasDOTargs_arguments | hasDOTargs_list_expr | hasDOTargs_list_arg
|
|
18
|
+
hasDOTargtypes: typing_TypeAlias = ast.FunctionType
|
|
19
|
+
hasDOTasname: typing_TypeAlias = ast.alias
|
|
20
|
+
hasDOTattr: typing_TypeAlias = ast.Attribute
|
|
21
|
+
hasDOTbases: typing_TypeAlias = ast.ClassDef
|
|
22
|
+
hasDOTbody_list_stmt: typing_TypeAlias = ast.Module | ast.Interactive | ast.FunctionDef | ast.AsyncFunctionDef | ast.ClassDef | ast.For | ast.AsyncFor | ast.While | ast.If | ast.With | ast.AsyncWith | ast.Try | ast.ExceptHandler | astDOTTryStar | ast.match_case
|
|
23
|
+
hasDOTbody_expr: typing_TypeAlias = ast.Expression | ast.Lambda | ast.IfExp
|
|
24
|
+
hasDOTbody: typing_TypeAlias = hasDOTbody_list_stmt | hasDOTbody_expr
|
|
25
|
+
hasDOTbound: typing_TypeAlias = astDOTTypeVar
|
|
26
|
+
hasDOTcases: typing_TypeAlias = ast.Match
|
|
27
|
+
hasDOTcause: typing_TypeAlias = ast.Raise
|
|
28
|
+
hasDOTcls: typing_TypeAlias = ast.MatchClass
|
|
29
|
+
hasDOTcomparators: typing_TypeAlias = ast.Compare
|
|
30
|
+
hasDOTcontext_expr: typing_TypeAlias = ast.withitem
|
|
31
|
+
hasDOTconversion: typing_TypeAlias = ast.FormattedValue
|
|
32
|
+
hasDOTctx: typing_TypeAlias = ast.Attribute | ast.Subscript | ast.Starred | ast.Name | ast.List | ast.Tuple
|
|
33
|
+
hasDOTdecorator_list: typing_TypeAlias = ast.FunctionDef | ast.AsyncFunctionDef | ast.ClassDef
|
|
34
|
+
hasDOTdefault_value: typing_TypeAlias = astDOTTypeVar | astDOTParamSpec | astDOTTypeVarTuple
|
|
35
|
+
hasDOTdefaults: typing_TypeAlias = ast.arguments
|
|
36
|
+
hasDOTelt: typing_TypeAlias = ast.ListComp | ast.SetComp | ast.GeneratorExp
|
|
37
|
+
hasDOTelts: typing_TypeAlias = ast.Set | ast.List | ast.Tuple
|
|
38
|
+
hasDOTexc: typing_TypeAlias = ast.Raise
|
|
39
|
+
hasDOTfinalbody: typing_TypeAlias = ast.Try | astDOTTryStar
|
|
40
|
+
hasDOTformat_spec: typing_TypeAlias = ast.FormattedValue
|
|
41
|
+
hasDOTfunc: typing_TypeAlias = ast.Call
|
|
42
|
+
hasDOTgenerators: typing_TypeAlias = ast.ListComp | ast.SetComp | ast.DictComp | ast.GeneratorExp
|
|
43
|
+
hasDOTguard: typing_TypeAlias = ast.match_case
|
|
44
|
+
hasDOThandlers: typing_TypeAlias = ast.Try | astDOTTryStar
|
|
45
|
+
hasDOTid: typing_TypeAlias = ast.Name
|
|
46
|
+
hasDOTifs: typing_TypeAlias = ast.comprehension
|
|
47
|
+
hasDOTis_async: typing_TypeAlias = ast.comprehension
|
|
48
|
+
hasDOTitems: typing_TypeAlias = ast.With | ast.AsyncWith
|
|
49
|
+
hasDOTiter: typing_TypeAlias = ast.For | ast.AsyncFor | ast.comprehension
|
|
50
|
+
hasDOTkey: typing_TypeAlias = ast.DictComp
|
|
51
|
+
hasDOTkeys_list_exprOrNone: typing_TypeAlias = ast.Dict
|
|
52
|
+
hasDOTkeys_list_expr: typing_TypeAlias = ast.MatchMapping
|
|
53
|
+
hasDOTkeys: typing_TypeAlias = hasDOTkeys_list_exprOrNone | hasDOTkeys_list_expr
|
|
54
|
+
hasDOTkeywords: typing_TypeAlias = ast.ClassDef | ast.Call
|
|
55
|
+
hasDOTkind: typing_TypeAlias = ast.Constant
|
|
56
|
+
hasDOTkw_defaults: typing_TypeAlias = ast.arguments
|
|
57
|
+
hasDOTkwarg: typing_TypeAlias = ast.arguments
|
|
58
|
+
hasDOTkwd_attrs: typing_TypeAlias = ast.MatchClass
|
|
59
|
+
hasDOTkwd_patterns: typing_TypeAlias = ast.MatchClass
|
|
60
|
+
hasDOTkwonlyargs: typing_TypeAlias = ast.arguments
|
|
61
|
+
hasDOTleft: typing_TypeAlias = ast.BinOp | ast.Compare
|
|
62
|
+
hasDOTlevel: typing_TypeAlias = ast.ImportFrom
|
|
63
|
+
hasDOTlineno: typing_TypeAlias = ast.TypeIgnore
|
|
64
|
+
hasDOTlower: typing_TypeAlias = ast.Slice
|
|
65
|
+
hasDOTmodule: typing_TypeAlias = ast.ImportFrom
|
|
66
|
+
hasDOTmsg: typing_TypeAlias = ast.Assert
|
|
67
|
+
hasDOTname_Identifier: typing_TypeAlias = ast.FunctionDef | ast.AsyncFunctionDef | ast.ClassDef | astDOTTypeVar | astDOTParamSpec | astDOTTypeVarTuple
|
|
68
|
+
hasDOTname_IdentifierOrNone: typing_TypeAlias = ast.ExceptHandler | ast.MatchStar | ast.MatchAs
|
|
69
|
+
hasDOTname_str: typing_TypeAlias = ast.alias
|
|
70
|
+
hasDOTname_Name: typing_TypeAlias = astDOTTypeAlias
|
|
71
|
+
hasDOTname: typing_TypeAlias = hasDOTname_Identifier | hasDOTname_IdentifierOrNone | hasDOTname_str | hasDOTname_Name
|
|
72
|
+
hasDOTnames_list_alias: typing_TypeAlias = ast.Import | ast.ImportFrom
|
|
73
|
+
hasDOTnames_list_Identifier: typing_TypeAlias = ast.Global | ast.Nonlocal
|
|
74
|
+
hasDOTnames: typing_TypeAlias = hasDOTnames_list_alias | hasDOTnames_list_Identifier
|
|
75
|
+
hasDOTop_operator: typing_TypeAlias = ast.AugAssign | ast.BinOp
|
|
76
|
+
hasDOTop_boolop: typing_TypeAlias = ast.BoolOp
|
|
77
|
+
hasDOTop_unaryop: typing_TypeAlias = ast.UnaryOp
|
|
78
|
+
hasDOTop: typing_TypeAlias = hasDOTop_operator | hasDOTop_boolop | hasDOTop_unaryop
|
|
79
|
+
hasDOToperand: typing_TypeAlias = ast.UnaryOp
|
|
80
|
+
hasDOTops: typing_TypeAlias = ast.Compare
|
|
81
|
+
hasDOToptional_vars: typing_TypeAlias = ast.withitem
|
|
82
|
+
hasDOTorelse_list_stmt: typing_TypeAlias = ast.For | ast.AsyncFor | ast.While | ast.If | ast.Try | astDOTTryStar
|
|
83
|
+
hasDOTorelse_expr: typing_TypeAlias = ast.IfExp
|
|
84
|
+
hasDOTorelse: typing_TypeAlias = hasDOTorelse_list_stmt | hasDOTorelse_expr
|
|
85
|
+
hasDOTpattern_pattern: typing_TypeAlias = ast.match_case
|
|
86
|
+
hasDOTpattern_patternOrNone: typing_TypeAlias = ast.MatchAs
|
|
87
|
+
hasDOTpattern: typing_TypeAlias = hasDOTpattern_pattern | hasDOTpattern_patternOrNone
|
|
88
|
+
hasDOTpatterns: typing_TypeAlias = ast.MatchSequence | ast.MatchMapping | ast.MatchClass | ast.MatchOr
|
|
89
|
+
hasDOTposonlyargs: typing_TypeAlias = ast.arguments
|
|
90
|
+
hasDOTrest: typing_TypeAlias = ast.MatchMapping
|
|
91
|
+
hasDOTreturns_expr: typing_TypeAlias = ast.FunctionType
|
|
92
|
+
hasDOTreturns_exprOrNone: typing_TypeAlias = ast.FunctionDef | ast.AsyncFunctionDef
|
|
93
|
+
hasDOTreturns: typing_TypeAlias = hasDOTreturns_expr | hasDOTreturns_exprOrNone
|
|
94
|
+
hasDOTright: typing_TypeAlias = ast.BinOp
|
|
95
|
+
hasDOTsimple: typing_TypeAlias = ast.AnnAssign
|
|
96
|
+
hasDOTslice: typing_TypeAlias = ast.Subscript
|
|
97
|
+
hasDOTstep: typing_TypeAlias = ast.Slice
|
|
98
|
+
hasDOTsubject: typing_TypeAlias = ast.Match
|
|
99
|
+
hasDOTtag: typing_TypeAlias = ast.TypeIgnore
|
|
100
|
+
hasDOTtarget_NameOrAttributeOrSubscript: typing_TypeAlias = ast.AugAssign | ast.AnnAssign
|
|
101
|
+
hasDOTtarget_expr: typing_TypeAlias = ast.For | ast.AsyncFor | ast.comprehension
|
|
102
|
+
hasDOTtarget_Name: typing_TypeAlias = ast.NamedExpr
|
|
103
|
+
hasDOTtarget: typing_TypeAlias = hasDOTtarget_NameOrAttributeOrSubscript | hasDOTtarget_expr | hasDOTtarget_Name
|
|
104
|
+
hasDOTtargets: typing_TypeAlias = ast.Delete | ast.Assign
|
|
105
|
+
hasDOTtest: typing_TypeAlias = ast.While | ast.If | ast.Assert | ast.IfExp
|
|
106
|
+
hasDOTtype: typing_TypeAlias = ast.ExceptHandler
|
|
107
|
+
hasDOTtype_comment: typing_TypeAlias = ast.FunctionDef | ast.AsyncFunctionDef | ast.Assign | ast.For | ast.AsyncFor | ast.With | ast.AsyncWith | ast.arg
|
|
108
|
+
hasDOTtype_ignores: typing_TypeAlias = ast.Module
|
|
109
|
+
hasDOTtype_params: typing_TypeAlias = ast.FunctionDef | ast.AsyncFunctionDef | ast.ClassDef | astDOTTypeAlias
|
|
110
|
+
hasDOTupper: typing_TypeAlias = ast.Slice
|
|
111
|
+
hasDOTvalue_exprOrNone: typing_TypeAlias = ast.Return | ast.AnnAssign | ast.Yield
|
|
112
|
+
hasDOTvalue_expr: typing_TypeAlias = ast.Assign | ast.AugAssign | ast.Expr | ast.NamedExpr | ast.DictComp | ast.Await | ast.YieldFrom | ast.FormattedValue | ast.Attribute | ast.Subscript | ast.Starred | ast.keyword | astDOTTypeAlias | ast.MatchValue
|
|
113
|
+
hasDOTvalue_Any: typing_TypeAlias = ast.Constant
|
|
114
|
+
hasDOTvalue_LiteralTrueFalseOrNone: typing_TypeAlias = ast.MatchSingleton
|
|
115
|
+
hasDOTvalue: typing_TypeAlias = hasDOTvalue_exprOrNone | hasDOTvalue_expr | hasDOTvalue_Any | hasDOTvalue_LiteralTrueFalseOrNone
|
|
116
|
+
hasDOTvalues: typing_TypeAlias = ast.BoolOp | ast.Dict | ast.JoinedStr
|
|
117
|
+
hasDOTvararg: typing_TypeAlias = ast.arguments
|
|
@@ -4,38 +4,15 @@ import ast
|
|
|
4
4
|
|
|
5
5
|
# TODO understand typing.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# NOTE An idea to subclass antecedents to effectively TypeGuard more than just the top level of the antecedent.
|
|
7
|
+
# NOTE Prototype of an idea to subclass composable methods so that typing information
|
|
8
|
+
# can extend beyond the top level of the ast node.
|
|
10
9
|
class ImaCallToName(ast.Call):
|
|
11
|
-
func: ast.Name
|
|
12
|
-
# assert isinstance(ast.Call.func, ast.Name), "brinkmanship"
|
|
13
|
-
# func: ast.Name
|
|
14
|
-
|
|
15
|
-
# Some common attributes of ast classes.
|
|
16
|
-
astClassHasDOTbody_expr: typing_TypeAlias = ast.Expression | ast.IfExp | ast.Lambda
|
|
17
|
-
astClassHasDOTbodyList_stmt: typing_TypeAlias = ast.AsyncFor | ast.AsyncWith | ast.ClassDef | ast.ExceptHandler | ast.For | ast.FunctionDef | ast.If | ast.Interactive | ast.match_case | ast.Module | ast.Try | astDOTTryStar | ast.While | ast.With
|
|
18
|
-
astClassHasDOTbody: typing_TypeAlias = astClassHasDOTbody_expr | astClassHasDOTbodyList_stmt
|
|
19
|
-
|
|
20
|
-
astClassHasDOTnameNotNameAlways: typing_TypeAlias = ast.alias | ast.AsyncFunctionDef | ast.ClassDef | ast.FunctionDef | astDOTParamSpec | astDOTTypeVar | astDOTTypeVarTuple
|
|
21
|
-
astClassHasDOTnameNotNameOptionally: typing_TypeAlias = ast.ExceptHandler | ast.MatchAs | ast.MatchStar
|
|
22
|
-
astClassHasDOTnameNotName: typing_TypeAlias = astClassHasDOTnameNotNameAlways | astClassHasDOTnameNotNameOptionally
|
|
23
|
-
|
|
24
|
-
astClassHasDOTtargetAttributeNameSubscript: typing_TypeAlias = ast.AnnAssign | ast.AugAssign
|
|
25
|
-
astClassHasDOTtarget_expr: typing_TypeAlias = ast.AsyncFor | ast.comprehension | ast.For
|
|
26
|
-
astClassHasDOTtarget: typing_TypeAlias = ast.NamedExpr | astClassHasDOTtarget_expr | astClassHasDOTtargetAttributeNameSubscript
|
|
27
|
-
|
|
28
|
-
astClassHasDOTvalue_expr: typing_TypeAlias = ast.Assign | ast.Attribute | ast.AugAssign | ast.Await | ast.DictComp | ast.Expr | ast.FormattedValue | ast.keyword | ast.MatchValue | ast.NamedExpr | ast.Starred | ast.Subscript | astDOTTypeAlias | ast.YieldFrom
|
|
29
|
-
astClassHasDOTvalue_exprNone: typing_TypeAlias = ast.AnnAssign | ast.Return | ast.Yield
|
|
30
|
-
astClassHasDOTvalue: typing_TypeAlias = ast.Constant | ast.MatchSingleton | astClassHasDOTvalue_expr | astClassHasDOTvalue_exprNone
|
|
10
|
+
func: ast.Name # pyright: ignore[reportIncompatibleVariableOverride]
|
|
31
11
|
|
|
32
12
|
# Type hints through TypeAlias or type "hints" through the identifier name.
|
|
33
13
|
ast_expr_Slice: typing_TypeAlias = ast.expr
|
|
34
14
|
ast_Identifier: typing_TypeAlias = str
|
|
35
|
-
|
|
36
|
-
intORstr_orNone: typing_TypeAlias = Any
|
|
37
|
-
list_ast_type_paramORstr_orNone: typing_TypeAlias = Any
|
|
38
|
-
str_nameDOTname: typing_TypeAlias = stuPyd
|
|
15
|
+
str_nameDOTname: typing_TypeAlias = str
|
|
39
16
|
|
|
40
17
|
# Limited success with TypeVar.
|
|
41
18
|
个 = typing_TypeVar('个', bound = ast.AST, covariant = True)
|