File tree Expand file tree Collapse file tree 4 files changed +16
-13
lines changed
tests/pyreverse/functional/class_diagrams/attributes Expand file tree Collapse file tree 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 @@ -121,16 +121,19 @@ def get_relationship(
121
121
def get_attrs (self , node : nodes .ClassDef ) -> list [str ]:
122
122
"""Return visible attributes, possibly with class name."""
123
123
attrs = []
124
- properties = [
125
- (n , m )
126
- for n , m in node .items ()
127
- if isinstance (m , nodes .FunctionDef ) and decorated_with_property (m )
128
- ]
129
- for node_name , associated_nodes in (
130
- list (node .instance_attrs_type .items ())
131
- + list (node .locals_type .items ())
132
- + properties
124
+ properties = {
125
+ local_name : local_node
126
+ for local_name , local_node in node .items ()
127
+ if isinstance (local_node , nodes .FunctionDef )
128
+ and decorated_with_property (local_node )
129
+ }
130
+ for attr_name , attr_type in list (node .locals_type .items ()) + list (
131
+ node .instance_attrs_type .items ()
133
132
):
133
+ if attr_name not in properties :
134
+ properties [attr_name ] = attr_type
135
+
136
+ for node_name , associated_nodes in properties .items ():
134
137
if not self .show_attr (node_name ):
135
138
continue
136
139
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