-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Rule PYI019
should not flag metaclass methods
#16127
Comments
This comment has been minimized.
This comment has been minimized.
See also #8353 for a similar case where the relevant PEP is linked: https://peps.python.org/pep-0673/#valid-locations-for-self |
Thanks for the report and the for the additional links! I agree that it looks like a bug in ruff based on the PEP. |
(I also created an issue for the mypy documentation linked above python/mypy#18668) |
Yup, this is a bug here -- thanks for the report @Geo5! For some reason we check whether the class is a metaclass for PYI034 before issuing a diagnostic: ruff/crates/ruff_linter/src/rules/flake8_pyi/rules/non_self_return_type.rs Lines 133 to 136 in f8093b6
but not for PYI019. Should be easy to fix! |
PYI019
incorrect autofix for metaclassesPYI019
should not flag metaclass methods
is this issue still unassigned ? I would like to give it a go |
@vladNed go for it! |
Description
This code which includes a metaclass and passes
mypy
without errors:is fixed to:
Which
mypy
does not like:The text was updated successfully, but these errors were encountered: