mapFolding 0.8.4__py3-none-any.whl → 0.8.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. mapFolding/__init__.py +10 -6
  2. mapFolding/basecamp.py +3 -3
  3. mapFolding/beDRY.py +241 -68
  4. mapFolding/oeis.py +41 -26
  5. mapFolding/reference/hunterNumba.py +1 -1
  6. mapFolding/someAssemblyRequired/__init__.py +16 -15
  7. mapFolding/someAssemblyRequired/_theTypes.py +31 -13
  8. mapFolding/someAssemblyRequired/_tool_Make.py +13 -5
  9. mapFolding/someAssemblyRequired/_tool_Then.py +12 -5
  10. mapFolding/someAssemblyRequired/_toolboxAntecedents.py +131 -99
  11. mapFolding/someAssemblyRequired/_toolboxContainers.py +92 -15
  12. mapFolding/someAssemblyRequired/_toolboxPython.py +17 -31
  13. mapFolding/someAssemblyRequired/getLLVMforNoReason.py +2 -2
  14. mapFolding/someAssemblyRequired/newInliner.py +22 -0
  15. mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +65 -116
  16. mapFolding/someAssemblyRequired/toolboxNumba.py +364 -0
  17. mapFolding/someAssemblyRequired/transformationTools.py +262 -41
  18. mapFolding/syntheticModules/numbaCount_doTheNeedful.py +0 -1
  19. mapFolding/theSSOT.py +30 -33
  20. mapFolding/{filesystem.py → toolboxFilesystem.py} +90 -25
  21. {mapfolding-0.8.4.dist-info → mapfolding-0.8.6.dist-info}/METADATA +3 -2
  22. mapfolding-0.8.6.dist-info/RECORD +47 -0
  23. tests/conftest.py +30 -31
  24. tests/test_computations.py +8 -7
  25. tests/test_filesystem.py +2 -2
  26. tests/test_other.py +2 -2
  27. tests/test_tasks.py +3 -3
  28. mapFolding/noHomeYet.py +0 -32
  29. mapFolding/someAssemblyRequired/ingredientsNumba.py +0 -199
  30. mapFolding/someAssemblyRequired/synthesizeNumbaFlow.py +0 -156
  31. mapFolding/someAssemblyRequired/transformDataStructures.py +0 -235
  32. mapfolding-0.8.4.dist-info/RECORD +0 -49
  33. {mapfolding-0.8.4.dist-info → mapfolding-0.8.6.dist-info}/WHEEL +0 -0
  34. {mapfolding-0.8.4.dist-info → mapfolding-0.8.6.dist-info}/entry_points.txt +0 -0
  35. {mapfolding-0.8.4.dist-info → mapfolding-0.8.6.dist-info}/licenses/LICENSE +0 -0
  36. {mapfolding-0.8.4.dist-info → mapfolding-0.8.6.dist-info}/top_level.txt +0 -0
@@ -14,7 +14,7 @@ Core capabilities:
14
14
  4. Performance Optimization - Apply domain-specific optimizations for numerical computation
15
15
  5. Code Generation - Generate specialized implementations with appropriate imports and syntax
16
16
 
17
- The transformation pipeline supports multiple optimization targets, from general-purpose
17
+ The transformation assembly-line supports multiple optimization targets, from general-purpose
18
18
  acceleration to generating highly-specialized variants optimized for specific input parameters.
19
19
  This multi-level transformation approach allows for both development flexibility and
20
20
  runtime performance, preserving algorithm readability in the source while enabling
@@ -27,17 +27,21 @@ particularly for numerically-intensive algorithms that benefit from just-in-time
27
27
  from mapFolding.someAssemblyRequired._theTypes import (
28
28
  ast_expr_Slice,
29
29
  ast_Identifier,
30
- ImaAnnotationType,
31
30
  astClassHasDOTnameNotName,
32
- astClassHasDOTnameNotNameOptional,
33
31
  astClassHasDOTtarget,
34
32
  astClassHasDOTvalue,
33
+ astClassOptionallyHasDOTnameNotName,
35
34
  astMosDef,
35
+ Ima_funcTypeUNEDITED,
36
+ Ima_targetTypeUNEDITED,
37
+ ImaAnnotationType,
38
+ ImaAnnotationTypeVar,
36
39
  intORlist_ast_type_paramORstr_orNone,
37
40
  intORstr_orNone,
38
41
  list_ast_type_paramORstr_orNone,
39
42
  str_nameDOTname,
40
- typeCertified,
43
+ TypeCertified,
44
+ 个,
41
45
  )
42
46
 
