Skip to content

Commit 793a5ee

Browse files
committed
Add __class_getitem__ to type stubs
1 parent 6cb3857 commit 793a5ee

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

buildconfig/stubs/pygame/sprite.pyi

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import typing
12
from typing import (
23
Any,
34
Callable,
@@ -13,7 +14,7 @@ from typing import (
1314
TypeVar,
1415
Union,
1516
)
16-
from typing_extensions import deprecated # added in 3.13
17+
from typing_extensions import deprecated # added in 3.13
1718

1819
from pygame.rect import FRect, Rect
1920
from pygame.surface import Surface
@@ -149,6 +150,7 @@ _TDirtySprite = TypeVar("_TDirtySprite", bound=_DirtySpriteSupportsGroup)
149150
class AbstractGroup(Generic[_TSprite]):
150151
spritedict: Dict[_TSprite, Optional[Union[FRect, Rect]]]
151152
lostsprites: List[Union[FRect, Rect]]
153+
def __class_getitem__(cls, generic: Any) -> typing._GenericAlias: ... # type: ignore[attr-defined]
152154
def __init__(self) -> None: ...
153155
def __len__(self) -> int: ...
154156
def __iter__(self) -> Iterator[_TSprite]: ...
@@ -185,10 +187,12 @@ class Group(AbstractGroup[_TSprite]):
185187
# these are aliased in the code too
186188
@deprecated("Use `pygame.sprite.Group` instead")
187189
class RenderPlain(Group): ...
190+
188191
@deprecated("Use `pygame.sprite.Group` instead")
189192
class RenderClear(Group): ...
190193

191194
class RenderUpdates(Group[_TSprite]): ...
195+
192196
@deprecated("Use `pygame.sprite.RenderUpdates` instead")
193197
class OrderedUpdates(RenderUpdates[_TSprite]): ...
194198

@@ -200,7 +204,7 @@ class LayeredUpdates(AbstractGroup[_TSprite]):
200204
AbstractGroup[_TSprite],
201205
Iterable[Union[_TSprite, AbstractGroup[_TSprite]]],
202206
],
203-
**kwargs: Any
207+
**kwargs: Any,
204208
) -> None: ...
205209
def add(
206210
self,
@@ -209,7 +213,7 @@ class LayeredUpdates(AbstractGroup[_TSprite]):
209213
AbstractGroup[_TSprite],
210214
Iterable[Union[_TSprite, AbstractGroup[_TSprite]]],
211215
],
212-
**kwargs: Any
216+
**kwargs: Any,
213217
) -> None: ...
214218
def get_sprites_at(self, pos: Point) -> List[_TSprite]: ...
215219
def get_sprite(self, idx: int) -> _TSprite: ...
@@ -238,10 +242,10 @@ class LayeredDirty(LayeredUpdates[_TDirtySprite]):
238242
def set_timing_threshold(
239243
self, time_ms: SupportsFloat
240244
) -> None: ... # This actually accept any value
241-
@deprecated("since 2.1.1. Use `pygame.sprite.LayeredDirty.set_timing_threshold` instead")
242-
def set_timing_treshold(
243-
self, time_ms: SupportsFloat
244-
) -> None: ...
245+
@deprecated(
246+
"since 2.1.1. Use `pygame.sprite.LayeredDirty.set_timing_threshold` instead"
247+
)
248+
def set_timing_treshold(self, time_ms: SupportsFloat) -> None: ...
245249

246250
class GroupSingle(AbstractGroup[_TSprite]):
247251
sprite: _TSprite

0 commit comments

Comments
 (0)