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(
121121 def get_attrs (self , node : nodes .ClassDef ) -> list [str ]:
122122 """Return visible attributes, possibly with class name."""
123123 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 ()
133132 ):
133+ if attr_name not in properties :
134+ properties [attr_name ] = attr_type
135+
136+ for node_name , associated_nodes in properties .items ():
134137 if not self .show_attr (node_name ):
135138 continue
136139 names = self .class_names (associated_nodes )
Original file line number Diff line number Diff line change @@ -8,12 +8,9 @@ classDiagram
88 }
99 class DuplicateArrows {
1010 a
11- a
1211 }
1312 class DuplicateFields {
1413 example1 : int
15- example1 : int
16- example2 : int
1714 example2 : int
1815 }
1916 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
22class DuplicateFields ():
33 example1 : int
44 example2 : int
You can’t perform that action at this time.
0 commit comments