43
47
  from mapFolding.someAssemblyRequired._toolboxPython import (
@@ -49,17 +53,14 @@ from mapFolding.someAssemblyRequired._toolboxPython import (
49
53
  parsePathFilename2astModule,
50
54
  )
51
55
 
52
- from mapFolding.someAssemblyRequired._toolboxAntecedents import be, ifThis, 又
56
+ from mapFolding.someAssemblyRequired._toolboxAntecedents import be, DOT, ifThis, 又
53
57
  from mapFolding.someAssemblyRequired._tool_Make import Make
54
58
  from mapFolding.someAssemblyRequired._tool_Then import Then
55
59
 
56
- from mapFolding.someAssemblyRequired.transformationTools import (
57
- dictionaryEstimates,
58
- extractClassDef,
59
- extractFunctionDef,
60
- write_astModule,
61
- Z0Z_executeActionUnlessDescendantMatches,
62
- Z0Z_inlineThisFunctionWithTheseValues,
63
- Z0Z_lameFindReplace,
64
- Z0Z_makeDictionaryReplacementStatements,
65
- )
60
+ from mapFolding.someAssemblyRequired._toolboxContainers import (
61
+ IngredientsFunction,
62
+ IngredientsModule,
63
+ LedgerOfImports,
64
+ RecipeSynthesizeFlow,
65
+ ShatteredDataclass,
66
+ )
@@ -1,35 +1,53 @@
1
- """
2
- Type definitions used across the AST transformation modules.
3
-
4
- This module provides type aliases and variables used in AST manipulation,
5
- centralizing type definitions to prevent circular imports.
6
- """
1
+ """It's still wrong, but typing information is being transmitted between functions, methods, and modules."""
7
2
  from typing import Any, TYPE_CHECKING, TypeAlias as typing_TypeAlias, TypeVar as typing_TypeVar
8
3
  import ast
9
4
 
10
5
  stuPyd: typing_TypeAlias = str
11
6
 
12
7
  if TYPE_CHECKING:
8
+ """ 3.12 new: ast.ParamSpec, ast.type_param, ast.TypeAlias, ast.TypeVar, ast.TypeVarTuple
9
+ 3.11 new: ast.TryStar"""
13
10
  astClassHasDOTnameNotName: typing_TypeAlias = ast.alias | ast.AsyncFunctionDef | ast.ClassDef | ast.FunctionDef | ast.ParamSpec | ast.TypeVar | ast.TypeVarTuple
14
- astClassHasDOTnameNotNameOptional: typing_TypeAlias = astClassHasDOTnameNotName | ast.ExceptHandler | ast.MatchAs | ast.MatchStar | None
15
- astClassHasDOTtarget: typing_TypeAlias = ast.AnnAssign | ast.AsyncFor | ast.AugAssign | ast.comprehension | ast.For | ast.NamedExpr
16
11
  astClassHasDOTvalue: typing_TypeAlias = ast.AnnAssign | ast.Assign | ast.Attribute | ast.AugAssign | ast.Await | ast.Constant | ast.DictComp | ast.Expr | ast.FormattedValue | ast.keyword | ast.MatchValue | ast.NamedExpr | ast.Return | ast.Starred | ast.Subscript | ast.TypeAlias | ast.Yield | ast.YieldFrom
17
12
  else:
18
13
  astClassHasDOTnameNotName = stuPyd
19
- astClassHasDOTnameNotNameOptional = stuPyd
20
- astClassHasDOTtarget = stuPyd
21
14
  astClassHasDOTvalue = stuPyd
22
15
 
16
+ astClassOptionallyHasDOTnameNotName: typing_TypeAlias = ast.ExceptHandler | ast.MatchAs | ast.MatchStar
17
+ astClassHasDOTtarget: typing_TypeAlias = ast.AnnAssign | ast.AsyncFor | ast.AugAssign | ast.comprehension | ast.For | ast.NamedExpr
18
+
23
19
  ast_expr_Slice: typing_TypeAlias = ast.expr
24
20
  ast_Identifier: typing_TypeAlias = str
25
21
  intORlist_ast_type_paramORstr_orNone: typing_TypeAlias = Any
26
22
  intORstr_orNone: typing_TypeAlias = Any
27
23
  list_ast_type_paramORstr_orNone: typing_TypeAlias = Any
28
- # TODO I am using the moniker `nameDOTname` in two very different ways: differentiate them.
29
24
  str_nameDOTname: typing_TypeAlias = stuPyd
30
25
  ImaAnnotationType: typing_TypeAlias = ast.Attribute | ast.Constant | ast.Name | ast.Subscript
26
+ ImaAnnotationTypeVar = typing_TypeVar('ImaAnnotationTypeVar', ast.Attribute, ast.Constant, ast.Name, ast.Subscript)
31
27
 
32
- # TODO understand whatever the fuck `typing.TypeVar` is _supposed_ to fucking do.
33
- typeCertified = typing_TypeVar('typeCertified')
28
+ Ima_funcTypeUNEDITED: typing_TypeAlias = ast.Attribute | ast.Await | ast.BinOp | ast.BoolOp | ast.Call | ast.Compare | ast.Constant | ast.Dict | ast.DictComp | ast.FormattedValue | ast.GeneratorExp | ast.IfExp | ast.JoinedStr | ast.Lambda | ast.List | ast.ListComp | ast.Name | ast.NamedExpr | ast.Set | ast.SetComp | ast.Slice | ast.Starred | ast.Subscript | ast.Tuple | ast.UnaryOp | ast.Yield | ast.YieldFrom
29
+ Ima_targetTypeUNEDITED: typing_TypeAlias = ast.AST
34
30
 
31
+ # TODO understand whatever the fuck `typing.TypeVar` is _supposed_ to fucking do.
32
+ TypeCertified = typing_TypeVar('TypeCertified', bound = ast.AST, covariant=True)
35
33
  astMosDef = typing_TypeVar('astMosDef', bound=astClassHasDOTnameNotName)
34
+
35
+ 个 = typing_TypeVar('个', bound= ast.AST | ast_Identifier, covariant=True)
36
+
37
+ Ima_ast_boolop: typing_TypeAlias = ast.boolop | ast.And | ast.Or
38
+ Ima_ast_cmpop: typing_TypeAlias = ast.cmpop | ast.Eq | ast.NotEq | ast.Lt | ast.LtE | ast.Gt | ast.GtE | ast.Is | ast.IsNot | ast.In | ast.NotIn
39
+ Ima_ast_excepthandler: typing_TypeAlias = ast.excepthandler | ast.ExceptHandler
40
+ Ima_ast_expr_context: typing_TypeAlias = ast.expr_context | ast.Load | ast.Store | ast.Del
41
+ Ima_ast_expr: typing_TypeAlias = ast.expr | ast.Attribute | ast.Await | ast.BinOp | ast.BoolOp | ast.Call | ast.Compare | ast.Constant | ast.Dict | ast.DictComp | ast.FormattedValue | ast.GeneratorExp | ast.IfExp | ast.JoinedStr | ast.Lambda | ast.List | ast.ListComp | ast.Name | ast.NamedExpr | ast.Set | ast.SetComp | ast.Slice | ast.Starred | ast.Subscript | ast.Tuple | ast.UnaryOp | ast.Yield | ast.YieldFrom
42
+ Ima_ast_mod: typing_TypeAlias = ast.mod | ast.Expression | ast.FunctionType | ast.Interactive | ast.Module
43
+ Ima_ast_operator: typing_TypeAlias = ast.operator | ast.Add | ast.Sub | ast.Mult | ast.MatMult | ast.Div | ast.Mod | ast.Pow | ast.LShift | ast.RShift | ast.BitOr | ast.BitXor | ast.BitAnd | ast.FloorDiv
44
+ Ima_ast_orphan = ast.alias | ast.arg | ast.arguments | ast.comprehension | ast.keyword | ast.match_case | ast.withitem
45
+ iMa_ast_pattern: typing_TypeAlias = ast.pattern | ast.MatchAs | ast.MatchClass | ast.MatchMapping | ast.MatchOr | ast.MatchSequence | ast.MatchSingleton | ast.MatchStar | ast.MatchValue
46
+ Ima_ast_type_ignore: typing_TypeAlias = ast.type_ignore | ast.TypeIgnore
47
+ Ima_ast_unaryop: typing_TypeAlias = ast.unaryop | ast.Invert | ast.Not | ast.UAdd | ast.USub
48
+ if TYPE_CHECKING:
49
+ Ima_ast_stmt: typing_TypeAlias = ast.stmt | ast.AnnAssign | ast.Assert | ast.Assign | ast.AsyncFor | ast.AsyncFunctionDef | ast.AsyncWith | ast.AugAssign | ast.Break | ast.ClassDef | ast.Continue | ast.Delete | ast.Expr | ast.For | ast.FunctionDef | ast.Global | ast.If | ast.Import | ast.ImportFrom | ast.Match | ast.Nonlocal | ast.Pass | ast.Raise | ast.Return | ast.Try | ast.TryStar | ast.TypeAlias | ast.While | ast.With
50
+ Ima_ast_type_param: typing_TypeAlias = ast.type_param | ast.ParamSpec | ast.TypeVar | ast.TypeVarTuple
51
+ else:
52
+ Ima_ast_stmt = stuPyd
53
+ Ima_ast_type_param = stuPyd
@@ -1,5 +1,13 @@
1
1
  from collections.abc import Sequence
2
- from mapFolding.someAssemblyRequired import ast_expr_Slice, ast_Identifier, ImaAnnotationType, intORlist_ast_type_paramORstr_orNone, intORstr_orNone, list_ast_type_paramORstr_orNone
2
+ from mapFolding.someAssemblyRequired import (
3
+ ast_expr_Slice,
4
+ ast_Identifier,
5
+ ImaAnnotationType,
6
+ intORlist_ast_type_paramORstr_orNone,
7
+ intORstr_orNone,
8
+ list_ast_type_paramORstr_orNone,
9
+ str_nameDOTname,
10
+ )
3
11
  from typing import Any
4
12
  import ast
5
13
 
@@ -67,11 +75,11 @@ class Make:
67
75
  def FunctionDef(name: ast_Identifier, argumentsSpecification:ast.arguments=ast.arguments(), body:list[ast.stmt]=[], decorator_list:list[ast.expr]=[], returns:ast.expr|None=None, **keywordArguments: intORlist_ast_type_paramORstr_orNone) -> ast.FunctionDef:
68
76
  return ast.FunctionDef(name, argumentsSpecification, body, decorator_list, returns, **keywordArguments)
69
77
  @staticmethod
70
- def Import(moduleIdentifier: ast_Identifier, asname: ast_Identifier | None = None, **keywordArguments: int) -> ast.Import:
71
- return ast.Import(names=[Make.alias(moduleIdentifier, asname)], **keywordArguments)
78
+ def Import(moduleWithLogicalPath: str_nameDOTname, asname: ast_Identifier | None = None, **keywordArguments: int) -> ast.Import:
79
+ return ast.Import(names=[Make.alias(moduleWithLogicalPath, asname)], **keywordArguments)
72
80
  @staticmethod
73
- def ImportFrom(moduleIdentifier: ast_Identifier, list_astAlias: list[ast.alias], **keywordArguments: int) -> ast.ImportFrom:
74
- return ast.ImportFrom(moduleIdentifier, list_astAlias, **keywordArguments)
81
+ def ImportFrom(moduleWithLogicalPath: str_nameDOTname, list_astAlias: list[ast.alias], **keywordArguments: int) -> ast.ImportFrom:
82
+ return ast.ImportFrom(moduleWithLogicalPath, list_astAlias, **keywordArguments)
75
83
  @staticmethod
76
84
  def keyword(keywordArgument: ast_Identifier, value: ast.expr, **keywordArguments: int) -> ast.keyword:
77
85
  return ast.keyword(arg=keywordArgument, value=value, **keywordArguments)
@@ -1,5 +1,5 @@
1
1
  from collections.abc import Callable, Sequence
2
- from mapFolding.someAssemblyRequired import ast_Identifier, astClassHasDOTvalue, astMosDef
2
+ from mapFolding.someAssemblyRequired import ast_Identifier, astClassHasDOTvalue
3
3
  from typing import Any
4
4
  import ast
5
5
 
@@ -12,8 +12,11 @@ class Then:
12
12
  return workhorse
13
13
 
14
14
  @staticmethod
15
- def appendTo(listOfAny: list[Any]) -> Callable[[ast.AST], None]:
16
- return lambda node: listOfAny.append(node)
15
+ def appendTo(listOfAny: list[Any]) -> Callable[[ast.AST | ast_Identifier], list[Any]]:
16
+ def workhorse(node: ast.AST | ast_Identifier) -> list[Any]:
17
+ listOfAny.append(node)
18
+ return listOfAny
19
+ return workhorse
17
20
 
18
21
  @staticmethod
19
22
  def DOTarg(action: Callable[[Any], Any]) -> Callable[[ast.arg | ast.keyword], ast.arg | ast.keyword]:
@@ -60,6 +63,10 @@ class Then:
60
63
  @staticmethod
61
64
  def replaceWith(astAST: ast.AST | ast_Identifier) -> Callable[[ast.AST], ast.AST | ast_Identifier]:
62
65
  return lambda _replaceMe: astAST
66
+
63
67
  @staticmethod
64
- def updateThis(dictionaryOf_astMosDef: dict[ast_Identifier, astMosDef]) -> Callable[[astMosDef], astMosDef]:
65
- return lambda node: dictionaryOf_astMosDef.setdefault(node.name, node)
68
+ def updateKeyValueIn(key: Callable[..., Any], value: Callable[..., Any], dictionary: dict[Any, Any]) -> Callable[[ast.AST], dict[Any, Any]]:
69
+ def workhorse(node: ast.AST) -> dict[Any, Any]:
70
+ dictionary.setdefault(key(node), value(node))
71
+ return dictionary
72
+ return workhorse
@@ -1,9 +1,65 @@
1
1
  from collections.abc import Callable, Container
2
- from mapFolding.someAssemblyRequired import ast_expr_Slice, ast_Identifier, astClassHasDOTnameNotName, astClassHasDOTtarget, astClassHasDOTvalue, ImaAnnotationType, typeCertified
3
- from typing import Any, overload, TypeGuard
2
+ from mapFolding.someAssemblyRequired import (
3
+ ast_expr_Slice,
4
+ ast_Identifier,
5
+ Ima_funcTypeUNEDITED,
6
+ astClassHasDOTnameNotName,
7
+ astClassOptionallyHasDOTnameNotName,
8
+ astClassHasDOTtarget,
9
+ astClassHasDOTvalue,
10
+ ImaAnnotationType,
11
+ ImaAnnotationTypeVar,
12
+ Ima_targetTypeUNEDITED,
13
+ TypeCertified,
14
+ )
15
+ from typing import Any, cast, overload, TypeGuard
4
16
  import ast
5
17
 
6
- Ima_targetType = ast.AST
18
+ class NotMyProblem(Exception):
19
+ pass
20
+
21
+ class DOT:
22
+ @staticmethod
23
+ @overload
24
+ def annotation(node: ast.AnnAssign) -> ImaAnnotationType:...
25
+ @staticmethod
26
+ @overload
27
+ def annotation(node: ast.arg) -> ImaAnnotationType | None:...
28
+ @staticmethod
29
+ def annotation(node: ast.AnnAssign | ast.arg) -> ImaAnnotationType | None:
30
+ return cast(ImaAnnotationType, node.annotation)
31
+ # fu = node.annotation
32
+ # if fu is None:
33
+ # return None
34
+ # else:
35
+ # fu = cast(ImaAnnotationType, node.annotation)
36
+ # return fu
37
+ @staticmethod
38
+ def func(node: ast.Call) -> Ima_funcTypeUNEDITED | ast.expr:
39
+ return node.func
40
+ @staticmethod
41
+ def id(node: ast.Name) -> ast_Identifier:
42
+ return node.id
43
+ @staticmethod
44
+ def name(node: astClassHasDOTnameNotName | astClassOptionallyHasDOTnameNotName) -> ast_Identifier:
45
+ if isinstance(node, astClassHasDOTnameNotName):
46
+ return node.name
47
+ try:
48
+ identifier = node.name
49
+ if identifier is None:
50
+ raise NotMyProblem
51
+ return identifier
52
+ except AttributeError:
53
+ raise NotMyProblem
54
+
55
+ @staticmethod
56
+ def nameOrNone(node: astClassHasDOTnameNotName | astClassOptionallyHasDOTnameNotName) -> ast_Identifier | None:
57
+ if isinstance(node, astClassHasDOTnameNotName):
58
+ return node.name
59
+ try:
60
+ return node.name
61
+ except AttributeError:
62
+ return None
7
63
 
8
64
  class 又:
9
65
  @staticmethod
@@ -76,79 +132,64 @@ class 又:
76
132
 
77
133
  class be:
78
134
  @staticmethod
79
- def _typeCertified(antecedent: type[typeCertified]) -> Callable[[Any | None], TypeGuard[typeCertified]]:
80
- def workhorse(node: Any | None) -> TypeGuard[typeCertified]:
135
+ def _typeCertified(antecedent: type[TypeCertified]) -> Callable[[Any | None], TypeGuard[TypeCertified]]:
136
+ def workhorse(node: Any | None) -> TypeGuard[TypeCertified]:
81
137
  return isinstance(node, antecedent)
82
138
  return workhorse
83
139
  @staticmethod
84
- def AnnAssign(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.AnnAssign)(node)
85
- # 'TypeVar "typeCertified" appears only once in generic function signature. Use "object" instead Pylance(reportInvalidTypeVarUse)"' HOW THE FUCK IS THAT INVALID WHEN IT IS WORKING PERFECTLY TO PASS THE TYPE INFORMATION--IN YOUR FUCKING STATIC TYPE CHECKER, PYLANCE!!!! Fuck you, and fuck your pretentious language.
140
+ def AnnAssign(node: TypeCertified) -> TypeGuard[ast.AnnAssign]: return be._typeCertified(ast.AnnAssign)(node) # pyright: ignore [reportInvalidTypeVarUse]
141
+ # 'TypeVar "typeCertified" appears only once in generic function signature. Use "typeCertified" instead Pylance(reportInvalidTypeVarUse)"' HOW THE FUCK IS THAT INVALID WHEN IT IS WORKING PERFECTLY TO PASS THE TYPE INFORMATION--IN YOUR FUCKING STATIC TYPE CHECKER, PYLANCE!!!! Fuck you, and fuck your pretentious language.
86
142
  @staticmethod
87
- def arg(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.arg)(node)
88
-
89
- # @staticmethod
90
- # def Annotation(node: ast.AST) -> TypeGuard[object] | bool:
91
- # if be.Attribute(node):
92
- # return be.Attribute(node)
93
- # elif be.Constant(node):
94
- # return be.Constant(node)
95
- # elif be.Name(node):
96
- # return be.Name(node)
97
- # elif be.Subscript(node):
98
- # return be.Subscript(node)
99
- # else:
100
- # return False
101
- # return be.Attribute(node) or be.Constant(node) or be.Name(node) or be.Subscript(node)
102
-
143
+ def arg(node: TypeCertified) -> TypeGuard[ast.arg]: return be._typeCertified(ast.arg)(node) # pyright: ignore [reportInvalidTypeVarUse]
103
144
  @staticmethod
104
- def Assign(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Assign)(node)
145
+ def Assign(node: TypeCertified) -> TypeGuard[ast.Assign]: return be._typeCertified(ast.Assign)(node) # pyright: ignore [reportInvalidTypeVarUse]
105
146
  @staticmethod
106
- def Attribute(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Attribute)(node)
147
+ def Attribute(node: TypeCertified) -> TypeGuard[ast.Attribute]: return be._typeCertified(ast.Attribute)(node) # pyright: ignore [reportInvalidTypeVarUse]
107
148
  @staticmethod
108
- def AugAssign(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.AugAssign)(node)
149
+ def AugAssign(node: TypeCertified) -> TypeGuard[ast.AugAssign]: return be._typeCertified(ast.AugAssign)(node) # pyright: ignore [reportInvalidTypeVarUse]
109
150
  @staticmethod
110
- def BoolOp(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.BoolOp)(node)
151
+ def BoolOp(node: TypeCertified) -> TypeGuard[ast.BoolOp]: return be._typeCertified(ast.BoolOp)(node) # pyright: ignore [reportInvalidTypeVarUse]
111
152
  @staticmethod
112
- def Call(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Call)(node)
153
+ def Call(node: TypeCertified) -> TypeGuard[ast.Call]: return be._typeCertified(ast.Call)(node) # pyright: ignore [reportInvalidTypeVarUse]
113
154
  @staticmethod
114
- def ClassDef(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.ClassDef)(node)
155
+ def ClassDef(node: TypeCertified) -> TypeGuard[ast.ClassDef]: return be._typeCertified(ast.ClassDef)(node) # pyright: ignore [reportInvalidTypeVarUse]
115
156
  @staticmethod
116
- def Compare(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Compare)(node)
157
+ def Compare(node: TypeCertified) -> TypeGuard[ast.Compare]: return be._typeCertified(ast.Compare)(node) # pyright: ignore [reportInvalidTypeVarUse]
117
158
  @staticmethod
118
- def Constant(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Constant)(node)
159
+ def Constant(node: TypeCertified) -> TypeGuard[ast.Constant]: return be._typeCertified(ast.Constant)(node) # pyright: ignore [reportInvalidTypeVarUse]
119
160
  @staticmethod
120
- def Expr(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Expr)(node)
161
+ def Expr(node: TypeCertified) -> TypeGuard[ast.Expr]: return be._typeCertified(ast.Expr)(node) # pyright: ignore [reportInvalidTypeVarUse]
121
162
  @staticmethod
122
- def FunctionDef(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.FunctionDef)(node)
163
+ def FunctionDef(node: TypeCertified) -> TypeGuard[ast.FunctionDef]: return be._typeCertified(ast.FunctionDef)(node) # pyright: ignore [reportInvalidTypeVarUse]
123
164
  @staticmethod
124
- def Import(node: ast.AST) -> TypeGuard[ast.Import]: return be._typeCertified(ast.Import)(node)
165
+ def Import(node: TypeCertified) -> TypeGuard[ast.Import]: return be._typeCertified(ast.Import)(node) # pyright: ignore [reportInvalidTypeVarUse]
125
166
  @staticmethod
126
- def ImportFrom(node: ast.AST) -> TypeGuard[ast.ImportFrom]: return be._typeCertified(ast.ImportFrom)(node)
167
+ def ImportFrom(node: TypeCertified) -> TypeGuard[ast.ImportFrom]: return be._typeCertified(ast.ImportFrom)(node) # pyright: ignore [reportInvalidTypeVarUse]
127
168
  @staticmethod
128
- def keyword(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.keyword)(node)
169
+ def keyword(node: TypeCertified) -> TypeGuard[ast.keyword]: return be._typeCertified(ast.keyword)(node) # pyright: ignore [reportInvalidTypeVarUse]
129
170
  @staticmethod
130
- def Module(node: ast.AST) -> TypeGuard[typeCertified]: return be._typeCertified(ast.Module)(node)
171
+ def Module(node: TypeCertified) -> TypeGuard[ast.Module]: return be._typeCertified(ast.Module)(node) # pyright: ignore [reportInvalidTypeVarUse]
131
172
  @staticmethod
132
- def Name(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Name)(node)
173
+ def Name(node: TypeCertified) -> TypeGuard[ast.Name]: return be._typeCertified(ast.Name)(node) # pyright: ignore [reportInvalidTypeVarUse]
133
174
  @staticmethod
134
- def Return(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Return)(node)
175
+ def Return(node: TypeCertified) -> TypeGuard[ast.Return]: return be._typeCertified(ast.Return)(node) # pyright: ignore [reportInvalidTypeVarUse]
135
176
  @staticmethod
136
- def Starred(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Starred)(node)
177
+ def Starred(node: TypeCertified) -> TypeGuard[ast.Starred]: return be._typeCertified(ast.Starred)(node) # pyright: ignore [reportInvalidTypeVarUse]
137
178
  @staticmethod
138
- def Subscript(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.Subscript)(node)
179
+ def Subscript(node: TypeCertified) -> TypeGuard[ast.Subscript]: return be._typeCertified(ast.Subscript)(node) # pyright: ignore [reportInvalidTypeVarUse]
139
180
  @staticmethod
140
- def UnaryOp(node: ast.AST) -> TypeGuard[object]: return be._typeCertified(ast.UnaryOp)(node)
181
+ def UnaryOp(node: TypeCertified) -> TypeGuard[ast.UnaryOp]: return be._typeCertified(ast.UnaryOp)(node) # pyright: ignore [reportInvalidTypeVarUse]
141
182
 
142
183
  class ifThis:
143
184
  @staticmethod
144
185
  def equals(this: Any) -> Callable[[Any], TypeGuard[Any] | bool]:
145
186
  return lambda node: node == this
146
187
  @staticmethod
147
- def isAssignAndTargets0Is(targets0Predicate: Callable[[ast.AST], bool]) -> Callable[[ast.AST], TypeGuard[object] | bool]:
188
+ def isAssignAndTargets0Is(targets0Predicate: Callable[[ast.AST], bool]) -> Callable[[ast.AST], TypeGuard[ast.AnnAssign] | bool]:
148
189
  """node is Assign and node.targets[0] matches `targets0Predicate`."""
149
190
  return lambda node: be.Assign(node) and targets0Predicate(node.targets[0])
150
191
  @staticmethod
151
- def isAssignAndValueIs(valuePredicate: Callable[[ast.AST], bool]) -> Callable[[ast.AST], TypeGuard[object] | bool]:
192
+ def isAssignAndValueIs(valuePredicate: Callable[[ast.AST], bool]) -> Callable[[ast.AST], TypeGuard[ast.Assign] | bool]:
152
193
  """node is ast.Assign and node.value matches `valuePredicate`.
153
194
  Parameters:
154
195
  valuePredicate: Function that evaluates the value of the assignment
@@ -157,101 +198,92 @@ class ifThis:
157
198
  """
158
199
  return lambda node: be.Assign(node) and 又.value(valuePredicate)(node)
159
200
  @staticmethod
160
- def isFunctionDef_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
201
+ def isFunctionDef_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.FunctionDef] | bool]:
161
202
  return lambda node: be.FunctionDef(node) and 又.name(ifThis._Identifier(identifier))(node)
162
203
  @staticmethod
163
- def isArgument_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
204
+ def isArgument_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.arg | ast.keyword] | bool]:
164
205
  return lambda node: (be.arg(node) or be.keyword(node)) and 又.arg(ifThis._Identifier(identifier))(node)
165
206
  @staticmethod
166
- def is_keyword_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
207
+ def is_keyword_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.keyword] | bool]:
167
208
  """see also `isArgument_Identifier`"""
168
209
  return lambda node: be.keyword(node) and 又.arg(ifThis._Identifier(identifier))(node)
169
210
  @staticmethod
170
- def is_arg_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
211
+ def is_arg_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.arg] | bool]:
171
212
  """see also `isArgument_Identifier`"""
172
213
  return lambda node: be.arg(node) and 又.arg(ifThis._Identifier(identifier))(node)
173
214
  @staticmethod
174
- def isClassDef_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
215
+ def isClassDef_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.ClassDef] | bool]:
175
216
  return lambda node: be.ClassDef(node) and 又.name(ifThis._Identifier(identifier))(node)
176
217
  @staticmethod
177
- def isAssignAndValueIsCall_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
218
+ def isAssignAndValueIsCall_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Assign] | bool]:
178
219
  return lambda node: be.Assign(node) and 又.value(ifThis.isCall_Identifier(identifier))(node)
