diff --git a/buildconfig/stubs/pygame/event.pyi b/buildconfig/stubs/pygame/event.pyi index 1ad71ac57a..b3c832bb03 100644 --- a/buildconfig/stubs/pygame/event.pyi +++ b/buildconfig/stubs/pygame/event.pyi @@ -1,9 +1,12 @@ from typing import Any, Optional, Union, final +from typing_extensions import deprecated # added in 3.13 from pygame.typing import SequenceLike -@final -class Event: +class _GenericEvent: + # Just exists to avoid duplication of data for Event + # and (deprecated) EventType + @property def type(self) -> int: ... __dict__: dict[str, Any] @@ -21,6 +24,15 @@ class Event: @property def dict(self) -> dict[str, Any]: ... +@final +class Event(_GenericEvent): + pass + +@final +@deprecated("Use `Event` instead (EventType is an old alias)") +class EventType(_GenericEvent): + pass + _EventTypes = Union[int, SequenceLike[int]] def pump() -> None: ... @@ -41,5 +53,3 @@ def set_grab(grab: bool, /) -> None: ... def get_grab() -> bool: ... def post(event: Event, /) -> bool: ... def custom_type() -> int: ... - -EventType = Event diff --git a/buildconfig/stubs/pygame/font.pyi b/buildconfig/stubs/pygame/font.pyi index 931d8ceeba..efc72f0ae4 100644 --- a/buildconfig/stubs/pygame/font.pyi +++ b/buildconfig/stubs/pygame/font.pyi @@ -1,5 +1,6 @@ from collections.abc import Callable, Hashable, Iterable from typing import Literal, Optional, Union +from typing_extensions import deprecated # added in 3.13 from pygame.surface import Surface @@ -87,4 +88,5 @@ class Font: def get_point_size(self) -> int: ... def set_point_size(self, val: int, /) -> None: ... -FontType = Font +@deprecated("Use `Font` instead (FontType is an old alias)") +class FontType(Font): ... diff --git a/buildconfig/stubs/pygame/mask.pyi b/buildconfig/stubs/pygame/mask.pyi index 18d6e4e69d..0da8a2475f 100644 --- a/buildconfig/stubs/pygame/mask.pyi +++ b/buildconfig/stubs/pygame/mask.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional, Union +from typing_extensions import deprecated # added in 3.13 from pygame.rect import Rect from pygame.surface import Surface @@ -54,4 +55,5 @@ class Mask: dest: Union[RectLike, Point] = (0, 0), ) -> Surface: ... -MaskType = Mask +@deprecated("Use `Mask` instead (MaskType is an old alias)") +class MaskType(Mask): ... diff --git a/buildconfig/stubs/pygame/mixer.pyi b/buildconfig/stubs/pygame/mixer.pyi index 205679768c..198881789c 100644 --- a/buildconfig/stubs/pygame/mixer.pyi +++ b/buildconfig/stubs/pygame/mixer.pyi @@ -1,4 +1,5 @@ from typing import Any, Optional, Union, overload +from typing_extensions import deprecated # added in 3.13 import numpy @@ -100,5 +101,8 @@ class Channel: def set_endevent(self, type: Union[int, Event] = 0, /) -> None: ... def get_endevent(self) -> int: ... -SoundType = Sound -ChannelType = Channel +@deprecated("Use `Sound` instead (SoundType is an old alias)") +class SoundType(Sound): ... + +@deprecated("Use `Channel` instead (ChannelType is an old alias)") +class ChannelType(Channel): ... diff --git a/buildconfig/stubs/pygame/rect.pyi b/buildconfig/stubs/pygame/rect.pyi index 72bf30b73f..e8a49d5f31 100644 --- a/buildconfig/stubs/pygame/rect.pyi +++ b/buildconfig/stubs/pygame/rect.pyi @@ -8,6 +8,7 @@ from typing import ( overload, Optional, ) +from typing_extensions import deprecated # added in 3.13 from pygame.typing import Point, RectLike, SequenceLike @@ -276,5 +277,8 @@ class Rect(_GenericRect[int]): class FRect(_GenericRect[float]): ... -RectType = Rect -FRectType = FRect +@deprecated("Use `Rect` instead (RectType is an old alias)") +class RectType(Rect): ... + +@deprecated("Use `FRect` instead (FRectType is an old alias)") +class FRectType(FRect): ... diff --git a/buildconfig/stubs/pygame/surface.pyi b/buildconfig/stubs/pygame/surface.pyi index 98425b8adf..b439d479e1 100644 --- a/buildconfig/stubs/pygame/surface.pyi +++ b/buildconfig/stubs/pygame/surface.pyi @@ -168,4 +168,5 @@ class Surface: def premul_alpha(self) -> Surface: ... def premul_alpha_ip(self) -> Surface: ... -SurfaceType = Surface +@deprecated("Use `Surface` instead (SurfaceType is an old alias)") +class SurfaceType(Surface): ...