@@ -851,7 +851,7 @@ def _node_guarded_by_same_test(node: nodes.NodeNG, other_if: nodes.If) -> bool:
851
851
def _uncertain_nodes_in_except_blocks (
852
852
found_nodes : list [nodes .NodeNG ],
853
853
node : nodes .NodeNG ,
854
- node_statement : nodes .Statement ,
854
+ node_statement : _base_nodes .Statement ,
855
855
) -> list [nodes .NodeNG ]:
856
856
"""Return any nodes in ``found_nodes`` that should be treated as uncertain
857
857
because they are in an except block.
@@ -1072,7 +1072,7 @@ def _try_in_loop_body(
1072
1072
1073
1073
@staticmethod
1074
1074
def _recursive_search_for_continue_before_break (
1075
- stmt : nodes .Statement , break_stmt : nodes .Break
1075
+ stmt : _base_nodes .Statement , break_stmt : nodes .Break
1076
1076
) -> bool :
1077
1077
"""Return True if any Continue node can be found in descendants of `stmt`
1078
1078
before encountering `break_stmt`, ignoring any nested loops.
@@ -1092,7 +1092,7 @@ def _recursive_search_for_continue_before_break(
1092
1092
1093
1093
@staticmethod
1094
1094
def _uncertain_nodes_in_try_blocks_when_evaluating_except_blocks (
1095
- found_nodes : list [nodes .NodeNG ], node_statement : nodes .Statement
1095
+ found_nodes : list [nodes .NodeNG ], node_statement : _base_nodes .Statement
1096
1096
) -> list [nodes .NodeNG ]:
1097
1097
"""Return any nodes in ``found_nodes`` that should be treated as uncertain.
1098
1098
@@ -1140,7 +1140,7 @@ def _uncertain_nodes_in_try_blocks_when_evaluating_except_blocks(
1140
1140
1141
1141
@staticmethod
1142
1142
def _uncertain_nodes_in_try_blocks_when_evaluating_finally_blocks (
1143
- found_nodes : list [nodes .NodeNG ], node_statement : nodes .Statement
1143
+ found_nodes : list [nodes .NodeNG ], node_statement : _base_nodes .Statement
1144
1144
) -> list [nodes .NodeNG ]:
1145
1145
uncertain_nodes : list [nodes .NodeNG ] = []
1146
1146
(
@@ -2184,8 +2184,8 @@ def _in_lambda_or_comprehension_body(
2184
2184
def _is_variable_violation (
2185
2185
node : nodes .Name ,
2186
2186
defnode : nodes .NodeNG ,
2187
- stmt : nodes .Statement ,
2188
- defstmt : nodes .Statement ,
2187
+ stmt : _base_nodes .Statement ,
2188
+ defstmt : _base_nodes .Statement ,
2189
2189
frame : nodes .LocalsDictNodeNG , # scope of statement of node
2190
2190
defframe : nodes .LocalsDictNodeNG ,
2191
2191
base_scope_type : str ,
@@ -2339,7 +2339,7 @@ def _is_variable_violation(
2339
2339
return maybe_before_assign , annotation_return , use_outer_definition
2340
2340
2341
2341
@staticmethod
2342
- def _maybe_used_and_assigned_at_once (defstmt : nodes .Statement ) -> bool :
2342
+ def _maybe_used_and_assigned_at_once (defstmt : _base_nodes .Statement ) -> bool :
2343
2343
"""Check if `defstmt` has the potential to use and assign a name in the
2344
2344
same statement.
2345
2345
"""
@@ -2381,7 +2381,9 @@ def _is_builtin(self, name: str) -> bool:
2381
2381
return name in self .linter .config .additional_builtins or utils .is_builtin (name )
2382
2382
2383
2383
@staticmethod
2384
- def _is_only_type_assignment (node : nodes .Name , defstmt : nodes .Statement ) -> bool :
2384
+ def _is_only_type_assignment (
2385
+ node : nodes .Name , defstmt : _base_nodes .Statement
2386
+ ) -> bool :
2385
2387
"""Check if variable only gets assigned a type and never a value."""
2386
2388
if not isinstance (defstmt , nodes .AnnAssign ) or defstmt .value :
2387
2389
return False
0 commit comments