Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Julian opened this issue Feb 5, 2024 · 4 comments · Fixed by #9841
Closed

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

Julian opened this issue Feb 5, 2024 · 4 comments · Fixed by #9841
Assignees
Labels
bug Something isn't working

Comments

@Julian
Copy link

Julian commented Feb 5, 2024

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.

@charliermarsh
Copy link
Member

Ah thanks.

@charliermarsh charliermarsh self-assigned this Feb 5, 2024
@charliermarsh charliermarsh added the bug Something isn't working label Feb 5, 2024
@charliermarsh
Copy link
Member

I'll fix this now and it can go out in today's release.

@Julian
Copy link
Author

Julian commented Feb 5, 2024

You sir are fast :) Much appreciation as usual!

@charliermarsh
Copy link
Member

No prob :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants