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
mypy complains Type[IterFailingEnum]" has no attribute "__iter__" (not iterable) [attr-defined] when trying to iterate over anum.Enum subclass. mypy does not complain when iterating over an standard library Enum subclass. The code works still.
Is this an error in mypy or consequence of missing proper type hinting support in aenum?
Reproduceable error case
import aenum # type: ignore
class IterFailingEnum(aenum.Enum):
_init_ = 'value fullname'
_settings_ = aenum.MultiValue
one = 1, 'One'
two = 2, 'Two'
three = 3, 'Three'
for e in IterFailingEnum: # "Type[IterFailingEnum]" has no attribute "__iter__" (not iterable) [attr-defined]
print(e.fullname)
The text was updated successfully, but these errors were encountered:
from aenum import Enum
class test(Enum):
HELLO = "WORLD"
FOO = "BAR"
@classmethod
def _missing_(cls, value: str):
"""Allow for case insensitive matching"""
for member in cls:
print(member)
And pyright gives error: "type[test]" is not iterable, while this works with the stdlib enum.
aenum:
aenum-3.1.12
Mypy:
mypy-1.3.0
Python:
Python 3.11.3
mypy
complainsType[IterFailingEnum]" has no attribute "__iter__" (not iterable) [attr-defined]
when trying to iterate overanum.Enum
subclass.mypy
does not complain when iterating over an standard libraryEnum
subclass. The code works still.Is this an error in
mypy
or consequence of missing proper type hinting support inaenum
?Reproduceable error case
The text was updated successfully, but these errors were encountered: