diff --git a/mypy/typeops.py b/mypy/typeops.py index ab8eca30eaf2c..568014b155e7b 100644 --- a/mypy/typeops.py +++ b/mypy/typeops.py @@ -30,7 +30,6 @@ ) from mypy.state import state from mypy.types import ( - ENUM_REMOVED_PROPS, AnyType, CallableType, ExtraAttrs, @@ -879,8 +878,7 @@ class Status(Enum): elif isinstance(typ, Instance) and typ.type.fullname == target_fullname: if typ.type.is_enum: return make_simplified_union( - [LiteralType(name, typ) for name in typ.get_enum_values()], - contract_literals=False, + [LiteralType(name, typ) for name in typ.get_enum_values()], contract_literals=False ) elif typ.type.fullname == "builtins.bool": return make_simplified_union( diff --git a/mypy/types.py b/mypy/types.py index 61de3a6dfa1a6..92377cbbca56c 100644 --- a/mypy/types.py +++ b/mypy/types.py @@ -1496,7 +1496,8 @@ def is_singleton_type(self) -> bool: def get_enum_values(self) -> list[str]: """Return the list of values for an Enum.""" return [ - name for name, sym in self.type.names.items() + name + for name, sym in self.type.names.items() if ( isinstance(sym.node, mypy.nodes.Var) and name not in ENUM_REMOVED_PROPS