summaryrefslogtreecommitdiff
path: root/pylint/pyreverse/dot_printer.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/pyreverse/dot_printer.py')
-rw-r--r--pylint/pyreverse/dot_printer.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pylint/pyreverse/dot_printer.py b/pylint/pyreverse/dot_printer.py
index 054814d05..edaea2384 100644
--- a/pylint/pyreverse/dot_printer.py
+++ b/pylint/pyreverse/dot_printer.py
@@ -119,11 +119,19 @@ class DotPrinter(Printer):
)
label += rf"{method_name}({', '.join(args)})"
if func.returns:
- label += ": " + get_annotation_label(func.returns)
+ annotation_label = get_annotation_label(func.returns)
+ label += ": " + self._escape_annotation_label(annotation_label)
label += rf"{HTMLLabels.LINEBREAK_LEFT.value}"
label += "}"
return label
+ def _escape_annotation_label(self, annotation_label: str) -> str:
+ # Escape vertical bar characters to make them appear as a literal characters
+ # otherwise it gets treated as field separator of record-based nodes
+ annotation_label = annotation_label.replace("|", r"\|")
+
+ return annotation_label
+
def emit_edge(
self,
from_node: str,