We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
self
In a method of a class derived from Flag, the type of self appears to be unknown.
To Reproduce
import enum class Foo(enum.Flag): A = 1 B = 2 def names(self): return [v.name for v in list(self.__class__) if self & v]
Expected Behavior
no errors
Actual Behavior
$ mypy --check-untyped-defs flag.py flag.py:8: error: "object" has no attribute "name" [attr-defined] flag.py:8: error: Unsupported operand types for & ("Foo" and "object") [operator]
Though I can resolve the error by annotating self with typing_extensions.Self, I'm not sure that should be necessary.
typing_extensions.Self
Your Environment
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In a method of a class derived from Flag, the type of
self
appears to be unknown.To Reproduce
Expected Behavior
no errors
Actual Behavior
Though I can resolve the error by annotating
self
withtyping_extensions.Self
, I'm not sure that should be necessary.Your Environment
The text was updated successfully, but these errors were encountered: