diff options
Diffstat (limited to 'pylint')
-rw-r--r-- | pylint/pyreverse/dot_printer.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pylint/pyreverse/dot_printer.py b/pylint/pyreverse/dot_printer.py index 077e0552d..99cb17e97 100644 --- a/pylint/pyreverse/dot_printer.py +++ b/pylint/pyreverse/dot_printer.py @@ -121,11 +121,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, |