Skip to content

ruff (via PIE790) incorrectly removes ellipses from Protocols with generics #9840

@Julian

Description

@Julian

On ruff 0.2.0, the following command:

⊙  ruff --version && ruff --select PIE --isolated <(printf '                                                                                                                                                                                                                                                        julian@Airm
from typing import Protocol, TypeVar


D = TypeVar("D")


class Foo(Protocol[D]):
    """
    Foo bar.
    """
    ...
')

produces:

ruff 0.2.0
/dev/fd/11:12:5: PIE790 [*] Unnecessary `...` literal
Found 1 error.
[*] 1 fixable with the `--fix` option.

but the ellipsis should not be removed.

This is essentially the same issue as #8756 but it looks like the fix put in there only handled non-generic Protocols.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions