Skip to content

Create common Printer base class for pyreverse and improve typing. #4731

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

Merged
13 changes: 13 additions & 0 deletions pylint/pyreverse/diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ def __init__(self, title="No name", node=None):
self.node = node


class PackageEntity(DiagramEntity):
"""A diagram object representing a package"""


class ClassEntity(DiagramEntity):
"""A diagram object representing a class"""

def __init__(self, title, node):
super().__init__(title=title, node=node)
self.attrs = None
self.methods = None

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the type hints revealed that it was necessary to distinguish between a PackageEntity and a ClassEntity, because the ClassEntity has additional attributes that were dynamically added in the previous code, which confused mypy.


class ClassDiagram(Figure, FilterMixIn):
"""main class diagram handling"""

Expand Down
Loading