Commit 79aac5b 1 parent 6da1d5a commit 79aac5b Copy full SHA for 79aac5b
File tree 4 files changed +16
-13
lines changed
tests/pyreverse/functional/class_diagrams/attributes
4 files changed +16
-13
lines changed Original file line number Diff line number Diff line change
1
+ Don't show class fields more than once in Pyreverse diagrams.
2
+
3
+ Closes #8189
Original file line number Diff line number Diff line change @@ -115,16 +115,19 @@ def get_relationship(
115
115
def get_attrs (self , node : nodes .ClassDef ) -> list [str ]:
116
116
"""Return visible attributes, possibly with class name."""
117
117
attrs = []
118
- properties = [
119
- (n , m )
120
- for n , m in node .items ()
121
- if isinstance (m , nodes .FunctionDef ) and decorated_with_property (m )
122
- ]
123
- for node_name , associated_nodes in (
124
- list (node .instance_attrs_type .items ())
125
- + list (node .locals_type .items ())
126
- + properties
118
+ properties = {
119
+ local_name : local_node
120
+ for local_name , local_node in node .items ()
121
+ if isinstance (local_node , nodes .FunctionDef )
122
+ and decorated_with_property (local_node )
123
+ }
124
+ for attr_name , attr_type in list (node .locals_type .items ()) + list (
125
+ node .instance_attrs_type .items ()
127
126
):
127
+ if attr_name not in properties :
128
+ properties [attr_name ] = attr_type
129
+
130
+ for node_name , associated_nodes in properties .items ():
128
131
if not self .show_attr (node_name ):
129
132
continue
130
133
names = self .class_names (associated_nodes )
Original file line number Diff line number Diff line change @@ -8,12 +8,9 @@ classDiagram
8
8
}
9
9
class DuplicateArrows {
10
10
a
11
- a
12
11
}
13
12
class DuplicateFields {
14
13
example1 : int
15
- example1 : int
16
- example2 : int
17
14
example2 : int
18
15
}
19
16
A --* DuplicateArrows : a
Original file line number Diff line number Diff line change 1
- # OPEN BUG: https://github.com/pylint-dev/pylint/issues/8189
1
+ # Test for https://github.com/pylint-dev/pylint/issues/8189
2
2
class DuplicateFields ():
3
3
example1 : int
4
4
example2 : int
You can’t perform that action at this time.
0 commit comments