File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -113,9 +113,14 @@ def is_type_checking(node: ast.AST) -> bool:
113
113
if isinstance (node , ast .If ):
114
114
node = node .test
115
115
116
- if isinstance (node , ast .NameConstant ) and node .value is False :
117
- return True
118
- elif isinstance (node , ast .Name ) and node .id == "TYPE_CHECKING" :
116
+ if sys .version_info < (3 , 12 ): # pragma: no cover (py312+)
117
+ if isinstance (node , ast .NameConstant ) and node .value is False :
118
+ return True
119
+ else : # pragma: no cover (<py312)
120
+ if isinstance (node , ast .Constant ) and node .value is False :
121
+ return True
122
+
123
+ if isinstance (node , ast .Name ) and node .id == "TYPE_CHECKING" :
119
124
return True
120
125
elif isinstance (node , ast .Attribute ) and node .attr == "TYPE_CHECKING" :
121
126
return True
You can’t perform that action at this time.
0 commit comments