179
220
  @staticmethod
180
- def isAssignAndValueIsCallAttributeNamespace_Identifier(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
221
+ def isAssignAndValueIsCallAttributeNamespace_Identifier(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Assign] | bool]:
181
222
  return ifThis.isAssignAndValueIs(ifThis.isCallAttributeNamespace_Identifier(namespace, identifier))
182
223
  @staticmethod
183
- def is_keywordAndValueIsConstant(node: ast.AST) -> TypeGuard[object]:
224
+ def is_keywordAndValueIsConstant(node: TypeCertified) -> TypeGuard[ast.keyword]: # pyright: ignore [reportInvalidTypeVarUse]
184
225
  return be.keyword(node) and 又.value(be.Constant)(node)
185
226
  @staticmethod
186
- def is_keyword_IdentifierEqualsConstantValue(identifier: ast_Identifier, ConstantValue: Any) -> Callable[[ast.AST], TypeGuard[object] | bool]:
227
+ def is_keyword_IdentifierEqualsConstantValue(identifier: ast_Identifier, ConstantValue: Any) -> Callable[[ast.AST], TypeGuard[ast.keyword] | bool]:
187
228
  return lambda node: ifThis.is_keyword_Identifier(identifier)(node) and ifThis.is_keywordAndValueIsConstant(node) and 又.value(ifThis.isConstantEquals(ConstantValue))(node)
