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:
113113 if isinstance (node , ast .If ):
114114 node = node .test
115115
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" :
119124 return True
120125 elif isinstance (node , ast .Attribute ) and node .attr == "TYPE_CHECKING" :
121126 return True
You can’t perform that action at this time.
0 commit comments