Skip to content

Commit

Permalink
Remove remaining code parts related to __implements__ (#8414)
Browse files Browse the repository at this point in the history
Refs #8404
  • Loading branch information
DudeNr33 committed Mar 9, 2023
1 parent 62889d4 commit d04734d
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 43 deletions.
8 changes: 2 additions & 6 deletions pylint/pyreverse/diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from astroid import nodes, util

from pylint.checkers.utils import decorated_with_property
from pylint.pyreverse.utils import FilterMixIn, is_interface
from pylint.pyreverse.utils import FilterMixIn


class Figure:
Expand Down Expand Up @@ -195,11 +195,7 @@ def extract_relationships(self) -> None:
node = obj.node
obj.attrs = self.get_attrs(node)
obj.methods = self.get_methods(node)
# shape
if is_interface(node):
obj.shape = "interface"
else:
obj.shape = "class"
obj.shape = "class"
# inheritance link
for par_node in node.ancestors(recurs=False):
try:
Expand Down
2 changes: 0 additions & 2 deletions pylint/pyreverse/dot_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ class HTMLLabels(Enum):
ALLOWED_CHARSETS: frozenset[str] = frozenset(("utf-8", "iso-8859-1", "latin1"))
SHAPES: dict[NodeType, str] = {
NodeType.PACKAGE: "box",
NodeType.INTERFACE: "record",
NodeType.CLASS: "record",
}
# pylint: disable-next=consider-using-namedtuple-or-dataclass
ARROWS: dict[EdgeType, dict[str, str]] = {
EdgeType.INHERITS: {"arrowtail": "none", "arrowhead": "empty"},
EdgeType.IMPLEMENTS: {"arrowtail": "node", "arrowhead": "empty", "style": "dashed"},
EdgeType.ASSOCIATION: {
"fontcolor": "green",
"arrowtail": "none",
Expand Down
4 changes: 0 additions & 4 deletions pylint/pyreverse/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor):
* aggregations_type
as instance_attrs_type but for aggregations relationships
* implements,
list of implemented interface _objects_ (only on astroid.Class nodes)
"""

def __init__(self, project: Project, tag: bool = False) -> None:
Expand Down Expand Up @@ -149,7 +146,6 @@ def visit_classdef(self, node: nodes.ClassDef) -> None:
"""Visit an astroid.Class node.
* set the locals_type and instance_attrs_type mappings
* set the implements list and build it
* optionally tag the node with a unique id
"""
if hasattr(node, "locals_type"):
Expand Down
5 changes: 1 addition & 4 deletions pylint/pyreverse/mermaidjs_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ class MermaidJSPrinter(Printer):

NODES: dict[NodeType, str] = {
NodeType.CLASS: "class",
NodeType.INTERFACE: "class",
NodeType.PACKAGE: "class",
}
ARROWS: dict[EdgeType, str] = {
EdgeType.INHERITS: "--|>",
EdgeType.IMPLEMENTS: "..|>",
EdgeType.ASSOCIATION: "--*",
EdgeType.AGGREGATION: "--o",
EdgeType.USES: "-->",
Expand All @@ -46,7 +44,6 @@ def emit_node(
# pylint: disable=duplicate-code
if properties is None:
properties = NodeProperties(label=name)
stereotype = "~~Interface~~" if type_ is NodeType.INTERFACE else ""
nodetype = self.NODES[type_]
body = []
if properties.attrs:
Expand All @@ -60,7 +57,7 @@ def emit_node(
line += f" {get_annotation_label(func.returns)}"
body.append(line)
name = name.split(".")[-1]
self.emit(f"{nodetype} {name}{stereotype} {{")
self.emit(f"{nodetype} {name} {{")
self._inc_indent()
for line in body:
self.emit(line)
Expand Down
5 changes: 1 addition & 4 deletions pylint/pyreverse/plantuml_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ class PlantUmlPrinter(Printer):

NODES: dict[NodeType, str] = {
NodeType.CLASS: "class",
NodeType.INTERFACE: "class",
NodeType.PACKAGE: "package",
}
ARROWS: dict[EdgeType, str] = {
EdgeType.INHERITS: "--|>",
EdgeType.IMPLEMENTS: "..|>",
EdgeType.ASSOCIATION: "--*",
EdgeType.AGGREGATION: "--o",
EdgeType.USES: "-->",
Expand Down Expand Up @@ -56,7 +54,6 @@ def emit_node(
"""
if properties is None:
properties = NodeProperties(label=name)
stereotype = " << interface >>" if type_ is NodeType.INTERFACE else ""
nodetype = self.NODES[type_]
if properties.color and properties.color != self.DEFAULT_COLOR:
color = f" #{properties.color}"
Expand All @@ -76,7 +73,7 @@ def emit_node(
label = properties.label if properties.label is not None else name
if properties.fontcolor and properties.fontcolor != self.DEFAULT_COLOR:
label = f"<color:{properties.fontcolor}>{label}</color>"
self.emit(f'{nodetype} "{label}" as {name}{stereotype}{color} {{')
self.emit(f'{nodetype} "{label}" as {name}{color} {{')
self._inc_indent()
for line in body:
self.emit(line)
Expand Down
2 changes: 0 additions & 2 deletions pylint/pyreverse/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@

class NodeType(Enum):
CLASS = "class"
INTERFACE = "interface"
PACKAGE = "package"


class EdgeType(Enum):
INHERITS = "inherits"
IMPLEMENTS = "implements"
ASSOCIATION = "association"
AGGREGATION = "aggregation"
USES = "uses"
Expand Down
5 changes: 0 additions & 5 deletions pylint/pyreverse/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ def get_visibility(name: str) -> str:
return visibility


def is_interface(node: nodes.ClassDef) -> bool:
# bw compatibility
return node.type == "interface" # type: ignore[no-any-return]


def is_exception(node: nodes.ClassDef) -> bool:
# bw compatibility
return node.type == "exception" # type: ignore[no-any-return]
Expand Down
7 changes: 0 additions & 7 deletions pylint/pyreverse/vcg_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
SHAPES: dict[NodeType, str] = {
NodeType.PACKAGE: "box",
NodeType.CLASS: "box",
NodeType.INTERFACE: "ellipse",
}
# pylint: disable-next=consider-using-namedtuple-or-dataclass
ARROWS: dict[EdgeType, dict[str, str | int]] = {
Expand All @@ -166,12 +165,6 @@
"backarrowstyle": "none",
"backarrowsize": 10,
},
EdgeType.IMPLEMENTS: {
"arrowstyle": "solid",
"backarrowstyle": "none",
"linestyle": "dotted",
"backarrowsize": 10,
},
EdgeType.ASSOCIATION: {
"arrowstyle": "solid",
"backarrowstyle": "none",
Expand Down
12 changes: 3 additions & 9 deletions pylint/pyreverse/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ def write_classes(self, diagram: ClassDiagram) -> None:
# sorted to get predictable (hence testable) results
for obj in sorted(diagram.objects, key=lambda x: x.title): # type: ignore[no-any-return]
obj.fig_id = obj.node.qname()
type_ = NodeType.INTERFACE if obj.shape == "interface" else NodeType.CLASS
self.printer.emit_node(
obj.fig_id, type_=type_, properties=self.get_class_properties(obj)
obj.fig_id,
type_=NodeType.CLASS,
properties=self.get_class_properties(obj),
)
# inheritance links
for rel in diagram.get_relationships("specialization"):
Expand All @@ -86,13 +87,6 @@ def write_classes(self, diagram: ClassDiagram) -> None:
rel.to_object.fig_id,
type_=EdgeType.INHERITS,
)
# implementation links
for rel in diagram.get_relationships("implements"):
self.printer.emit_edge(
rel.from_object.fig_id,
rel.to_object.fig_id,
type_=EdgeType.IMPLEMENTS,
)
# generate associations
for rel in diagram.get_relationships("association"):
self.printer.emit_edge(
Expand Down

0 comments on commit d04734d

Please sign in to comment.