188
- """
189
- Argument of type "typeCertified@isAnnAssign_targetIs" cannot be assigned to parameter of type "astClassHasDOTtarget"
190
- Type "typeCertified@isAnnAssign_targetIs" is not assignable to type "astClassHasDOTtarget"
191
- "object*" is not assignable to "AnnAssign"
192
- "object*" is not assignable to "AsyncFor"
193
- "object*" is not assignable to "AugAssign"
194
- "object*" is not assignable to "comprehension"
195
- "object*" is not assignable to "For"
196
- "object*" is not assignable to "NamedExpr"
197
- """
198
- @staticmethod
199
- def isAnnAssign_targetIs(targetPredicate: Callable[[Ima_targetType], TypeGuard[Ima_targetType] | bool]) -> Callable[[ast.AST], TypeGuard[object] | bool]:
200
- def workhorse(node: ast.AST) -> TypeGuard[object] | bool:
229
+ @staticmethod
230
+ def isAnnAssign_targetIs(targetPredicate: Callable[[Ima_targetTypeUNEDITED], TypeGuard[Ima_targetTypeUNEDITED] | bool]) -> Callable[[ast.AST], TypeGuard[ast.AnnAssign] | bool]:
231
+ def workhorse(node: TypeCertified) -> TypeGuard[ast.AnnAssign] | bool: # pyright: ignore [reportInvalidTypeVarUse]
201
232
  return be.AnnAssign(node) and 又.target(targetPredicate)(node)
