Skip to content

type hints in methods using PEP 604 result in horizontal line #8671

@cybercyber123

Description

@cybercyber123

Bug description

The following type hints cause unwanted horizontal lines, because of un-escaped pipe-symbols.

class FailingClass:
    def __init__(
        self,
        with_default: str | None = None,
    ) -> None:
        self._bar = with_default

    def the_failing_method(
        self,
        the_arg: str | None = None,
    ) -> None:
        pass

Configuration

No response

Command used

pyreverse --filter ALL --output-directory output --output dot ./main.py

Pylint output

digraph "classes" {
rankdir=BT
charset="utf-8"
"main.FailingClass" [color="black", fontcolor="black", label=<{FailingClass|_bar : Optional[str \| None]<br ALIGN="LEFT"/>|__init__(with_default: str | None): None<br ALIGN="LEFT"/><I>the_failing_method</I>(the_arg: str | None): None<br ALIGN="LEFT"/>}>, shape="record", style="solid"];
}

Expected behavior

i would expect proper handling of those type hints.

Pylint version

pylint==2.17.4

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions