-
-
Notifications
You must be signed in to change notification settings - Fork 3k
__class_getitem__ is not assumed to be a classmethod #7319
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
Comments
Yes, we should recognise it as a class method automatically, this is however quite low priority IMO, because it is a rarely used method. |
On the other hand it should be easy to fix, so please go ahead if you would like to make a PR. |
I think we have different definitions of "easy" :) I pushed a few commits to my fork, but I get some errors in the tests I added, which I have no idea how to fix, since I basically just copied bits of what is special-cased for |
I have only one scale, it is much easier than any other mypy issue. Btw a quick fix for your issue will be to tweak |
I think something similar to #7355 would work for this. |
mypy (version 0.720) gives confusing errors like this:
for the following method:
even though this is apparently the correct way to type-hint factory functions.
Adding the
@classmethod
decorator makes the error go away, but according to PEP 560,__class_getitem__
is automatically a class method, so the decorator shouln't be required.The text was updated successfully, but these errors were encountered: