File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -2194,16 +2194,14 @@ def is_class_attr(name: str, klass: nodes.ClassDef) -> bool:
2194
2194
2195
2195
2196
2196
def is_defined (name : str , node : nodes .NodeNG ) -> bool :
2197
- """Checks whether a node defines the given variable name."""
2197
+ """Searches for a tree node that defines the given variable name."""
2198
2198
is_defined_so_far = False
2199
2199
2200
- if isinstance (node , nodes .NamedExpr ) and node . target . name == name :
2201
- return True
2200
+ if isinstance (node , nodes .NamedExpr ):
2201
+ is_defined_so_far = node . target . name == name
2202
2202
2203
- if isinstance (node , (nodes .Import , nodes .ImportFrom )) and any (
2204
- node_name [0 ] == name for node_name in node .names
2205
- ):
2206
- return True
2203
+ if isinstance (node , (nodes .Import , nodes .ImportFrom )):
2204
+ is_defined_so_far = any (node_name [0 ] == name for node_name in node .names )
2207
2205
2208
2206
if isinstance (node , nodes .With ):
2209
2207
is_defined_so_far = any (
You can’t perform that action at this time.
0 commit comments