Skip to content

Commit 24786fa

Browse files
Fix Pyreverse duplicate arrows bug (#9029) (#9039)
(cherry picked from commit 3f93f1e) Co-authored-by: Nick Drozd <[email protected]>
1 parent 259fbd2 commit 24786fa

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

doc/whatsnew/fragments/8522.bugfix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Don't show arrows more than once in Pyreverse diagrams.
2+
3+
Closes #8522

pylint/pyreverse/diagrams.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,13 @@ def extract_relationships(self) -> None:
230230
value, obj, name, "aggregation"
231231
)
232232

233-
for name, values in list(node.associations_type.items()) + list(
234-
node.locals_type.items()
235-
):
233+
associations = node.associations_type.copy()
234+
235+
for name, values in node.locals_type.items():
236+
if name not in associations:
237+
associations[name] = values
238+
239+
for name, values in associations.items():
236240
for value in values:
237241
self.assign_association_relationship(
238242
value, obj, name, "association"

tests/pyreverse/functional/class_diagrams/attributes/duplicates.mmd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ classDiagram
1414
example2 : int
1515
}
1616
A --* DuplicateArrows : a
17-
A --* DuplicateArrows : a

tests/pyreverse/functional/class_diagrams/attributes/duplicates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def __init__(self):
88
self.example2 = 2
99

1010

11-
# OPEN BUG: https://github.com/pylint-dev/pylint/issues/8522
11+
# Test for https://github.com/pylint-dev/pylint/issues/8522
1212
class A:
1313
pass
1414

0 commit comments

Comments
 (0)