202
233
  return workhorse
203
234
  @staticmethod
204
- def isAnnAssignAndAnnotationIsName(node: ast.AST) -> TypeGuard[object] | bool:
205
- return be.AnnAssign(node) and 又.annotation(be.Name)(node)
235
+ def isAnnAssignAndAnnotationIsName(node: TypeCertified) -> TypeGuard[ast.AnnAssign] | bool: # pyright: ignore [reportInvalidTypeVarUse]
236
+ return be.AnnAssign(node) and be.Name(DOT.annotation(node))
237
+ # return be.AnnAssign(node) and 又.annotation(be.Name)(node)
206
238
  @staticmethod
207
- def isAugAssign_targetIs(targetPredicate: Callable[[Ima_targetType], TypeGuard[Ima_targetType] | bool]) -> Callable[[ast.AST], TypeGuard[typeCertified] | bool]:
208
- def workhorse(node: ast.AST) -> TypeGuard[typeCertified] | bool:
239
+ def isAugAssign_targetIs(targetPredicate: Callable[[Ima_targetTypeUNEDITED], TypeGuard[Ima_targetTypeUNEDITED] | bool]) -> Callable[[ast.AST], TypeGuard[ast.AugAssign] | bool]:
240
+ def workhorse(node: TypeCertified) -> TypeGuard[ast.AugAssign] | bool: # pyright: ignore [reportInvalidTypeVarUse]
209
241
  return be.AugAssign(node) and 又.target(targetPredicate)(node)
