-
Notifications
You must be signed in to change notification settings - Fork 12
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
Enum member annotations mask subclass in type annotation resolution #47
Comments
This seems like a PyCharm issue as the stubs are using the standard from enum import Enum
class MyEnum(Enum):
One = 1
Two = 2
def my_function(arg: MyEnum) -> None:
pass
my_function(MyEnum.One) |
AFAIK PyCharm takes the annotated value to be the correct one ignoring the fact it's in an Enum, that code therefore runs fine. |
Then I'm not sure why PyCharm would have an issue with |
I've tried doing this in stubs before, the only way to get it to work is to type hint members as instances of the enum. |
My whole point is that this works fine in |
The way enum stubs are defined causes their values to appear to PyCharm as their annotated type rather than as instances of their class. This causes PyCharm to warn that, for example, the
per=
argument tocommands.MaxConcurrency.__init__
is an int rather than the expectedBucketType
.The text was updated successfully, but these errors were encountered: