Closed ekzhang closed 6 months ago
I think this would fail if the inspected class definition uses from enum import Enum; class Blah(Enum)
instead of class Blah(enum.Enum)
, since we don't "rewrite" the base class qualification but still just import enum
.
I think it's acceptable to enforce "module qualified" Enums when needed though - there are some other cases the type stub generator has similar requirements at the moment iirc
I think it's acceptable to enforce "module qualified" Enums when needed though - there are some other cases the type stub generator has similar requirements at the moment iirc
Good catch here. Agree that it's acceptable (if not ideal) to have this constraint, although ideally we can give that feedback when generating the stubs rather than generating invalid stubs that cause errors at check-time.
This supports declaring Enum and subclasses of Enum like IntEnum inside translated files.