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

PLW3201 flags _missing_ in Enum subclass #7971

Closed
mal opened this issue Oct 16, 2023 · 1 comment · Fixed by #7987
Closed

PLW3201 flags _missing_ in Enum subclass #7971

mal opened this issue Oct 16, 2023 · 1 comment · Fixed by #7987
Assignees
Labels
bug Something isn't working

Comments

@mal
Copy link

mal commented Oct 16, 2023

Enum in Python has a few supported sunder names. Of them, _missing_ and _generate_next_value_ are explicitly called out as overridable but when doing so they get flagged as misspelled dunder methods.

Looks separate from, but related to #4592.

from enum import StrEnum
class Build(StrEnum):
    @classmethod
    def _missing_(cls, value):
        pass
$ ruff --isolated --preview --select PLW3201 --show-source test.py
test.py:4:9: PLW3201 Bad or misspelled dunder method name `_missing_`. (bad-dunder-name)
  |
2 | class Build(StrEnum):
3 |     @classmethod
4 |     def _missing_(cls, value):
  |         ^^^^^^^^^ PLW3201
5 |         pass
  |

Observed using ruff 0.0.292.

@charliermarsh charliermarsh self-assigned this Oct 16, 2023
@charliermarsh charliermarsh added the bug Something isn't working label Oct 16, 2023
@charliermarsh
Copy link
Member

Thanks!

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