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
Dynamically instantiating an Enum raises an error.
To Reproduce
di = {f: f.upper() for f in ["n1", "n2"]}
ArticleEnum = Enum("ArticleEnum", di)
The error message is: article.py:197: error: Enum() expects a string, tuple, list or dict literal as the second argument
Expected Behavior
If I change the code snippet to hard-code the dictionary, no error occurs. This is what I expect the upper example to behave as well.
di = {f: f.upper() for f in ["n1", "n2"]}
ArticleEnum = Enum("ArticleEnum", {"n1": "N1", "n2": "N2"})
Your Environment
mypy 0.790 in a virtual env (peenv) on MacOS, mypy is invoked on the shell without any special arguments and no configuration
$ mypy src/
I am using Python 3.9.0.
The text was updated successfully, but these errors were encountered:
Dynamically instantiating an Enum raises an error.
To Reproduce
The error message is:
article.py:197: error: Enum() expects a string, tuple, list or dict literal as the second argument
Expected Behavior
If I change the code snippet to hard-code the dictionary, no error occurs. This is what I expect the upper example to behave as well.
Your Environment
mypy 0.790 in a virtual env (peenv) on MacOS, mypy is invoked on the shell without any special arguments and no configuration
$ mypy src/
I am using Python 3.9.0.
The text was updated successfully, but these errors were encountered: