Description
Bug description
If an attribute is only declared on class level (with type annotation), but not assigned to a value, it is currently displayed twice in pyreverse
diagrams:
class ExampleClass():
example1: int
example2: int
def __init__(self):
self.example1 = 1
self.example2 = 2
@startuml classes
set namespaceSeparator none
class "ExampleClass" as asdf.ExampleClass {
example1 : int
example1 : int
example2 : int
example2 : int
}
@enduml
However it should be ignored, and only the type information should be picked up by pyreverse
.
Note: if a value is assigned on class level, the attribute is a class attribute and the attributes defined in __init__
are instance attributes.
Both exist independently from one another, and the class attribute should be shown as "static attribute" with an underline.
See also the discussion in this issue.
Configuration
No response
Command used
pyreverse a.py
Pylint output
See above
Expected behavior
Only show the attribute once.
Pylint version
pylint 2.16.0-dev
astroid 2.12.13
Python 3.10.8 (main, Nov 1 2022, 14:18:21) [GCC 12.2.0]
OS / Environment
No response
Additional dependencies
No response