astToolkit 0.3.0__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/PKG-INFO +1 -1
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/__init__.py +3 -4
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_astTypes.py +4 -1
- asttoolkit-0.3.0/astToolkit/theSSOT.py → asttoolkit-0.3.2/astToolkit/_theSSOT.py +0 -2
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolClassIsAndAttribute.py +36 -36
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolDOT.py +36 -36
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolGrab.py +90 -90
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolIfThis.py +3 -3
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolMake.py +75 -74
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolThen.py +3 -3
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolkitAST.py +25 -36
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolkitNodeVisitor.py +4 -4
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_types.py +1 -6
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/transformationTools.py +6 -8
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit.egg-info/PKG-INFO +1 -1
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit.egg-info/SOURCES.txt +1 -1
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/pyproject.toml +1 -1
- asttoolkit-0.3.2/toolFactory/Z0Z_hardcoded.py +135 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/toolFactory/__init__.py +1 -1
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/toolFactory/datacenter.py +62 -74
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/toolFactory/factory3.py +35 -25
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/toolFactory/factory_annex.py +15 -17
- asttoolkit-0.3.0/toolFactory/Z0Z_hardcoded.py +0 -113
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/LICENSE +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/README.md +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolBe.py +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/_toolkitContainers.py +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit/py.typed +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit.egg-info/dependency_links.txt +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit.egg-info/requires.txt +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/astToolkit.egg-info/top_level.txt +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/setup.cfg +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/tests/test_basic.py +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/toolFactory/_snippets.py +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/toolFactory/docstrings.py +0 -0
- {asttoolkit-0.3.0 → asttoolkit-0.3.2}/toolFactory/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: astToolkit
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: A powerfully composable, type-safe toolkit for Python abstract syntax tree (AST) manipulation, analysis, transformation, and code generation with a layered architecture designed for building sophisticated code processing assembly-lines.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License: CC-BY-NC-4.0
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
# import astToolkit._extendPython_ast
|
|
2
|
+
|
|
1
3
|
from astToolkit._astTypes import * # noqa: F403
|
|
2
4
|
|
|
3
|
-
from astToolkit.
|
|
5
|
+
from astToolkit._theSSOT import The as The
|
|
4
6
|
|
|
5
7
|
from astToolkit._types import (
|
|
6
|
-
NodeORattribute as NodeORattribute,
|
|
7
8
|
str_nameDOTname as str_nameDOTname,
|
|
8
|
-
个 as 个,
|
|
9
|
-
个return as 个return,
|
|
10
9
|
)
|
|
11
10
|
|
|
12
11
|
from astToolkit._toolkitNodeVisitor import (
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"""This file is generated automatically, so changes to this file will be lost."""
|
|
2
|
-
from typing import Any, TypeAlias as typing_TypeAlias
|
|
2
|
+
from typing import Any, TypeAlias as typing_TypeAlias, TypeVar as typing_TypeVar
|
|
3
3
|
import ast
|
|
4
4
|
import sys
|
|
5
5
|
intORstr: typing_TypeAlias = Any
|
|
6
6
|
intORstrORtype_params: typing_TypeAlias = Any
|
|
7
7
|
intORtype_params: typing_TypeAlias = Any
|
|
8
|
+
木 = typing_TypeVar('木', bound=ast.AST, covariant=True)
|
|
9
|
+
个 = typing_TypeVar('个', covariant=True)
|
|
10
|
+
个return = typing_TypeVar('个return', covariant=True)
|
|
8
11
|
hasDOTannotation_expr: typing_TypeAlias = ast.AnnAssign
|
|
9
12
|
hasDOTannotation_exprOrNone: typing_TypeAlias = ast.arg
|
|
10
13
|
hasDOTannotation: typing_TypeAlias = hasDOTannotation_expr | hasDOTannotation_exprOrNone
|
|
@@ -28,11 +28,11 @@ class ClassIsAndAttribute:
|
|
|
28
28
|
|
|
29
29
|
@staticmethod
|
|
30
30
|
@overload
|
|
31
|
-
def annotationIs(astClass: type[hasDOTannotation_exprOrNone], attributeCondition: Callable[[ast.expr
|
|
31
|
+
def annotationIs(astClass: type[hasDOTannotation_exprOrNone], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTannotation_exprOrNone] | bool]:
|
|
32
32
|
...
|
|
33
33
|
|
|
34
34
|
@staticmethod
|
|
35
|
-
def annotationIs(astClass: type[hasDOTannotation], attributeCondition: Callable[[ast.expr], bool]
|
|
35
|
+
def annotationIs(astClass: type[hasDOTannotation], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTannotation] | bool]:
|
|
36
36
|
|
|
37
37
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTannotation] | bool:
|
|
38
38
|
return isinstance(node, astClass) and node.annotation is not None and attributeCondition(node.annotation)
|
|
@@ -45,11 +45,11 @@ class ClassIsAndAttribute:
|
|
|
45
45
|
|
|
46
46
|
@staticmethod
|
|
47
47
|
@overload
|
|
48
|
-
def argIs(astClass: type[hasDOTarg_strOrNone], attributeCondition: Callable[[str
|
|
48
|
+
def argIs(astClass: type[hasDOTarg_strOrNone], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTarg_strOrNone] | bool]:
|
|
49
49
|
...
|
|
50
50
|
|
|
51
51
|
@staticmethod
|
|
52
|
-
def argIs(astClass: type[hasDOTarg], attributeCondition: Callable[[str], bool]
|
|
52
|
+
def argIs(astClass: type[hasDOTarg], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTarg] | bool]:
|
|
53
53
|
|
|
54
54
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTarg] | bool:
|
|
55
55
|
return isinstance(node, astClass) and node.arg is not None and attributeCondition(node.arg)
|
|
@@ -85,7 +85,7 @@ class ClassIsAndAttribute:
|
|
|
85
85
|
return workhorse
|
|
86
86
|
|
|
87
87
|
@staticmethod
|
|
88
|
-
def asnameIs(astClass: type[hasDOTasname], attributeCondition: Callable[[str
|
|
88
|
+
def asnameIs(astClass: type[hasDOTasname], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTasname] | bool]:
|
|
89
89
|
|
|
90
90
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTasname] | bool:
|
|
91
91
|
return isinstance(node, astClass) and node.asname is not None and attributeCondition(node.asname)
|
|
@@ -123,7 +123,7 @@ class ClassIsAndAttribute:
|
|
|
123
123
|
return workhorse
|
|
124
124
|
|
|
125
125
|
@staticmethod
|
|
126
|
-
def boundIs(astClass: type[hasDOTbound], attributeCondition: Callable[[ast.expr
|
|
126
|
+
def boundIs(astClass: type[hasDOTbound], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTbound] | bool]:
|
|
127
127
|
|
|
128
128
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTbound] | bool:
|
|
129
129
|
return isinstance(node, astClass) and node.bound is not None and attributeCondition(node.bound)
|
|
@@ -137,7 +137,7 @@ class ClassIsAndAttribute:
|
|
|
137
137
|
return workhorse
|
|
138
138
|
|
|
139
139
|
@staticmethod
|
|
140
|
-
def causeIs(astClass: type[hasDOTcause], attributeCondition: Callable[[ast.expr
|
|
140
|
+
def causeIs(astClass: type[hasDOTcause], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTcause] | bool]:
|
|
141
141
|
|
|
142
142
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTcause] | bool:
|
|
143
143
|
return isinstance(node, astClass) and node.cause is not None and attributeCondition(node.cause)
|
|
@@ -187,7 +187,7 @@ class ClassIsAndAttribute:
|
|
|
187
187
|
if sys.version_info >= (3, 13):
|
|
188
188
|
|
|
189
189
|
@staticmethod
|
|
190
|
-
def default_valueIs(astClass: type[hasDOTdefault_value], attributeCondition: Callable[[ast.expr
|
|
190
|
+
def default_valueIs(astClass: type[hasDOTdefault_value], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTdefault_value] | bool]:
|
|
191
191
|
|
|
192
192
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTdefault_value] | bool:
|
|
193
193
|
return isinstance(node, astClass) and node.default_value is not None and attributeCondition(node.default_value)
|
|
@@ -215,7 +215,7 @@ class ClassIsAndAttribute:
|
|
|
215
215
|
return workhorse
|
|
216
216
|
|
|
217
217
|
@staticmethod
|
|
218
|
-
def excIs(astClass: type[hasDOTexc], attributeCondition: Callable[[ast.expr
|
|
218
|
+
def excIs(astClass: type[hasDOTexc], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTexc] | bool]:
|
|
219
219
|
|
|
220
220
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTexc] | bool:
|
|
221
221
|
return isinstance(node, astClass) and node.exc is not None and attributeCondition(node.exc)
|
|
@@ -229,7 +229,7 @@ class ClassIsAndAttribute:
|
|
|
229
229
|
return workhorse
|
|
230
230
|
|
|
231
231
|
@staticmethod
|
|
232
|
-
def format_specIs(astClass: type[hasDOTformat_spec], attributeCondition: Callable[[ast.expr
|
|
232
|
+
def format_specIs(astClass: type[hasDOTformat_spec], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTformat_spec] | bool]:
|
|
233
233
|
|
|
234
234
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTformat_spec] | bool:
|
|
235
235
|
return isinstance(node, astClass) and node.format_spec is not None and attributeCondition(node.format_spec)
|
|
@@ -250,7 +250,7 @@ class ClassIsAndAttribute:
|
|
|
250
250
|
return workhorse
|
|
251
251
|
|
|
252
252
|
@staticmethod
|
|
253
|
-
def guardIs(astClass: type[hasDOTguard], attributeCondition: Callable[[ast.expr
|
|
253
|
+
def guardIs(astClass: type[hasDOTguard], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTguard] | bool]:
|
|
254
254
|
|
|
255
255
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTguard] | bool:
|
|
256
256
|
return isinstance(node, astClass) and node.guard is not None and attributeCondition(node.guard)
|
|
@@ -312,11 +312,11 @@ class ClassIsAndAttribute:
|
|
|
312
312
|
|
|
313
313
|
@staticmethod
|
|
314
314
|
@overload
|
|
315
|
-
def keysIs(astClass: type[hasDOTkeys_list_exprOrNone], attributeCondition: Callable[[list[ast.expr
|
|
315
|
+
def keysIs(astClass: type[hasDOTkeys_list_exprOrNone], attributeCondition: Callable[[list[ast.expr]], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTkeys_list_exprOrNone] | bool]:
|
|
316
316
|
...
|
|
317
317
|
|
|
318
318
|
@staticmethod
|
|
319
|
-
def keysIs(astClass: type[hasDOTkeys], attributeCondition: Callable[[list[ast.expr]], bool]
|
|
319
|
+
def keysIs(astClass: type[hasDOTkeys], attributeCondition: Callable[[list[ast.expr]], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTkeys] | bool]:
|
|
320
320
|
|
|
321
321
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTkeys] | bool:
|
|
322
322
|
return isinstance(node, astClass) and node.keys != [None] and attributeCondition(node.keys)
|
|
@@ -330,21 +330,21 @@ class ClassIsAndAttribute:
|
|
|
330
330
|
return workhorse
|
|
331
331
|
|
|
332
332
|
@staticmethod
|
|
333
|
-
def kindIs(astClass: type[hasDOTkind], attributeCondition: Callable[[str
|
|
333
|
+
def kindIs(astClass: type[hasDOTkind], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTkind] | bool]:
|
|
334
334
|
|
|
335
335
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTkind] | bool:
|
|
336
336
|
return isinstance(node, astClass) and node.kind is not None and attributeCondition(node.kind)
|
|
337
337
|
return workhorse
|
|
338
338
|
|
|
339
339
|
@staticmethod
|
|
340
|
-
def kw_defaultsIs(astClass: type[hasDOTkw_defaults], attributeCondition: Callable[[list[ast.expr
|
|
340
|
+
def kw_defaultsIs(astClass: type[hasDOTkw_defaults], attributeCondition: Callable[[list[ast.expr]], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTkw_defaults] | bool]:
|
|
341
341
|
|
|
342
342
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTkw_defaults] | bool:
|
|
343
343
|
return isinstance(node, astClass) and node.kw_defaults != [None] and attributeCondition(node.kw_defaults)
|
|
344
344
|
return workhorse
|
|
345
345
|
|
|
346
346
|
@staticmethod
|
|
347
|
-
def kwargIs(astClass: type[hasDOTkwarg], attributeCondition: Callable[[ast.arg
|
|
347
|
+
def kwargIs(astClass: type[hasDOTkwarg], attributeCondition: Callable[[ast.arg], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTkwarg] | bool]:
|
|
348
348
|
|
|
349
349
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTkwarg] | bool:
|
|
350
350
|
return isinstance(node, astClass) and node.kwarg is not None and attributeCondition(node.kwarg)
|
|
@@ -393,21 +393,21 @@ class ClassIsAndAttribute:
|
|
|
393
393
|
return workhorse
|
|
394
394
|
|
|
395
395
|
@staticmethod
|
|
396
|
-
def lowerIs(astClass: type[hasDOTlower], attributeCondition: Callable[[ast.expr
|
|
396
|
+
def lowerIs(astClass: type[hasDOTlower], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTlower] | bool]:
|
|
397
397
|
|
|
398
398
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTlower] | bool:
|
|
399
399
|
return isinstance(node, astClass) and node.lower is not None and attributeCondition(node.lower)
|
|
400
400
|
return workhorse
|
|
401
401
|
|
|
402
402
|
@staticmethod
|
|
403
|
-
def moduleIs(astClass: type[hasDOTmodule], attributeCondition: Callable[[str
|
|
403
|
+
def moduleIs(astClass: type[hasDOTmodule], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTmodule] | bool]:
|
|
404
404
|
|
|
405
405
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTmodule] | bool:
|
|
406
406
|
return isinstance(node, astClass) and node.module is not None and attributeCondition(node.module)
|
|
407
407
|
return workhorse
|
|
408
408
|
|
|
409
409
|
@staticmethod
|
|
410
|
-
def msgIs(astClass: type[hasDOTmsg], attributeCondition: Callable[[ast.expr
|
|
410
|
+
def msgIs(astClass: type[hasDOTmsg], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTmsg] | bool]:
|
|
411
411
|
|
|
412
412
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTmsg] | bool:
|
|
413
413
|
return isinstance(node, astClass) and node.msg is not None and attributeCondition(node.msg)
|
|
@@ -425,11 +425,11 @@ class ClassIsAndAttribute:
|
|
|
425
425
|
|
|
426
426
|
@staticmethod
|
|
427
427
|
@overload
|
|
428
|
-
def nameIs(astClass: type[hasDOTname_strOrNone], attributeCondition: Callable[[str
|
|
428
|
+
def nameIs(astClass: type[hasDOTname_strOrNone], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTname_strOrNone] | bool]:
|
|
429
429
|
...
|
|
430
430
|
|
|
431
431
|
@staticmethod
|
|
432
|
-
def nameIs(astClass: type[hasDOTname], attributeCondition: Callable[[ast.Name], bool] | Callable[[str], bool]
|
|
432
|
+
def nameIs(astClass: type[hasDOTname], attributeCondition: Callable[[ast.Name], bool] | Callable[[str], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTname] | bool]:
|
|
433
433
|
|
|
434
434
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTname] | bool:
|
|
435
435
|
return isinstance(node, astClass) and node.name is not None and attributeCondition(node.name)
|
|
@@ -489,7 +489,7 @@ class ClassIsAndAttribute:
|
|
|
489
489
|
return workhorse
|
|
490
490
|
|
|
491
491
|
@staticmethod
|
|
492
|
-
def optional_varsIs(astClass: type[hasDOToptional_vars], attributeCondition: Callable[[ast.expr
|
|
492
|
+
def optional_varsIs(astClass: type[hasDOToptional_vars], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOToptional_vars] | bool]:
|
|
493
493
|
|
|
494
494
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOToptional_vars] | bool:
|
|
495
495
|
return isinstance(node, astClass) and node.optional_vars is not None and attributeCondition(node.optional_vars)
|
|
@@ -519,11 +519,11 @@ class ClassIsAndAttribute:
|
|
|
519
519
|
|
|
520
520
|
@staticmethod
|
|
521
521
|
@overload
|
|
522
|
-
def patternIs(astClass: type[hasDOTpattern_patternOrNone], attributeCondition: Callable[[ast.pattern
|
|
522
|
+
def patternIs(astClass: type[hasDOTpattern_patternOrNone], attributeCondition: Callable[[ast.pattern], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTpattern_patternOrNone] | bool]:
|
|
523
523
|
...
|
|
524
524
|
|
|
525
525
|
@staticmethod
|
|
526
|
-
def patternIs(astClass: type[hasDOTpattern], attributeCondition: Callable[[ast.pattern], bool]
|
|
526
|
+
def patternIs(astClass: type[hasDOTpattern], attributeCondition: Callable[[ast.pattern], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTpattern] | bool]:
|
|
527
527
|
|
|
528
528
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTpattern] | bool:
|
|
529
529
|
return isinstance(node, astClass) and node.pattern is not None and attributeCondition(node.pattern)
|
|
@@ -544,7 +544,7 @@ class ClassIsAndAttribute:
|
|
|
544
544
|
return workhorse
|
|
545
545
|
|
|
546
546
|
@staticmethod
|
|
547
|
-
def restIs(astClass: type[hasDOTrest], attributeCondition: Callable[[str
|
|
547
|
+
def restIs(astClass: type[hasDOTrest], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTrest] | bool]:
|
|
548
548
|
|
|
549
549
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTrest] | bool:
|
|
550
550
|
return isinstance(node, astClass) and node.rest is not None and attributeCondition(node.rest)
|
|
@@ -557,11 +557,11 @@ class ClassIsAndAttribute:
|
|
|
557
557
|
|
|
558
558
|
@staticmethod
|
|
559
559
|
@overload
|
|
560
|
-
def returnsIs(astClass: type[hasDOTreturns_exprOrNone], attributeCondition: Callable[[ast.expr
|
|
560
|
+
def returnsIs(astClass: type[hasDOTreturns_exprOrNone], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTreturns_exprOrNone] | bool]:
|
|
561
561
|
...
|
|
562
562
|
|
|
563
563
|
@staticmethod
|
|
564
|
-
def returnsIs(astClass: type[hasDOTreturns], attributeCondition: Callable[[ast.expr], bool]
|
|
564
|
+
def returnsIs(astClass: type[hasDOTreturns], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTreturns] | bool]:
|
|
565
565
|
|
|
566
566
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTreturns] | bool:
|
|
567
567
|
return isinstance(node, astClass) and node.returns is not None and attributeCondition(node.returns)
|
|
@@ -589,7 +589,7 @@ class ClassIsAndAttribute:
|
|
|
589
589
|
return workhorse
|
|
590
590
|
|
|
591
591
|
@staticmethod
|
|
592
|
-
def stepIs(astClass: type[hasDOTstep], attributeCondition: Callable[[ast.expr
|
|
592
|
+
def stepIs(astClass: type[hasDOTstep], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTstep] | bool]:
|
|
593
593
|
|
|
594
594
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTstep] | bool:
|
|
595
595
|
return isinstance(node, astClass) and node.step is not None and attributeCondition(node.step)
|
|
@@ -646,14 +646,14 @@ class ClassIsAndAttribute:
|
|
|
646
646
|
return workhorse
|
|
647
647
|
|
|
648
648
|
@staticmethod
|
|
649
|
-
def typeIs(astClass: type[hasDOTtype], attributeCondition: Callable[[ast.expr
|
|
649
|
+
def typeIs(astClass: type[hasDOTtype], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTtype] | bool]:
|
|
650
650
|
|
|
651
651
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTtype] | bool:
|
|
652
652
|
return isinstance(node, astClass) and node.type is not None and attributeCondition(node.type)
|
|
653
653
|
return workhorse
|
|
654
654
|
|
|
655
655
|
@staticmethod
|
|
656
|
-
def type_commentIs(astClass: type[hasDOTtype_comment], attributeCondition: Callable[[str
|
|
656
|
+
def type_commentIs(astClass: type[hasDOTtype_comment], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTtype_comment] | bool]:
|
|
657
657
|
|
|
658
658
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTtype_comment] | bool:
|
|
659
659
|
return isinstance(node, astClass) and node.type_comment is not None and attributeCondition(node.type_comment)
|
|
@@ -674,7 +674,7 @@ class ClassIsAndAttribute:
|
|
|
674
674
|
return workhorse
|
|
675
675
|
|
|
676
676
|
@staticmethod
|
|
677
|
-
def upperIs(astClass: type[hasDOTupper], attributeCondition: Callable[[ast.expr
|
|
677
|
+
def upperIs(astClass: type[hasDOTupper], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTupper] | bool]:
|
|
678
678
|
|
|
679
679
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTupper] | bool:
|
|
680
680
|
return isinstance(node, astClass) and node.upper is not None and attributeCondition(node.upper)
|
|
@@ -687,7 +687,7 @@ class ClassIsAndAttribute:
|
|
|
687
687
|
|
|
688
688
|
@staticmethod
|
|
689
689
|
@overload
|
|
690
|
-
def valueIs(astClass: type[hasDOTvalue_boolOrNone], attributeCondition: Callable[[bool
|
|
690
|
+
def valueIs(astClass: type[hasDOTvalue_boolOrNone], attributeCondition: Callable[[bool], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTvalue_boolOrNone] | bool]:
|
|
691
691
|
...
|
|
692
692
|
|
|
693
693
|
@staticmethod
|
|
@@ -697,11 +697,11 @@ class ClassIsAndAttribute:
|
|
|
697
697
|
|
|
698
698
|
@staticmethod
|
|
699
699
|
@overload
|
|
700
|
-
def valueIs(astClass: type[hasDOTvalue_exprOrNone], attributeCondition: Callable[[ast.expr
|
|
700
|
+
def valueIs(astClass: type[hasDOTvalue_exprOrNone], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTvalue_exprOrNone] | bool]:
|
|
701
701
|
...
|
|
702
702
|
|
|
703
703
|
@staticmethod
|
|
704
|
-
def valueIs(astClass: type[hasDOTvalue], attributeCondition: Callable[[Any], bool] | Callable[[bool
|
|
704
|
+
def valueIs(astClass: type[hasDOTvalue], attributeCondition: Callable[[Any], bool] | Callable[[bool], bool] | Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTvalue] | bool]:
|
|
705
705
|
|
|
706
706
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTvalue] | bool:
|
|
707
707
|
return isinstance(node, astClass) and node.value is not None and attributeCondition(node.value)
|
|
@@ -715,8 +715,8 @@ class ClassIsAndAttribute:
|
|
|
715
715
|
return workhorse
|
|
716
716
|
|
|
717
717
|
@staticmethod
|
|
718
|
-
def varargIs(astClass: type[hasDOTvararg], attributeCondition: Callable[[ast.arg
|
|
718
|
+
def varargIs(astClass: type[hasDOTvararg], attributeCondition: Callable[[ast.arg], bool]) -> Callable[[ast.AST], TypeGuard[hasDOTvararg] | bool]:
|
|
719
719
|
|
|
720
720
|
def workhorse(node: ast.AST) -> TypeGuard[hasDOTvararg] | bool:
|
|
721
721
|
return isinstance(node, astClass) and node.vararg is not None and attributeCondition(node.vararg)
|
|
722
|
-
return workhorse
|
|
722
|
+
return workhorse
|
|
@@ -25,11 +25,11 @@ class DOT:
|
|
|
25
25
|
|
|
26
26
|
@staticmethod
|
|
27
27
|
@overload
|
|
28
|
-
def annotation(node: hasDOTannotation_exprOrNone) -> ast.expr
|
|
28
|
+
def annotation(node: hasDOTannotation_exprOrNone) -> ast.expr:
|
|
29
29
|
...
|
|
30
30
|
|
|
31
31
|
@staticmethod
|
|
32
|
-
def annotation(node: hasDOTannotation) -> ast.expr
|
|
32
|
+
def annotation(node: hasDOTannotation) -> ast.expr:
|
|
33
33
|
return node.annotation
|
|
34
34
|
|
|
35
35
|
@staticmethod
|
|
@@ -39,11 +39,11 @@ class DOT:
|
|
|
39
39
|
|
|
40
40
|
@staticmethod
|
|
41
41
|
@overload
|
|
42
|
-
def arg(node: hasDOTarg_strOrNone) -> str
|
|
42
|
+
def arg(node: hasDOTarg_strOrNone) -> str:
|
|
43
43
|
...
|
|
44
44
|
|
|
45
45
|
@staticmethod
|
|
46
|
-
def arg(node: hasDOTarg) -> str
|
|
46
|
+
def arg(node: hasDOTarg) -> str:
|
|
47
47
|
return node.arg
|
|
48
48
|
|
|
49
49
|
@staticmethod
|
|
@@ -70,7 +70,7 @@ class DOT:
|
|
|
70
70
|
return node.argtypes
|
|
71
71
|
|
|
72
72
|
@staticmethod
|
|
73
|
-
def asname(node: hasDOTasname) -> str
|
|
73
|
+
def asname(node: hasDOTasname) -> str:
|
|
74
74
|
return node.asname
|
|
75
75
|
|
|
76
76
|
@staticmethod
|
|
@@ -96,7 +96,7 @@ class DOT:
|
|
|
96
96
|
return node.body
|
|
97
97
|
|
|
98
98
|
@staticmethod
|
|
99
|
-
def bound(node: hasDOTbound) -> ast.expr
|
|
99
|
+
def bound(node: hasDOTbound) -> ast.expr:
|
|
100
100
|
return node.bound
|
|
101
101
|
|
|
102
102
|
@staticmethod
|
|
@@ -104,7 +104,7 @@ class DOT:
|
|
|
104
104
|
return node.cases
|
|
105
105
|
|
|
106
106
|
@staticmethod
|
|
107
|
-
def cause(node: hasDOTcause) -> ast.expr
|
|
107
|
+
def cause(node: hasDOTcause) -> ast.expr:
|
|
108
108
|
return node.cause
|
|
109
109
|
|
|
110
110
|
@staticmethod
|
|
@@ -133,7 +133,7 @@ class DOT:
|
|
|
133
133
|
if sys.version_info >= (3, 13):
|
|
134
134
|
|
|
135
135
|
@staticmethod
|
|
136
|
-
def default_value(node: hasDOTdefault_value) -> ast.expr
|
|
136
|
+
def default_value(node: hasDOTdefault_value) -> ast.expr:
|
|
137
137
|
return node.default_value
|
|
138
138
|
|
|
139
139
|
@staticmethod
|
|
@@ -149,7 +149,7 @@ class DOT:
|
|
|
149
149
|
return node.elts
|
|
150
150
|
|
|
151
151
|
@staticmethod
|
|
152
|
-
def exc(node: hasDOTexc) -> ast.expr
|
|
152
|
+
def exc(node: hasDOTexc) -> ast.expr:
|
|
153
153
|
return node.exc
|
|
154
154
|
|
|
155
155
|
@staticmethod
|
|
@@ -157,7 +157,7 @@ class DOT:
|
|
|
157
157
|
return node.finalbody
|
|
158
158
|
|
|
159
159
|
@staticmethod
|
|
160
|
-
def format_spec(node: hasDOTformat_spec) -> ast.expr
|
|
160
|
+
def format_spec(node: hasDOTformat_spec) -> ast.expr:
|
|
161
161
|
return node.format_spec
|
|
162
162
|
|
|
163
163
|
@staticmethod
|
|
@@ -169,7 +169,7 @@ class DOT:
|
|
|
169
169
|
return node.generators
|
|
170
170
|
|
|
171
171
|
@staticmethod
|
|
172
|
-
def guard(node: hasDOTguard) -> ast.expr
|
|
172
|
+
def guard(node: hasDOTguard) -> ast.expr:
|
|
173
173
|
return node.guard
|
|
174
174
|
|
|
175
175
|
@staticmethod
|
|
@@ -207,11 +207,11 @@ class DOT:
|
|
|
207
207
|
|
|
208
208
|
@staticmethod
|
|
209
209
|
@overload
|
|
210
|
-
def keys(node: hasDOTkeys_list_exprOrNone) -> list[ast.expr
|
|
210
|
+
def keys(node: hasDOTkeys_list_exprOrNone) -> list[ast.expr]:
|
|
211
211
|
...
|
|
212
212
|
|
|
213
213
|
@staticmethod
|
|
214
|
-
def keys(node: hasDOTkeys) -> list[ast.expr]
|
|
214
|
+
def keys(node: hasDOTkeys) -> list[ast.expr]:
|
|
215
215
|
return node.keys
|
|
216
216
|
|
|
217
217
|
@staticmethod
|
|
@@ -219,15 +219,15 @@ class DOT:
|
|
|
219
219
|
return node.keywords
|
|
220
220
|
|
|
221
221
|
@staticmethod
|
|
222
|
-
def kind(node: hasDOTkind) -> str
|
|
222
|
+
def kind(node: hasDOTkind) -> str:
|
|
223
223
|
return node.kind
|
|
224
224
|
|
|
225
225
|
@staticmethod
|
|
226
|
-
def kw_defaults(node: hasDOTkw_defaults) -> list[ast.expr
|
|
226
|
+
def kw_defaults(node: hasDOTkw_defaults) -> list[ast.expr]:
|
|
227
227
|
return node.kw_defaults
|
|
228
228
|
|
|
229
229
|
@staticmethod
|
|
230
|
-
def kwarg(node: hasDOTkwarg) -> ast.arg
|
|
230
|
+
def kwarg(node: hasDOTkwarg) -> ast.arg:
|
|
231
231
|
return node.kwarg
|
|
232
232
|
|
|
233
233
|
@staticmethod
|
|
@@ -255,15 +255,15 @@ class DOT:
|
|
|
255
255
|
return node.lineno
|
|
256
256
|
|
|
257
257
|
@staticmethod
|
|
258
|
-
def lower(node: hasDOTlower) -> ast.expr
|
|
258
|
+
def lower(node: hasDOTlower) -> ast.expr:
|
|
259
259
|
return node.lower
|
|
260
260
|
|
|
261
261
|
@staticmethod
|
|
262
|
-
def module(node: hasDOTmodule) -> str
|
|
262
|
+
def module(node: hasDOTmodule) -> str:
|
|
263
263
|
return node.module
|
|
264
264
|
|
|
265
265
|
@staticmethod
|
|
266
|
-
def msg(node: hasDOTmsg) -> ast.expr
|
|
266
|
+
def msg(node: hasDOTmsg) -> ast.expr:
|
|
267
267
|
return node.msg
|
|
268
268
|
|
|
269
269
|
@staticmethod
|
|
@@ -278,11 +278,11 @@ class DOT:
|
|
|
278
278
|
|
|
279
279
|
@staticmethod
|
|
280
280
|
@overload
|
|
281
|
-
def name(node: hasDOTname_strOrNone) -> str
|
|
281
|
+
def name(node: hasDOTname_strOrNone) -> str:
|
|
282
282
|
...
|
|
283
283
|
|
|
284
284
|
@staticmethod
|
|
285
|
-
def name(node: hasDOTname) -> ast.Name | str
|
|
285
|
+
def name(node: hasDOTname) -> ast.Name | str:
|
|
286
286
|
return node.name
|
|
287
287
|
|
|
288
288
|
@staticmethod
|
|
@@ -327,7 +327,7 @@ class DOT:
|
|
|
327
327
|
return node.ops
|
|
328
328
|
|
|
329
329
|
@staticmethod
|
|
330
|
-
def optional_vars(node: hasDOToptional_vars) -> ast.expr
|
|
330
|
+
def optional_vars(node: hasDOToptional_vars) -> ast.expr:
|
|
331
331
|
return node.optional_vars
|
|
332
332
|
|
|
333
333
|
@staticmethod
|
|
@@ -351,11 +351,11 @@ class DOT:
|
|
|
351
351
|
|
|
352
352
|
@staticmethod
|
|
353
353
|
@overload
|
|
354
|
-
def pattern(node: hasDOTpattern_patternOrNone) -> ast.pattern
|
|
354
|
+
def pattern(node: hasDOTpattern_patternOrNone) -> ast.pattern:
|
|
355
355
|
...
|
|
356
356
|
|
|
357
357
|
@staticmethod
|
|
358
|
-
def pattern(node: hasDOTpattern) -> ast.pattern
|
|
358
|
+
def pattern(node: hasDOTpattern) -> ast.pattern:
|
|
359
359
|
return node.pattern
|
|
360
360
|
|
|
361
361
|
@staticmethod
|
|
@@ -367,7 +367,7 @@ class DOT:
|
|
|
367
367
|
return node.posonlyargs
|
|
368
368
|
|
|
369
369
|
@staticmethod
|
|
370
|
-
def rest(node: hasDOTrest) -> str
|
|
370
|
+
def rest(node: hasDOTrest) -> str:
|
|
371
371
|
return node.rest
|
|
372
372
|
|
|
373
373
|
@staticmethod
|
|
@@ -377,11 +377,11 @@ class DOT:
|
|
|
377
377
|
|
|
378
378
|
@staticmethod
|
|
379
379
|
@overload
|
|
380
|
-
def returns(node: hasDOTreturns_exprOrNone) -> ast.expr
|
|
380
|
+
def returns(node: hasDOTreturns_exprOrNone) -> ast.expr:
|
|
381
381
|
...
|
|
382
382
|
|
|
383
383
|
@staticmethod
|
|
384
|
-
def returns(node: hasDOTreturns) -> ast.expr
|
|
384
|
+
def returns(node: hasDOTreturns) -> ast.expr:
|
|
385
385
|
return node.returns
|
|
386
386
|
|
|
387
387
|
@staticmethod
|
|
@@ -397,7 +397,7 @@ class DOT:
|
|
|
397
397
|
return node.slice
|
|
398
398
|
|
|
399
399
|
@staticmethod
|
|
400
|
-
def step(node: hasDOTstep) -> ast.expr
|
|
400
|
+
def step(node: hasDOTstep) -> ast.expr:
|
|
401
401
|
return node.step
|
|
402
402
|
|
|
403
403
|
@staticmethod
|
|
@@ -436,11 +436,11 @@ class DOT:
|
|
|
436
436
|
return node.test
|
|
437
437
|
|
|
438
438
|
@staticmethod
|
|
439
|
-
def type(node: hasDOTtype) -> ast.expr
|
|
439
|
+
def type(node: hasDOTtype) -> ast.expr:
|
|
440
440
|
return node.type
|
|
441
441
|
|
|
442
442
|
@staticmethod
|
|
443
|
-
def type_comment(node: hasDOTtype_comment) -> str
|
|
443
|
+
def type_comment(node: hasDOTtype_comment) -> str:
|
|
444
444
|
return node.type_comment
|
|
445
445
|
|
|
446
446
|
@staticmethod
|
|
@@ -452,7 +452,7 @@ class DOT:
|
|
|
452
452
|
return node.type_params
|
|
453
453
|
|
|
454
454
|
@staticmethod
|
|
455
|
-
def upper(node: hasDOTupper) -> ast.expr
|
|
455
|
+
def upper(node: hasDOTupper) -> ast.expr:
|
|
456
456
|
return node.upper
|
|
457
457
|
|
|
458
458
|
@staticmethod
|
|
@@ -462,7 +462,7 @@ class DOT:
|
|
|
462
462
|
|
|
463
463
|
@staticmethod
|
|
464
464
|
@overload
|
|
465
|
-
def value(node: hasDOTvalue_boolOrNone) -> bool
|
|
465
|
+
def value(node: hasDOTvalue_boolOrNone) -> bool:
|
|
466
466
|
...
|
|
467
467
|
|
|
468
468
|
@staticmethod
|
|
@@ -472,11 +472,11 @@ class DOT:
|
|
|
472
472
|
|
|
473
473
|
@staticmethod
|
|
474
474
|
@overload
|
|
475
|
-
def value(node: hasDOTvalue_exprOrNone) -> ast.expr
|
|
475
|
+
def value(node: hasDOTvalue_exprOrNone) -> ast.expr:
|
|
476
476
|
...
|
|
477
477
|
|
|
478
478
|
@staticmethod
|
|
479
|
-
def value(node: hasDOTvalue) -> Any |
|
|
479
|
+
def value(node: hasDOTvalue) -> Any | bool | ast.expr:
|
|
480
480
|
return node.value
|
|
481
481
|
|
|
482
482
|
@staticmethod
|
|
@@ -484,5 +484,5 @@ class DOT:
|
|
|
484
484
|
return node.values
|
|
485
485
|
|
|
486
486
|
@staticmethod
|
|
487
|
-
def vararg(node: hasDOTvararg) -> ast.arg
|
|
488
|
-
return node.vararg
|
|
487
|
+
def vararg(node: hasDOTvararg) -> ast.arg:
|
|
488
|
+
return node.vararg
|