Found this whilst applying various Ruff groups on typeshed.
According to the updated typing spec for typing enums (see Mypy: Change to Enum Membership Semantics and https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members, this is the recommended way to type an enum in stubs where the type is known but the value isn't:
class Key(enum.Enum):
alt = cast(KeyCode, ...)
alt_l = cast(KeyCode, ...)
alt_r = cast(KeyCode, ...)
alt_gr = cast(KeyCode, ...)
# ...
This will trigger runtime-cast-value (TC006)
Related: #15132
Ruff: 0.8.4
Command: ruff check --preview --select=TC006 --isolated