File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2194,16 +2194,14 @@ def is_class_attr(name: str, klass: nodes.ClassDef) -> bool:
21942194
21952195
21962196def 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."""
21982198 is_defined_so_far = False
21992199
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
22022202
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 )
22072205
22082206 if isinstance (node , nodes .With ):
22092207 is_defined_so_far = any (
You can’t perform that action at this time.
0 commit comments