diff options
author | ViRuSTriNiTy <cradle-of-mail@gmx.de> | 2023-04-26 21:43:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 21:43:13 +0200 |
commit | 5d82d7bb6b94a3a6a4d7a4861262519e62916881 (patch) | |
tree | 5768cea98251c8c909ec33b01949ae2505044a75 /pylint | |
parent | e2d6c4db610be73ccaa89c9c40509da8b11854ab (diff) | |
download | pylint-git-5d82d7bb6b94a3a6a4d7a4861262519e62916881.tar.gz |
Added escaping of vertical bar character in annotation labels (#8610)
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 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, |