diff --git a/buildconfig/stubs/pygame/event.pyi b/buildconfig/stubs/pygame/event.pyi index 2fa1081f5b..6af37638e1 100644 --- a/buildconfig/stubs/pygame/event.pyi +++ b/buildconfig/stubs/pygame/event.pyi @@ -3,11 +3,9 @@ from typing_extensions import deprecated # added in 3.13 from pygame.typing import SequenceLike -@final -class Event: - # Event fields here duplicated below into EventType because Event is - # marked as final and can't be subclassed like the other xType aliases - # are to allow @deprecated. +class _GenericEvent: + # Just exists to avoid duplication of data for Event + # and (deprecated) EventType @property def type(self) -> int: ... @@ -27,27 +25,13 @@ class Event: def dict(self) -> dict[str, Any]: ... @final -@deprecated("Use `Event` instead (this is an old alias)") -class EventType: - # Duplicated Event fields here because it is marked as final and can't be - # subclassed like the other xType aliases are to allow @deprecated. - - @property - def type(self) -> int: ... - __dict__: dict[str, Any] - __hash__: None # type: ignore - def __init__( - self, type: int, dict: dict[str, Any] = ..., **kwargs: Any - ) -> None: ... - def __getattribute__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, name: str) -> None: ... - def __bool__(self) -> bool: ... +class Event(_GenericEvent): + pass - # this is at the bottom because mypy complains if this declaration comes - # before any uses of the dict[] typehinting because of the same naming - @property - def dict(self) -> dict[str, Any]: ... +@final +@deprecated("Use `Event` instead (this is an old alias)") +class EventType(_GenericEvent): + pass _EventTypes = Union[int, SequenceLike[int]]