You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using an if/else in class scope of an Enum definition, there is a false error "Attempted to reuse member name in Enum definition".
I understand mypy might have an opinion about this pattern, but I noticed there is no equivalent issue for a plain class. So this seems to be an issue specific to Enum that could potentially be relaxed.
To Reproduce
classFoo(Enum):
ifIS_BAZ:
DISABLED=16else:
# error: Attempted to reuse member name "DISABLED" in Enum definition "Foo" [misc]DISABLED=256classBar:
ifIS_BAZ:
DISABLED=16else:
DISABLED=256# (no error)
Expected Behavior
no mypy errors
Actual Behavior
error: Attempted to reuse member name "DISABLED" in Enum definition "Foo" [misc]
Your Environment
Mypy version used: 1.8.0
Python version used: 3.8
The text was updated successfully, but these errors were encountered:
Bug Report
When using an
if
/else
in class scope of an Enum definition, there is a false error "Attempted to reuse member name in Enum definition".I understand mypy might have an opinion about this pattern, but I noticed there is no equivalent issue for a plain class. So this seems to be an issue specific to Enum that could potentially be relaxed.
To Reproduce
Expected Behavior
no mypy errors
Actual Behavior
Your Environment
The text was updated successfully, but these errors were encountered: