astToolkit 0.5.2__tar.gz → 0.5.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/PKG-INFO +1 -1
  2. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/__init__.py +7 -4
  3. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_astTypes.py +14 -1
  4. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_dumpHandmade.py +1 -1
  5. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_toolBe.py +26 -21
  6. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_toolClassIsAndAttribute.py +42 -213
  7. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_toolDOT.py +35 -36
  8. asttoolkit-0.5.3/astToolkit/_toolGrab.py +663 -0
  9. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_toolMake.py +505 -505
  10. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_toolkitContainers.py +1 -1
  11. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit.egg-info/PKG-INFO +1 -1
  12. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit.egg-info/SOURCES.txt +10 -1
  13. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/pyproject.toml +1 -1
  14. asttoolkit-0.5.3/tests/test_astConstant.py +221 -0
  15. asttoolkit-0.5.3/tests/test_astConstructors.py +416 -0
  16. asttoolkit-0.5.3/tests/test_astCopy.py +170 -0
  17. asttoolkit-0.5.3/tests/test_astCore.py +278 -0
  18. asttoolkit-0.5.3/tests/test_astHelpers.py +379 -0
  19. asttoolkit-0.5.3/tests/test_astValidation.py +421 -0
  20. asttoolkit-0.5.3/tests/test_copyOperations.py +178 -0
  21. asttoolkit-0.5.3/tests/test_endPositions.py +341 -0
  22. asttoolkit-0.5.3/tests/test_nodeVisitors.py +353 -0
  23. asttoolkit-0.5.2/astToolkit/_toolGrab.py +0 -661
  24. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/LICENSE +0 -0
  25. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/README.md +0 -0
  26. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_dumpFunctionDef.py +0 -0
  27. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_theSSOT.py +0 -0
  28. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_toolIfThis.py +0 -0
  29. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_toolThen.py +0 -0
  30. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_toolkitAST.py +0 -0
  31. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/_toolkitNodeVisitor.py +0 -0
  32. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/py.typed +0 -0
  33. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit/transformationTools.py +0 -0
  34. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit.egg-info/dependency_links.txt +0 -0
  35. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit.egg-info/requires.txt +0 -0
  36. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/astToolkit.egg-info/top_level.txt +0 -0
  37. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/setup.cfg +0 -0
  38. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/tests/conftest.py +0 -0
  39. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/tests/test_basic.py +0 -0
  40. {asttoolkit-0.5.2 → asttoolkit-0.5.3}/tests/test_joinClassmethod.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astToolkit
3
- Version: 0.5.2
3
+ Version: 0.5.3
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
@@ -14,9 +14,9 @@ from astToolkit._astTypes import (
14
14
  hasDOTcases as hasDOTcases, hasDOTcause as hasDOTcause, hasDOTcls as hasDOTcls,
15
15
  hasDOTcomparators as hasDOTcomparators, hasDOTcontext_expr as hasDOTcontext_expr,
16
16
  hasDOTconversion as hasDOTconversion, hasDOTctx as hasDOTctx,
17
- hasDOTdecorator_list as hasDOTdecorator_list,
18
- hasDOTdefaults as hasDOTdefaults, hasDOTelt as hasDOTelt, hasDOTelts as hasDOTelts,
19
- hasDOTexc as hasDOTexc, hasDOTfinalbody as hasDOTfinalbody, hasDOTformat_spec as hasDOTformat_spec,
17
+ hasDOTdecorator_list as hasDOTdecorator_list, hasDOTdefaults as hasDOTdefaults,
18
+ hasDOTelt as hasDOTelt, hasDOTelts as hasDOTelts, hasDOTexc as hasDOTexc,
19
+ hasDOTfinalbody as hasDOTfinalbody, hasDOTformat_spec as hasDOTformat_spec,
20
20
  hasDOTfunc as hasDOTfunc, hasDOTgenerators as hasDOTgenerators, hasDOTguard as hasDOTguard,
21
21
  hasDOThandlers as hasDOThandlers, hasDOTid as hasDOTid, hasDOTifs as hasDOTifs,
22
22
  hasDOTis_async as hasDOTis_async, hasDOTitems as hasDOTitems, hasDOTiter as hasDOTiter,
@@ -50,8 +50,11 @@ from astToolkit._astTypes import (
50
50
  hasDOTvalue_ConstantValueType as hasDOTvalue_ConstantValueType,
51
51
  hasDOTvalue_expr as hasDOTvalue_expr, hasDOTvalue_exprOrNone as hasDOTvalue_exprOrNone,
52
52
  hasDOTvalues as hasDOTvalues, hasDOTvararg as hasDOTvararg,
53
- identifierDotAttribute as identifierDotAttribute, 个 as 个, 个return as 个return, as 木,
53
+ identifierDotAttribute as identifierDotAttribute, 一符 as 一符, 个 as 个, 个return as 个return, 二符 as 二符,
54
+ 俪 as 俪, 口 as 口, 工 as 工, 工位 as 工位, 布尔符 as 布尔符, 常 as 常, 形 as 形, 忽 as 忽, 拦 as 拦, 木 as 木, 本 as 本,
55
+ 比符 as 比符,
54
56
  )
57
+
55
58
  if sys.version_info >= (3, 13):
56
59
  from astToolkit._astTypes import hasDOTdefault_value as hasDOTdefault_value
57
60
 
@@ -7,9 +7,22 @@ import sys
7
7
 
8
8
  ConstantValueType: typing_TypeAlias = bool | bytes | complex | EllipsisType | float | int | None | range | str
9
9
  identifierDotAttribute: typing_TypeAlias = str
10
- 木 = typing_TypeVar('木', bound=ast.AST, covariant=True)
11
10
  个 = typing_TypeVar('个', covariant=True)
12
11
  个return = typing_TypeVar('个return', covariant=True)
12
+ 木 = typing_TypeVar('木', bound=ast.AST, covariant=True)
13
+ 布尔符 = typing_TypeVar('布尔符', bound=ast.boolop, covariant=True)
14
+ 比符 = typing_TypeVar('比符', bound=ast.cmpop, covariant=True)
15
+ 常 = typing_TypeVar('常', bound=ast.Constant, covariant=True)
16
+ 拦 = typing_TypeVar('拦', bound=ast.excepthandler, covariant=True)
17
+ 工位 = typing_TypeVar('工位', bound=ast.expr_context, covariant=True)
18
+ 工 = typing_TypeVar('工', bound=ast.expr, covariant=True)
19
+ 本 = typing_TypeVar('本', bound=ast.mod, covariant=True)
20
+ 二符 = typing_TypeVar('二符', bound=ast.operator, covariant=True)
21
+ 俪 = typing_TypeVar('俪', bound=ast.pattern, covariant=True)
22
+ 口 = typing_TypeVar('口', bound=ast.stmt, covariant=True)
23
+ 忽 = typing_TypeVar('忽', bound=ast.type_ignore, covariant=True)
24
+ 形 = typing_TypeVar('形', bound=ast.type_param, covariant=True)
25
+ 一符 = typing_TypeVar('一符', bound=ast.unaryop, covariant=True)
13
26
 
14
27
  class _attributes(TypedDict, total=False):
15
28
  lineno: int
@@ -41,7 +41,7 @@ def dump(node: AST, annotate_fields: bool = True, include_attributes: bool = Fal
41
41
  continue
42
42
  if not show_empty:
43
43
  if value == []:
44
- field_type = cls._field_types.get(name, object)
44
+ field_type: ConstantValueType | AST | list[AST] | list[str] = cls._field_types.get(name, object)
45
45
  if getattr(field_type, '__origin__', ...) is list:
46
46
  if not keywords:
47
47
  args_buffer.append(repr(value))
@@ -3,27 +3,26 @@ from typing_extensions import TypeIs
3
3
  import ast
4
4
 
5
5
  class Be:
6
- """Type guard functions for safe AST node identification and type narrowing.
7
- (AI generated docstring)
6
+ """A comprehensive suite of functions for AST class identification and type narrowing.
8
7
 
9
- Provides static methods that perform runtime type checking for all AST node types
10
- while enabling compile-time type narrowing through `TypeIs` annotations. Forms
11
- the foundation of type-safe AST analysis and transformation throughout the toolkit.
8
+ `class` `Be` has a method for each `ast.AST` subclass, also called "node type", to perform type
9
+ checking while enabling compile-time type narrowing through `TypeIs` annotations. This tool
10
+ forms the foundation of type-safe AST analysis and transformation throughout astToolkit.
12
11
 
13
- Each method takes an `ast.AST` node and returns a `TypeIs` that confirms both
14
- runtime type safety and enables static type checkers to narrow the node type in
15
- conditional contexts. This eliminates the need for unsafe casting while providing
16
- comprehensive coverage of Python's AST node hierarchy.
12
+ Each method takes an `ast.AST` node and returns a `TypeIs` that confirms both runtime type
13
+ safety and enables static type checkers to narrow the node type in conditional contexts. This
14
+ eliminates the need for unsafe casting while providing comprehensive coverage of Python's AST
15
+ node hierarchy.
17
16
 
18
- Methods correspond directly to Python AST node types, following the naming convention
19
- of the AST classes themselves. Coverage includes expression nodes (`Add`, `Call`,
20
- `Name`), statement nodes (`Assign`, `FunctionDef`, `Return`), operator nodes
21
- (`And`, `Or`, `Not`), and structural nodes (`Module`, `arguments`, `keyword`).
17
+ Methods correspond directly to Python AST node types, following the naming convention of the AST
18
+ classes themselves. Coverage includes expression nodes (`Add`, `Call`, `Name`), statement nodes
19
+ (`Assign`, `FunctionDef`, `Return`), operator nodes (`And`, `Or`, `Not`), and structural nodes
20
+ (`Module`, `arguments`, `keyword`).
22
21
 
23
- The class serves as the primary type-checking component in the antecedent-action
24
- pattern, where predicates identify target nodes and actions specify operations.
25
- Type guards from this class are commonly used as building blocks in `IfThis`
26
- predicates and directly as `findThis` parameters in visitor classes.
22
+ The `class` is the primary type-checker in the antecedent-action pattern, where
23
+ predicates identify target nodes and actions, uh... act on nodes and their attributes. Type guards from this class are
24
+ commonly used as building blocks in `IfThis` predicates and directly as `findThis` parameters in
25
+ visitor classes.
27
26
 
28
27
  Parameters:
29
28
 
@@ -37,18 +36,24 @@ class Be:
37
36
 
38
37
  Type-safe node processing with automatic type narrowing:
39
38
 
39
+ ```python
40
40
  if Be.FunctionDef(node):
41
- functionName = node.name # Type-safe access to name attribute
42
- parameterCount = len(node.args.args)
41
+ functionName = node.name # Type-safe access to name attribute parameterCount =
42
+ len(node.args.args)
43
+ ```
43
44
 
44
- Building complex predicates for visitor patterns:
45
+ Using type guards in visitor patterns:
45
46
 
47
+ ```python
46
48
  NodeTourist(Be.Return, Then.extractIt(DOT.value)).visit(functionNode)
49
+ ```
47
50
 
48
- Combining type guards in conditional logic:
51
+ Type-safe access to attributes of specific node types:
49
52
 
53
+ ```python
50
54
  if Be.Call(node) and Be.Name(node.func):
51
55
  callableName = node.func.id # Type-safe access to function name
56
+ ```
52
57
  """
53
58
 
54
59
  @staticmethod
@@ -1,31 +1,20 @@
1
1
  # pyright: reportMatchNotExhaustive=false
2
- # pyright: reportArgumentType=false
3
2
  """This file is generated automatically, so changes to this file will be lost."""
4
3
  from astToolkit import (
5
- ConstantValueType, hasDOTannotation, hasDOTannotation_expr, hasDOTannotation_exprOrNone, hasDOTarg,
6
- hasDOTarg_str, hasDOTarg_strOrNone, hasDOTargs, hasDOTargs_arguments, hasDOTargs_list_arg,
7
- hasDOTargs_list_expr, hasDOTargtypes, hasDOTasname, hasDOTattr, hasDOTbases, hasDOTbody,
8
- hasDOTbody_expr, hasDOTbody_list_stmt, hasDOTbound, hasDOTcases, hasDOTcause, hasDOTcls,
4
+ ConstantValueType, hasDOTannotation, hasDOTarg, hasDOTargs, hasDOTargtypes, hasDOTasname,
5
+ hasDOTattr, hasDOTbases, hasDOTbody, hasDOTbound, hasDOTcases, hasDOTcause, hasDOTcls,
9
6
  hasDOTcomparators, hasDOTcontext_expr, hasDOTconversion, hasDOTctx, hasDOTdecorator_list,
10
7
  hasDOTdefaults, hasDOTelt, hasDOTelts, hasDOTexc, hasDOTfinalbody, hasDOTformat_spec, hasDOTfunc,
11
8
  hasDOTgenerators, hasDOTguard, hasDOThandlers, hasDOTid, hasDOTifs, hasDOTis_async, hasDOTitems,
12
- hasDOTiter, hasDOTkey, hasDOTkeys, hasDOTkeys_list_expr, hasDOTkeys_list_exprOrNone,
13
- hasDOTkeywords, hasDOTkind, hasDOTkw_defaults, hasDOTkwarg, hasDOTkwd_attrs, hasDOTkwd_patterns,
14
- hasDOTkwonlyargs, hasDOTleft, hasDOTlevel, hasDOTlineno, hasDOTlower, hasDOTmodule, hasDOTmsg,
15
- hasDOTname, hasDOTname_Name, hasDOTname_str, hasDOTname_strOrNone, hasDOTnames,
16
- hasDOTnames_list_alias, hasDOTnames_list_str, hasDOTop, hasDOTop_boolop, hasDOTop_operator,
17
- hasDOTop_unaryop, hasDOToperand, hasDOTops, hasDOToptional_vars, hasDOTorelse, hasDOTorelse_expr,
18
- hasDOTorelse_list_stmt, hasDOTpattern, hasDOTpattern_pattern, hasDOTpattern_patternOrNone,
19
- hasDOTpatterns, hasDOTposonlyargs, hasDOTrest, hasDOTreturns, hasDOTreturns_expr,
20
- hasDOTreturns_exprOrNone, hasDOTright, hasDOTsimple, hasDOTslice, hasDOTstep, hasDOTsubject,
21
- hasDOTtag, hasDOTtarget, hasDOTtarget_expr, hasDOTtarget_Name,
22
- hasDOTtarget_NameOrAttributeOrSubscript, hasDOTtargets, hasDOTtest, hasDOTtype, hasDOTtype_comment,
23
- hasDOTtype_ignores, hasDOTtype_params, hasDOTupper, hasDOTvalue, hasDOTvalue_boolOrNone,
24
- hasDOTvalue_ConstantValueType, hasDOTvalue_expr, hasDOTvalue_exprOrNone, hasDOTvalues,
25
- hasDOTvararg,
9
+ hasDOTiter, hasDOTkey, hasDOTkeys, hasDOTkeywords, hasDOTkind, hasDOTkw_defaults, hasDOTkwarg,
10
+ hasDOTkwd_attrs, hasDOTkwd_patterns, hasDOTkwonlyargs, hasDOTleft, hasDOTlevel, hasDOTlineno,
11
+ hasDOTlower, hasDOTmodule, hasDOTmsg, hasDOTname, hasDOTnames, hasDOTop, hasDOToperand, hasDOTops,
12
+ hasDOToptional_vars, hasDOTorelse, hasDOTpattern, hasDOTpatterns, hasDOTposonlyargs, hasDOTrest,
13
+ hasDOTreturns, hasDOTright, hasDOTsimple, hasDOTslice, hasDOTstep, hasDOTsubject, hasDOTtag,
14
+ hasDOTtarget, hasDOTtargets, hasDOTtest, hasDOTtype, hasDOTtype_comment, hasDOTtype_ignores,
15
+ hasDOTtype_params, hasDOTupper, hasDOTvalue, hasDOTvalues, hasDOTvararg,
26
16
  )
27
17
  from collections.abc import Callable, Sequence
28
- from typing import overload
29
18
  from typing_extensions import TypeIs
30
19
  import ast
31
20
  import sys
@@ -49,56 +38,21 @@ class ClassIsAndAttribute:
49
38
  """
50
39
 
51
40
  @staticmethod
52
- @overload
53
- def annotationIs(astClass: type[hasDOTannotation_expr], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTannotation_expr] | bool]:
54
- ...
55
-
56
- @staticmethod
57
- @overload
58
- def annotationIs(astClass: type[hasDOTannotation_exprOrNone], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTannotation_exprOrNone] | bool]:
59
- ...
60
-
61
- @staticmethod
62
- def annotationIs(astClass: type[hasDOTannotation], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTannotation] | bool]:
41
+ def annotationIs(astClass: type[hasDOTannotation], attributeCondition: Callable[[ast.expr | (ast.expr | None)], bool]) -> Callable[[ast.AST], TypeIs[hasDOTannotation] | bool]:
63
42
 
