Skip to content

Commit d62e8d5

Browse files
committed
Instead of checking not call node check for name node ==> more explicit
1 parent 107f5a1 commit d62e8d5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pylint/pyreverse/inspector.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ def handle(self, node: nodes.AssignAttr, parent: nodes.ClassDef) -> None:
387387

388388
value = node.parent.value
389389

390-
# Aggregation: parent receives child (self.x = x)
391-
if isinstance(value, astroid.node_classes.Name):
390+
# Aggregation: direct assignment (self.x = x)
391+
if isinstance(value, nodes.Name):
392392
current = set(parent.aggregations_type[node.attrname])
393393
parent.aggregations_type[node.attrname] = list(
394394
current | utils.infer_node(node)
@@ -404,8 +404,8 @@ def handle(self, node: nodes.AssignAttr, parent: nodes.ClassDef) -> None:
404404
else:
405405
element = value.elt
406406

407-
# If the element is NOT a Call (no object creation), it's aggregation
408-
if not isinstance(element, nodes.Call):
407+
# If the element is a Name, it means it's an existing object, so it's aggregation
408+
if isinstance(element, nodes.Name):
409409
if isinstance(value, nodes.DictComp):
410410
element_type = safe_infer(value.value)
411411
else:

0 commit comments

Comments
 (0)