Skip to content

Commit

Permalink
Fix Pyreverse duplicate arrows bug (#9029) (#9039)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3f93f1e)

Co-authored-by: Nick Drozd <nicholasdrozd@gmail.com>
  • Loading branch information
github-actions[bot] and nickdrozd committed Sep 16, 2023
1 parent 259fbd2 commit 24786fa
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 @@ -230,9 +230,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 24786fa

Please sign in to comment.