64
43
  def workhorse(node: ast.AST) -> TypeIs[hasDOTannotation] | bool:
65
44
  return isinstance(node, astClass) and node.annotation is not None and attributeCondition(node.annotation)
66
45
  return workhorse
67
46
 
68
47
  @staticmethod
69
- @overload
70
- def argIs(astClass: type[hasDOTarg_str], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTarg_str] | bool]:
71
- ...
72
-
73
- @staticmethod
74
- @overload
75
- def argIs(astClass: type[hasDOTarg_strOrNone], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTarg_strOrNone] | bool]:
76
- ...
77
-
78
- @staticmethod
79
- def argIs(astClass: type[hasDOTarg], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTarg] | bool]:
48
+ def argIs(astClass: type[hasDOTarg], attributeCondition: Callable[[str | (str | None)], bool]) -> Callable[[ast.AST], TypeIs[hasDOTarg] | bool]:
80
49
 
81
50
  def workhorse(node: ast.AST) -> TypeIs[hasDOTarg] | bool:
82
51
  return isinstance(node, astClass) and node.arg is not None and attributeCondition(node.arg)
83
52
  return workhorse
84
53
 
85
54
  @staticmethod
86
- @overload
87
- def argsIs(astClass: type[hasDOTargs_arguments], attributeCondition: Callable[[ast.arguments], bool]) -> Callable[[ast.AST], TypeIs[hasDOTargs_arguments] | bool]:
88
- ...
89
-
90
- @staticmethod
91
- @overload
92
- def argsIs(astClass: type[hasDOTargs_list_arg], attributeCondition: Callable[[list[ast.arg]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTargs_list_arg] | bool]:
93
- ...
94
-
95
- @staticmethod
96
- @overload
97
- def argsIs(astClass: type[hasDOTargs_list_expr], attributeCondition: Callable[[Sequence[ast.expr]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTargs_list_expr] | bool]:
98
- ...
99
-
100
- @staticmethod
101
- def argsIs(astClass: type[hasDOTargs], attributeCondition: Callable[[ast.arguments], bool] | Callable[[list[ast.arg]], bool] | Callable[[Sequence[ast.expr]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTargs] | bool]:
55
+ def argsIs(astClass: type[hasDOTargs], attributeCondition: Callable[[ast.arguments | list[ast.arg] | Sequence[ast.expr]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTargs] | bool]:
102
56
 
103
57
  def workhorse(node: ast.AST) -> TypeIs[hasDOTargs] | bool:
104
58
  return isinstance(node, astClass) and attributeCondition(node.args)
@@ -112,7 +66,7 @@ class ClassIsAndAttribute:
112
66
  return workhorse
113
67
 
114
68
  @staticmethod
115
- def asnameIs(astClass: type[hasDOTasname], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTasname] | bool]:
69
+ def asnameIs(astClass: type[hasDOTasname], attributeCondition: Callable[[str | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTasname] | bool]:
116
70
 
117
71
  def workhorse(node: ast.AST) -> TypeIs[hasDOTasname] | bool:
118
72
  return isinstance(node, astClass) and node.asname is not None and attributeCondition(node.asname)
@@ -133,24 +87,14 @@ class ClassIsAndAttribute:
133
87
  return workhorse
134
88
 
135
89
  @staticmethod
136
- @overload
137
- def bodyIs(astClass: type[hasDOTbody_expr], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTbody_expr] | bool]:
138
- ...
139
-
140
- @staticmethod
141
- @overload
142
- def bodyIs(astClass: type[hasDOTbody_list_stmt], attributeCondition: Callable[[Sequence[ast.stmt]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTbody_list_stmt] | bool]:
143
- ...
144
-
145
- @staticmethod
146
- def bodyIs(astClass: type[hasDOTbody], attributeCondition: Callable[[ast.expr], bool] | Callable[[Sequence[ast.stmt]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTbody] | bool]:
90
+ def bodyIs(astClass: type[hasDOTbody], attributeCondition: Callable[[ast.expr | Sequence[ast.stmt]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTbody] | bool]:
147
91
 
148
92
  def workhorse(node: ast.AST) -> TypeIs[hasDOTbody] | bool:
149
93
  return isinstance(node, astClass) and attributeCondition(node.body)
150
94
  return workhorse
151
95
 
152
96
  @staticmethod
153
- def boundIs(astClass: type[hasDOTbound], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTbound] | bool]:
97
+ def boundIs(astClass: type[hasDOTbound], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTbound] | bool]:
154
98
 
155
99
  def workhorse(node: ast.AST) -> TypeIs[hasDOTbound] | bool:
156
100
  return isinstance(node, astClass) and node.bound is not None and attributeCondition(node.bound)
@@ -164,7 +108,7 @@ class ClassIsAndAttribute:
164
108
  return workhorse
165
109
 
166
110
  @staticmethod
167
- def causeIs(astClass: type[hasDOTcause], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTcause] | bool]:
111
+ def causeIs(astClass: type[hasDOTcause], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTcause] | bool]:
168
112
 
169
113
  def workhorse(node: ast.AST) -> TypeIs[hasDOTcause] | bool:
170
114
  return isinstance(node, astClass) and node.cause is not None and attributeCondition(node.cause)
@@ -215,7 +159,7 @@ class ClassIsAndAttribute:
215
159
  case version if version >= (3, 13):
216
160
 
217
161
  @staticmethod
218
- def default_valueIs(astClass: type[hasDOTdefault_value], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTdefault_value] | bool]:
162
+ def default_valueIs(astClass: type[hasDOTdefault_value], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTdefault_value] | bool]:
219
163
 
220
164
  def workhorse(node: ast.AST) -> TypeIs[hasDOTdefault_value] | bool:
221
165
  return isinstance(node, astClass) and node.default_value is not None and attributeCondition(node.default_value)
@@ -243,7 +187,7 @@ class ClassIsAndAttribute:
243
187
  return workhorse
244
188
 
245
189
  @staticmethod
246
- def excIs(astClass: type[hasDOTexc], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTexc] | bool]:
190
+ def excIs(astClass: type[hasDOTexc], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTexc] | bool]:
247
191
 
248
192
  def workhorse(node: ast.AST) -> TypeIs[hasDOTexc] | bool:
249
193
  return isinstance(node, astClass) and node.exc is not None and attributeCondition(node.exc)
@@ -257,7 +201,7 @@ class ClassIsAndAttribute:
257
201
  return workhorse
258
202
 
259
203
  @staticmethod
260
- def format_specIs(astClass: type[hasDOTformat_spec], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTformat_spec] | bool]:
204
+ def format_specIs(astClass: type[hasDOTformat_spec], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTformat_spec] | bool]:
261
205
 
262
206
  def workhorse(node: ast.AST) -> TypeIs[hasDOTformat_spec] | bool:
263
207
  return isinstance(node, astClass) and node.format_spec is not None and attributeCondition(node.format_spec)
