Support `enum.global_enum`
Feature
Mypy should support module-level constants defined by enum.global_enum.
Pitch
enum.global_enum adds an enum’s members to the global namespace. Mypy reports errors for any use of global constants defined that way. It would make enum_global much more usable if mypy recognized them as defined.
Example file:
import enum
@enum.global_enum
class Example(enum.Enum):
X = enum.auto()
print(X)
Current behavior:
$ python3.11 global_enum.py
X
$ mypy global_enum.py
global_enum.py:7: error: Name "X" is not defined [name-defined]
Found 1 error in 1 file (checked 1 source file)
This is a standard library feature. Why is it ignored?
Mypy is a volunteer project and features get added only when someone is sufficiently motivated to contribute them.
The enum module has a lot of features and knobs, many of which are rarely used. So for a lot of people, it's not especially important to get all of it implemented.