Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pyreverse duplicate arrows bug #9029

Merged
merged 1 commit into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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():
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
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
Loading