@@ -278,7 +222,7 @@ class ClassIsAndAttribute:
278
222
  return workhorse
279
223
 
280
224
  @staticmethod
281
- def guardIs(astClass: type[hasDOTguard], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTguard] | bool]:
225
+ def guardIs(astClass: type[hasDOTguard], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTguard] | bool]:
282
226
 
283
227
  def workhorse(node: ast.AST) -> TypeIs[hasDOTguard] | bool:
284
228
  return isinstance(node, astClass) and node.guard is not None and attributeCondition(node.guard)
@@ -334,17 +278,7 @@ class ClassIsAndAttribute:
334
278
  return workhorse
335
279
 
336
280
  @staticmethod
337
- @overload
338
- def keysIs(astClass: type[hasDOTkeys_list_expr], attributeCondition: Callable[[Sequence[ast.expr]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkeys_list_expr] | bool]:
339
- ...
340
-
341
- @staticmethod
342
- @overload
343
- def keysIs(astClass: type[hasDOTkeys_list_exprOrNone], attributeCondition: Callable[[Sequence[ast.expr]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkeys_list_exprOrNone] | bool]:
344
- ...
345
-
346
- @staticmethod
347
- def keysIs(astClass: type[hasDOTkeys], attributeCondition: Callable[[Sequence[ast.expr]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkeys] | bool]:
281
+ def keysIs(astClass: type[hasDOTkeys], attributeCondition: Callable[[Sequence[ast.expr | None] | Sequence[ast.expr]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkeys] | bool]:
348
282
 
349
283
  def workhorse(node: ast.AST) -> TypeIs[hasDOTkeys] | bool:
350
284
  return isinstance(node, astClass) and node.keys != [None] and attributeCondition(node.keys)
@@ -358,21 +292,21 @@ class ClassIsAndAttribute:
358
292
  return workhorse
359
293
 
360
294
  @staticmethod
361
- def kindIs(astClass: type[hasDOTkind], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkind] | bool]:
295
+ def kindIs(astClass: type[hasDOTkind], attributeCondition: Callable[[str | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkind] | bool]:
362
296
 
363
297
  def workhorse(node: ast.AST) -> TypeIs[hasDOTkind] | bool:
364
298
  return isinstance(node, astClass) and node.kind is not None and attributeCondition(node.kind)
365
299
  return workhorse
366
300
 
367
301
  @staticmethod
368
- def kw_defaultsIs(astClass: type[hasDOTkw_defaults], attributeCondition: Callable[[Sequence[ast.expr]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkw_defaults] | bool]:
302
+ def kw_defaultsIs(astClass: type[hasDOTkw_defaults], attributeCondition: Callable[[Sequence[ast.expr | None]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkw_defaults] | bool]:
369
303
 
370
304
  def workhorse(node: ast.AST) -> TypeIs[hasDOTkw_defaults] | bool:
371
305
  return isinstance(node, astClass) and node.kw_defaults != [None] and attributeCondition(node.kw_defaults)
372
306
  return workhorse
373
307
 
374
308
  @staticmethod
375
- def kwargIs(astClass: type[hasDOTkwarg], attributeCondition: Callable[[ast.arg], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkwarg] | bool]:
309
+ def kwargIs(astClass: type[hasDOTkwarg], attributeCondition: Callable[[ast.arg | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTkwarg] | bool]:
376
310
 
377
311
  def workhorse(node: ast.AST) -> TypeIs[hasDOTkwarg] | bool:
378
312
  return isinstance(node, astClass) and node.kwarg is not None and attributeCondition(node.kwarg)
@@ -421,82 +355,42 @@ class ClassIsAndAttribute:
421
355
  return workhorse
422
356
 
423
357
  @staticmethod
424
- def lowerIs(astClass: type[hasDOTlower], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTlower] | bool]:
358
+ def lowerIs(astClass: type[hasDOTlower], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTlower] | bool]:
425
359
 
426
360
  def workhorse(node: ast.AST) -> TypeIs[hasDOTlower] | bool:
427
361
  return isinstance(node, astClass) and node.lower is not None and attributeCondition(node.lower)
428
362
  return workhorse
429
363
 
430
364
  @staticmethod
431
- def moduleIs(astClass: type[hasDOTmodule], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTmodule] | bool]:
365
+ def moduleIs(astClass: type[hasDOTmodule], attributeCondition: Callable[[str | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTmodule] | bool]:
432
366
 
433
367
  def workhorse(node: ast.AST) -> TypeIs[hasDOTmodule] | bool:
434
368
  return isinstance(node, astClass) and node.module is not None and attributeCondition(node.module)
435
369
  return workhorse
436
370
 
437
371
  @staticmethod
438
- def msgIs(astClass: type[hasDOTmsg], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTmsg] | bool]:
372
+ def msgIs(astClass: type[hasDOTmsg], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTmsg] | bool]:
439
373
 
440
374
  def workhorse(node: ast.AST) -> TypeIs[hasDOTmsg] | bool:
441
375
  return isinstance(node, astClass) and node.msg is not None and attributeCondition(node.msg)
442
376
  return workhorse
443
377
 
444
378
  @staticmethod
445
- @overload
446
- def nameIs(astClass: type[hasDOTname_Name], attributeCondition: Callable[[ast.Name], bool]) -> Callable[[ast.AST], TypeIs[hasDOTname_Name] | bool]:
447
- ...
448
-
449
- @staticmethod
450
- @overload
451
- def nameIs(astClass: type[hasDOTname_str], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTname_str] | bool]:
452
- ...
453
-
454
- @staticmethod
455
- @overload
456
- def nameIs(astClass: type[hasDOTname_strOrNone], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTname_strOrNone] | bool]:
457
- ...
458
-
459
- @staticmethod
460
- def nameIs(astClass: type[hasDOTname], attributeCondition: Callable[[ast.Name], bool] | Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTname] | bool]:
379
+ def nameIs(astClass: type[hasDOTname], attributeCondition: Callable[[ast.Name | str | (str | None)], bool]) -> Callable[[ast.AST], TypeIs[hasDOTname] | bool]:
461
380
 
462
381
  def workhorse(node: ast.AST) -> TypeIs[hasDOTname] | bool:
463
382
  return isinstance(node, astClass) and node.name is not None and attributeCondition(node.name)
464
383
  return workhorse
465
384
 
466
385
  @staticmethod
467
- @overload
468
- def namesIs(astClass: type[hasDOTnames_list_alias], attributeCondition: Callable[[list[ast.alias]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTnames_list_alias] | bool]:
469
- ...
470
-
471
- @staticmethod
472
- @overload
473
- def namesIs(astClass: type[hasDOTnames_list_str], attributeCondition: Callable[[list[str]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTnames_list_str] | bool]:
474
- ...
475
-
476
- @staticmethod
477
- def namesIs(astClass: type[hasDOTnames], attributeCondition: Callable[[list[ast.alias]], bool] | Callable[[list[str]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTnames] | bool]:
386
+ def namesIs(astClass: type[hasDOTnames], attributeCondition: Callable[[list[ast.alias] | list[str]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTnames] | bool]:
478
387
 
479
388
  def workhorse(node: ast.AST) -> TypeIs[hasDOTnames] | bool:
480
389
  return isinstance(node, astClass) and attributeCondition(node.names)
481
390
  return workhorse
482
391
 
483
392
  @staticmethod
484
- @overload
485
- def opIs(astClass: type[hasDOTop_boolop], attributeCondition: Callable[[ast.boolop], bool]) -> Callable[[ast.AST], TypeIs[hasDOTop_boolop] | bool]:
486
- ...
487
-
488
- @staticmethod
489
- @overload
490
- def opIs(astClass: type[hasDOTop_operator], attributeCondition: Callable[[ast.operator], bool]) -> Callable[[ast.AST], TypeIs[hasDOTop_operator] | bool]:
491
- ...
492
-
493
- @staticmethod
494
- @overload
495
- def opIs(astClass: type[hasDOTop_unaryop], attributeCondition: Callable[[ast.unaryop], bool]) -> Callable[[ast.AST], TypeIs[hasDOTop_unaryop] | bool]:
496
- ...
497
-
498
- @staticmethod
499
- def opIs(astClass: type[hasDOTop], attributeCondition: Callable[[ast.boolop], bool] | Callable[[ast.operator], bool] | Callable[[ast.unaryop], bool]) -> Callable[[ast.AST], TypeIs[hasDOTop] | bool]:
393
+ def opIs(astClass: type[hasDOTop], attributeCondition: Callable[[ast.boolop | ast.operator | ast.unaryop], bool]) -> Callable[[ast.AST], TypeIs[hasDOTop] | bool]:
500
394
 
501
395
  def workhorse(node: ast.AST) -> TypeIs[hasDOTop] | bool:
502
396
  return isinstance(node, astClass) and attributeCondition(node.op)
@@ -517,41 +411,21 @@ class ClassIsAndAttribute:
517
411
  return workhorse
518
412
 
519
413
  @staticmethod
520
- def optional_varsIs(astClass: type[hasDOToptional_vars], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOToptional_vars] | bool]:
414
+ def optional_varsIs(astClass: type[hasDOToptional_vars], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOToptional_vars] | bool]:
521
415
 
522
416
  def workhorse(node: ast.AST) -> TypeIs[hasDOToptional_vars] | bool:
523
417
  return isinstance(node, astClass) and node.optional_vars is not None and attributeCondition(node.optional_vars)
524
418
  return workhorse
525
419
 
526
420
  @staticmethod
527
- @overload
528
- def orelseIs(astClass: type[hasDOTorelse_expr], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTorelse_expr] | bool]:
529
- ...
530
-
531
- @staticmethod
532
- @overload
533
- def orelseIs(astClass: type[hasDOTorelse_list_stmt], attributeCondition: Callable[[Sequence[ast.stmt]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTorelse_list_stmt] | bool]:
534
- ...
535
-
536
- @staticmethod
537
- def orelseIs(astClass: type[hasDOTorelse], attributeCondition: Callable[[ast.expr], bool] | Callable[[Sequence[ast.stmt]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTorelse] | bool]:
421
+ def orelseIs(astClass: type[hasDOTorelse], attributeCondition: Callable[[ast.expr | Sequence[ast.stmt]], bool]) -> Callable[[ast.AST], TypeIs[hasDOTorelse] | bool]:
538
422
 
539
423
  def workhorse(node: ast.AST) -> TypeIs[hasDOTorelse] | bool:
540
424
  return isinstance(node, astClass) and attributeCondition(node.orelse)
541
425
  return workhorse
542
426
 
543
427
  @staticmethod
544
- @overload
545
- def patternIs(astClass: type[hasDOTpattern_pattern], attributeCondition: Callable[[ast.pattern], bool]) -> Callable[[ast.AST], TypeIs[hasDOTpattern_pattern] | bool]:
546
- ...
547
-
548
- @staticmethod
549
- @overload
550
- def patternIs(astClass: type[hasDOTpattern_patternOrNone], attributeCondition: Callable[[ast.pattern], bool]) -> Callable[[ast.AST], TypeIs[hasDOTpattern_patternOrNone] | bool]:
551
- ...
552
-
553
- @staticmethod
554
- def patternIs(astClass: type[hasDOTpattern], attributeCondition: Callable[[ast.pattern], bool]) -> Callable[[ast.AST], TypeIs[hasDOTpattern] | bool]:
428
+ def patternIs(astClass: type[hasDOTpattern], attributeCondition: Callable[[ast.pattern | (ast.pattern | None)], bool]) -> Callable[[ast.AST], TypeIs[hasDOTpattern] | bool]:
555
429
 
556
430
  def workhorse(node: ast.AST) -> TypeIs[hasDOTpattern] | bool:
557
431
  return isinstance(node, astClass) and node.pattern is not None and attributeCondition(node.pattern)
@@ -572,24 +446,14 @@ class ClassIsAndAttribute:
572
446
  return workhorse
573
447
 
574
448
  @staticmethod
575
- def restIs(astClass: type[hasDOTrest], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTrest] | bool]:
449
+ def restIs(astClass: type[hasDOTrest], attributeCondition: Callable[[str | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTrest] | bool]:
576
450
 
577
451
  def workhorse(node: ast.AST) -> TypeIs[hasDOTrest] | bool:
578
452
  return isinstance(node, astClass) and node.rest is not None and attributeCondition(node.rest)
579
453
  return workhorse
580
454
 
581
455
  @staticmethod
582
- @overload
583
- def returnsIs(astClass: type[hasDOTreturns_expr], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTreturns_expr] | bool]:
584
- ...
585
-
586
- @staticmethod
587
- @overload
588
- def returnsIs(astClass: type[hasDOTreturns_exprOrNone], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTreturns_exprOrNone] | bool]:
589
- ...
590
-
591
- @staticmethod
592
- def returnsIs(astClass: type[hasDOTreturns], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTreturns] | bool]:
456
+ def returnsIs(astClass: type[hasDOTreturns], attributeCondition: Callable[[ast.expr | (ast.expr | None)], bool]) -> Callable[[ast.AST], TypeIs[hasDOTreturns] | bool]:
593
457
 
594
458
  def workhorse(node: ast.AST) -> TypeIs[hasDOTreturns] | bool:
595
459
  return isinstance(node, astClass) and node.returns is not None and attributeCondition(node.returns)
@@ -617,7 +481,7 @@ class ClassIsAndAttribute:
617
481
  return workhorse
618
482
 
619
483
  @staticmethod
620
- def stepIs(astClass: type[hasDOTstep], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTstep] | bool]:
484
+ def stepIs(astClass: type[hasDOTstep], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTstep] | bool]:
621
485
 
622
486
  def workhorse(node: ast.AST) -> TypeIs[hasDOTstep] | bool:
623
487
  return isinstance(node, astClass) and node.step is not None and attributeCondition(node.step)
@@ -638,22 +502,7 @@ class ClassIsAndAttribute:
638
502
  return workhorse
639
503
 
640
504
  @staticmethod
641
- @overload
642
- def targetIs(astClass: type[hasDOTtarget_expr], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTtarget_expr] | bool]:
643
- ...
644
-
645
- @staticmethod
646
- @overload
647
- def targetIs(astClass: type[hasDOTtarget_Name], attributeCondition: Callable[[ast.Name], bool]) -> Callable[[ast.AST], TypeIs[hasDOTtarget_Name] | bool]:
648
- ...
649
-
650
- @staticmethod
651
- @overload
652
- def targetIs(astClass: type[hasDOTtarget_NameOrAttributeOrSubscript], attributeCondition: Callable[[ast.Name | ast.Attribute | ast.Subscript], bool]) -> Callable[[ast.AST], TypeIs[hasDOTtarget_NameOrAttributeOrSubscript] | bool]:
653
- ...
654
-
655
- @staticmethod
656
- def targetIs(astClass: type[hasDOTtarget], attributeCondition: Callable[[ast.expr], bool] | Callable[[ast.Name], bool] | Callable[[ast.Name | ast.Attribute | ast.Subscript], bool]) -> Callable[[ast.AST], TypeIs[hasDOTtarget] | bool]:
505
+ def targetIs(astClass: type[hasDOTtarget], attributeCondition: Callable[[ast.expr | ast.Name | (ast.Name | ast.Attribute | ast.Subscript)], bool]) -> Callable[[ast.AST], TypeIs[hasDOTtarget] | bool]:
657
506
 
