Skip to content

Commit c31a63c

Browse files
committed
Small sprite stub improvements
1 parent dd12ade commit c31a63c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

buildconfig/stubs/pygame/sprite.pyi

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ from pygame.rect import FRect, Rect
2727
from pygame.surface import Surface
2828
from pygame.typing import Point, RectLike
2929

30-
# define some useful protocols first, which sprite functions accept
31-
# sprite functions don't need all sprite attributes to be present in the
32-
# arguments passed, they only use a few which are marked in the below protocols
30+
# Some sprite functions only need objects with certain attributes, not always a sprite
3331
class _HasRect(Protocol):
3432
@property
3533
def rect(self) -> Optional[Union[FRect, Rect]]: ...
@@ -44,7 +42,7 @@ class _HasMaskAndRect(_HasRect, Protocol):
4442
@property
4543
def mask(self) -> Mask: ...
4644

47-
class Sprite:
45+
class Sprite(_HasImageAndRect):
4846
@property
4947
def image(self) -> Optional[Surface]: ...
5048
@image.setter
@@ -112,7 +110,7 @@ class AbstractGroup(Generic[_SpriteT]):
112110
class Group(AbstractGroup[_SpriteT]):
113111
def __init__(self, *sprites: _SpriteOrSprites[_SpriteT]) -> None: ...
114112

115-
# these are aliased in the code too
113+
# These deprecated types are just aliases in the code too
116114
@deprecated("Use `pygame.sprite.Group` instead")
117115
class RenderPlain(Group[_SpriteT]): ...
118116

@@ -184,7 +182,7 @@ class collide_circle_ratio:
184182
self, left: _SupportsCollideCircle, right: _SupportsCollideCircle
185183
) -> bool: ...
186184

187-
# Argument to collide_mask must either have mask or have image attribute, in
185+
# Arguments to collide_mask must either have mask or have image attribute, in
188186
# addition to mandatorily having a rect attribute
189187
_SupportsCollideMask = Union[_HasImageAndRect, _HasMaskAndRect]
190188

0 commit comments

Comments
 (0)