diff options
author | Andreas Finkler <3929834+DudeNr33@users.noreply.github.com> | 2023-04-27 19:14:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-27 19:14:11 +0200 |
commit | 4350c6fd7a955892712e2bf7a78adf4531e483b4 (patch) | |
tree | 118b71dd9916365a90dfd945fcaa28ebbc824359 /pylint | |
parent | e507a4d87ec80e706ac0c8ce2d23bd28006cbbbc (diff) | |
download | pylint-git-4350c6fd7a955892712e2bf7a78adf4531e483b4.tar.gz |
Added escaping of vertical bar character in annotation labels (#8610) (#8631)
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, |