210
242
  return workhorse
211
243
 
212
244
  @staticmethod
213
- def isAnyCompare(node: ast.AST) -> TypeGuard[object]:
245
+ def isAnyCompare(node: TypeCertified) -> TypeGuard[ast.BoolOp | ast.Compare]: # pyright: ignore [reportInvalidTypeVarUse]
214
246
  return be.Compare(node) or be.BoolOp(node)
215
247
  @staticmethod
216
- def isConstantEquals(value: Any) -> Callable[[ast.AST], TypeGuard[object] | bool]:
248
+ def isConstantEquals(value: Any) -> Callable[[ast.AST], TypeGuard[ast.Constant] | bool]:
217
249
  return lambda node: be.Constant(node) and 又.value(ifThis.equals(value))(node)
218
250
  @staticmethod
219
- def isReturnAnyCompare(node: ast.AST) -> TypeGuard[object] | bool:
251
+ def isReturnAnyCompare(node: TypeCertified) -> TypeGuard[ast.Return] | bool: # pyright: ignore [reportInvalidTypeVarUse] # pyright: ignore [reportInvalidTypeVarUse]
220
252
  return be.Return(node) and 又.value(ifThis.isAnyCompare)(node)
221
253
  @staticmethod
222
- def isReturnUnaryOp(node: ast.AST) -> TypeGuard[object] | bool:
254
+ def isReturnUnaryOp(node: TypeCertified) -> TypeGuard[ast.Return] | bool: # pyright: ignore [reportInvalidTypeVarUse]
223
255
  return be.Return(node) and 又.value(be.UnaryOp)(node)
224
256
 
225
257
  # ================================================================
226
258
  # Nested identifier
227
259
  @staticmethod
228
- def _nestedJunction_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
229
- def workhorse(node: ast.AST) -> TypeGuard[object] | bool:
260
+ def _nestedJunction_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Attribute | ast.Starred | ast.Subscript] | bool]:
261
+ def workhorse(node: TypeCertified) -> TypeGuard[ast.Attribute | ast.Starred | ast.Subscript] | bool: # pyright: ignore [reportInvalidTypeVarUse]
230
262
  return ifThis.isName_Identifier(identifier)(node) or ifThis.isAttribute_Identifier(identifier)(node) or ifThis.isSubscript_Identifier(identifier)(node) or ifThis.isStarred_Identifier(identifier)(node)
231
263
  return workhorse
232
264
  @staticmethod
233
- def isAttribute_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
265
+ def isAttribute_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Attribute] | bool]:
234
266
  """node is `ast.Attribute` and the top-level `ast.Name` is `identifier`"""
235
- def workhorse(node: ast.AST) -> TypeGuard[object]:
267
+ def workhorse(node: TypeCertified) -> TypeGuard[ast.Attribute]: # pyright: ignore [reportInvalidTypeVarUse]
236
268
  return be.Attribute(node) and 又.value(ifThis._nestedJunction_Identifier(identifier))(node)
237
269
  return workhorse
238
270
  @staticmethod
239
- def isStarred_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
271
+ def isStarred_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Starred] | bool]:
240
272
  """node is `ast.Starred` and the top-level `ast.Name` is `identifier`"""
241
- def workhorse(node: ast.AST) -> TypeGuard[object]:
273
+ def workhorse(node: TypeCertified) -> TypeGuard[ast.Starred]: # pyright: ignore [reportInvalidTypeVarUse]
242
274
  return be.Starred(node) and 又.value(ifThis._nestedJunction_Identifier(identifier))(node)
243
275
  return workhorse
244
276
  @staticmethod
245
- def isSubscript_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
277
+ def isSubscript_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Subscript] | bool]:
246
278
  """node is `ast.Subscript` and the top-level `ast.Name` is `identifier`"""
247
- def workhorse(node: ast.AST) -> TypeGuard[object]:
279
+ def workhorse(node: TypeCertified) -> TypeGuard[ast.Subscript]: # pyright: ignore [reportInvalidTypeVarUse]
248
280
  return be.Subscript(node) and 又.value(ifThis._nestedJunction_Identifier(identifier))(node)
249
281
  return workhorse
250
282
  # ================================================================
251
283
 
252
284
  @staticmethod
253
285
  def Z0Z_unparseIs(astAST: ast.AST) -> Callable[[ast.AST], bool]:
254
- def workhorse(node: ast.AST) -> bool: return ast.unparse(node) == ast.unparse(astAST)
286
+ def workhorse(node: TypeCertified) -> bool: return ast.unparse(node) == ast.unparse(astAST) # pyright: ignore [reportInvalidTypeVarUse]
255
287
  return workhorse
256
288
 
257
289
  # ================================================================
@@ -264,32 +296,36 @@ Argument of type "typeCertified@isAnnAssign_targetIs" cannot be assigned to para
264
296
  # ================================================================
265
297
  # MORE function inlining
266
298
  @staticmethod
267
- def onlyReturnAnyCompare(astFunctionDef: ast.AST) -> TypeGuard[object]:
299
+ def onlyReturnAnyCompare(astFunctionDef: ast.AST) -> TypeGuard[ast.FunctionDef] | bool:
268
300
  return be.FunctionDef(astFunctionDef) and len(astFunctionDef.body) == 1 and ifThis.isReturnAnyCompare(astFunctionDef.body[0])