658
507
  def workhorse(node: ast.AST) -> TypeIs[hasDOTtarget] | bool:
659
508
  return isinstance(node, astClass) and attributeCondition(node.target)
@@ -674,14 +523,14 @@ class ClassIsAndAttribute:
674
523
  return workhorse
675
524
 
676
525
  @staticmethod
677
- def typeIs(astClass: type[hasDOTtype], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTtype] | bool]:
526
+ def typeIs(astClass: type[hasDOTtype], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTtype] | bool]:
678
527
 
679
528
  def workhorse(node: ast.AST) -> TypeIs[hasDOTtype] | bool:
680
529
  return isinstance(node, astClass) and node.type is not None and attributeCondition(node.type)
681
530
  return workhorse
682
531
 
683
532
  @staticmethod
684
- def type_commentIs(astClass: type[hasDOTtype_comment], attributeCondition: Callable[[str], bool]) -> Callable[[ast.AST], TypeIs[hasDOTtype_comment] | bool]:
533
+ def type_commentIs(astClass: type[hasDOTtype_comment], attributeCondition: Callable[[str | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTtype_comment] | bool]:
685
534
 
686
535
  def workhorse(node: ast.AST) -> TypeIs[hasDOTtype_comment] | bool:
687
536
  return isinstance(node, astClass) and node.type_comment is not None and attributeCondition(node.type_comment)
@@ -702,34 +551,14 @@ class ClassIsAndAttribute:
702
551
  return workhorse
703
552
 
704
553
  @staticmethod
705
- def upperIs(astClass: type[hasDOTupper], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTupper] | bool]:
554
+ def upperIs(astClass: type[hasDOTupper], attributeCondition: Callable[[ast.expr | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTupper] | bool]:
706
555
 
707
556
  def workhorse(node: ast.AST) -> TypeIs[hasDOTupper] | bool:
708
557
  return isinstance(node, astClass) and node.upper is not None and attributeCondition(node.upper)
709
558
  return workhorse
710
559
 
711
560
  @staticmethod
712
- @overload
713
- def valueIs(astClass: type[hasDOTvalue_boolOrNone], attributeCondition: Callable[[bool], bool]) -> Callable[[ast.AST], TypeIs[hasDOTvalue_boolOrNone] | bool]:
714
- ...
715
-
716
- @staticmethod
717
- @overload
718
- def valueIs(astClass: type[hasDOTvalue_ConstantValueType], attributeCondition: Callable[[ConstantValueType], bool]) -> Callable[[ast.AST], TypeIs[hasDOTvalue_ConstantValueType] | bool]:
719
- ...
720
-
721
- @staticmethod
722
- @overload
723
- def valueIs(astClass: type[hasDOTvalue_expr], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTvalue_expr] | bool]:
724
- ...
725
-
726
- @staticmethod
727
- @overload
728
- def valueIs(astClass: type[hasDOTvalue_exprOrNone], attributeCondition: Callable[[ast.expr], bool]) -> Callable[[ast.AST], TypeIs[hasDOTvalue_exprOrNone] | bool]:
729
- ...
730
-
731
- @staticmethod
732
- def valueIs(astClass: type[hasDOTvalue], attributeCondition: Callable[[ast.expr], bool] | Callable[[bool], bool] | Callable[[ConstantValueType], bool]) -> Callable[[ast.AST], TypeIs[hasDOTvalue] | bool]:
561
+ def valueIs(astClass: type[hasDOTvalue], attributeCondition: Callable[[ast.expr | (ast.expr | None) | (bool | None) | ConstantValueType], bool]) -> Callable[[ast.AST], TypeIs[hasDOTvalue] | bool]:
733
562
 
734
563
  def workhorse(node: ast.AST) -> TypeIs[hasDOTvalue] | bool:
735
564
  return isinstance(node, astClass) and node.value is not None and attributeCondition(node.value)
@@ -743,7 +572,7 @@ class ClassIsAndAttribute:
743
572
  return workhorse
744
573
 
745
574
  @staticmethod
746
- def varargIs(astClass: type[hasDOTvararg], attributeCondition: Callable[[ast.arg], bool]) -> Callable[[ast.AST], TypeIs[hasDOTvararg] | bool]:
575
+ def varargIs(astClass: type[hasDOTvararg], attributeCondition: Callable[[ast.arg | None], bool]) -> Callable[[ast.AST], TypeIs[hasDOTvararg] | bool]:
747
576
 
748
577
  def workhorse(node: ast.AST) -> TypeIs[hasDOTvararg] | bool:
749
578
  return isinstance(node, astClass) and node.vararg is not None and attributeCondition(node.vararg)