Skip to content

Commit

Permalink
Fix Pyreverse duplicate arrows bug (#9029)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdrozd authored Sep 16, 2023
1 parent 6d9b07d commit 3f93f1e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/8522.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Don't show arrows more than once in Pyreverse diagrams.

Closes #8522
10 changes: 7 additions & 3 deletions pylint/pyreverse/diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,13 @@ def extract_relationships(self) -> None:
value, obj, name, "aggregation"
)

for name, values in list(node.associations_type.items()) + list(
node.locals_type.items()
):
associations = node.associations_type.copy()

for name, values in node.locals_type.items():
if name not in associations:
associations[name] = values

for name, values in associations.items():
for value in values:
self.assign_association_relationship(
value, obj, name, "association"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ classDiagram
example2 : int
}
A --* DuplicateArrows : a
A --* DuplicateArrows : a
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self):
self.example2 = 2


# OPEN BUG: https://github.com/pylint-dev/pylint/issues/8522
# Test for https://github.com/pylint-dev/pylint/issues/8522
class A:
pass

Expand Down

0 comments on commit 3f93f1e

Please sign in to comment.