269
301
  # For function inlining
270
302
  @staticmethod
271
- def onlyReturnUnaryOp(astFunctionDef: ast.AST) -> TypeGuard[object]:
303
+ def onlyReturnUnaryOp(astFunctionDef: ast.AST) -> TypeGuard[ast.FunctionDef] | bool:
272
304
  return be.FunctionDef(astFunctionDef) and len(astFunctionDef.body) == 1 and ifThis.isReturnUnaryOp(astFunctionDef.body[0])
273
305
  # ================================================================
274
306
  # These are used by other functions
275
307
  @staticmethod
276
- def isCallAttributeNamespace_Identifier(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
308
+ def isCallAttributeNamespace_Identifier(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Call] | bool]:
277
309
  return lambda node: be.Call(node) and 又.func(ifThis.isAttributeNamespace_Identifier(namespace, identifier))(node)
278
310
  @staticmethod
279
- def isName_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
311
+ def isName_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Name] | bool]:
280
312
  return lambda node: be.Name(node) and 又.id(ifThis._Identifier(identifier))(node)
281
313
  @staticmethod
282
- def isCall_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
314
+ def isCall_Identifier(identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Call] | bool]:
283
315
  return lambda node: be.Call(node) and 又.func(ifThis.isName_Identifier(identifier))(node)
284
316
  # ================================================================
285
317
  @staticmethod
318
+ def CallDoesNotCallItself(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Call] | bool]:
319
+ """If `namespace` is not applicable to your case, then call with `namespace=""`."""
320
+ return lambda node: ifThis.matchesMeButNotAnyDescendant(ifThis.CallReallyIs(namespace, identifier))(node)
321
+ @staticmethod
286
322
  def matchesMeButNotAnyDescendant(predicate: Callable[[ast.AST], bool]) -> Callable[[ast.AST], bool]:
287
323
  """Create a predicate that returns True if the node matches but none of its descendants match the predicate."""
288
324
  return lambda node: predicate(node) and ifThis.matchesNoDescendant(predicate)(node)
289
325
  @staticmethod
290
326
  def matchesNoDescendant(predicate: Callable[[ast.AST], bool]) -> Callable[[ast.AST], bool]:
291
327
  """Create a predicate that returns True if no descendant of the node matches the given predicate."""
292
- def workhorse(node: ast.AST) -> bool:
328
+ def workhorse(node: TypeCertified) -> bool: # pyright: ignore [reportInvalidTypeVarUse]
293
329
  for descendant in ast.walk(node):
294
330
  if descendant is not node and predicate(descendant):
295
331
  return False
@@ -297,30 +333,26 @@ Argument of type "typeCertified@isAnnAssign_targetIs" cannot be assigned to para
297
333
  return workhorse
298
334
 
299
335
  @staticmethod
300
- def CallDoesNotCallItself(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
301
- """If `namespace` is not applicable to your case, then call with `namespace=""`."""
302
- return lambda node: ifThis.matchesMeButNotAnyDescendant(ifThis.CallReallyIs(namespace, identifier))(node)
303
- @staticmethod
304
- def CallReallyIs(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
336
+ def CallReallyIs(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Call] | bool]:
305
337
  return ifThis.isCall_Identifier(identifier) or ifThis.isCallAttributeNamespace_Identifier(namespace, identifier)
306
338
  @staticmethod
307
- def isAttributeNamespace_Identifier(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[object] | bool]:
339
+ def isAttributeNamespace_Identifier(namespace: ast_Identifier, identifier: ast_Identifier) -> Callable[[ast.AST], TypeGuard[ast.Attribute] | bool]:
308
340
  return lambda node: ifThis.isAttributeName(node) and 又.value(ifThis.isName_Identifier(namespace))(node) and 又.attr(ifThis._Identifier(identifier))(node)
309
341
  @staticmethod
310
342
  def _Identifier(identifier: ast_Identifier) -> Callable[[ast_Identifier | None], TypeGuard[ast_Identifier] | bool]:
311
343
  return lambda node: node == identifier
312
344
  @staticmethod
313
- def isAttributeName(node: ast.AST) -> TypeGuard[object]:
345
+ def isAttributeName(node: TypeCertified) -> TypeGuard[ast.Attribute]: # pyright: ignore [reportInvalidTypeVarUse]
314
346
  """ Displayed as Name.attribute."""
315
347
  return be.Attribute(node) and 又.value(be.Name)(node)
316
348
 
317
349
  @staticmethod
318
- def isCallToName(node: ast.AST) -> TypeGuard[object]:
350
+ def isCallToName(node: TypeCertified) -> TypeGuard[ast.Call]: # pyright: ignore [reportInvalidTypeVarUse]
319
351
  return be.Call(node) and 又.func(be.Name)(node)
320
352
  @staticmethod
321
353
  def ast_IdentifierIn(container: Container[ast_Identifier]) -> Callable[[ast_Identifier], TypeGuard[ast_Identifier] | bool]:
322
354
  return lambda node: node in container
323
355
  # This bullshit is for the crappy function inliner I made.
324
356
  @staticmethod
325
- def CallDoesNotCallItselfAndNameDOTidIsIn(container: Container[ast_Identifier]) -> Callable[[ast.AST], TypeGuard[object] | bool]:
326
- return lambda node: ifThis.isCallToName(node) and 又.func(又.id(ifThis.ast_IdentifierIn(container)))(node) and ifThis.CallDoesNotCallItself("", node.func.id)(node)
357
+ def CallDoesNotCallItselfAndNameDOTidIsIn(container: Container[ast_Identifier]) -> Callable[[ast.AST], TypeGuard[ast.Call] | bool]:
358
+ return lambda node: ifThis.isCallToName(node) and 又.func(又.id(ifThis.ast_IdentifierIn(container)))(node) and ifThis.CallDoesNotCallItself("", node.func.id)(node) # type: ignore