Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove RGBATuple #3102

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions buildconfig/stubs/pygame/surface.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ from pygame.typing import (
ColorLike,
Coordinate,
RectLike,
RGBATuple,
SequenceLike,
)

Expand Down Expand Up @@ -109,7 +108,7 @@ class Surface:
def set_colorkey(self, color: ColorLike, flags: int = 0, /) -> None: ...
@overload
def set_colorkey(self, color: None, /) -> None: ...
def get_colorkey(self) -> Optional[RGBATuple]: ...
def get_colorkey(self) -> Optional[Tuple[int, int, int, int]]: ...
@overload
def set_alpha(self, value: int, flags: int = 0, /) -> None: ...
@overload
Expand Down
6 changes: 3 additions & 3 deletions buildconfig/stubs/pygame/transform.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Optional, Union, Literal
from typing import Optional, Union, Literal, Tuple

from pygame.surface import Surface

from pygame.typing import ColorLike, Coordinate, RectLike, SequenceLike, RGBATuple
from pygame.typing import ColorLike, Coordinate, RectLike, SequenceLike

def flip(surface: Surface, flip_x: bool, flip_y: bool) -> Surface: ...
def scale(
Expand Down Expand Up @@ -41,7 +41,7 @@ def average_surfaces(
) -> Surface: ...
def average_color(
surface: Surface, rect: Optional[RectLike] = None, consider_alpha: bool = False
) -> RGBATuple: ...
) -> Tuple[int, int, int, int]: ...
def threshold(
dest_surface: Optional[Surface],
surface: Surface,
Expand Down
3 changes: 0 additions & 3 deletions buildconfig/stubs/pygame/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ __all__ = [
"SequenceLike",
"FileLike",
"ColorLike",
"RGBATuple",
"Coordinate",
"IntCoordinate",
]
Expand Down Expand Up @@ -54,8 +53,6 @@ Coordinate = SequenceLike[float]
# This is used where ints are strictly required
IntCoordinate = SequenceLike[int]

# Used for functions that return an RGBA tuple
RGBATuple = Tuple[int, int, int, int]
ColorLike = Union[int, str, SequenceLike[int]]


Expand Down
5 changes: 0 additions & 5 deletions buildconfig/stubs/typing_sample_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,10 @@ def validator_IntCoordinate(coordinate: typing.IntCoordinate) -> int:
validator_IntCoordinate([-4, -3])


# validate RGBATuple, ColorLike
def validator_RGBATuple(rgba: typing.RGBATuple) -> int:
return 0

def validator_ColorLike(color: typing.ColorLike) -> int:
return 0

# must pass
validator_RGBATuple((100, 200, 50, 20))
validator_ColorLike("green")
validator_ColorLike(1)
validator_ColorLike((255, 255, 255, 30))
Expand Down
4 changes: 0 additions & 4 deletions docs/reST/ref/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ type aliases for proper typehint annotations.

A sequence of strictly two integers such as ``[a, b]`` or ``(a, b)``.

.. data:: RGBATuple

A tuple of four integers ``(r, g, b, a)`` in range 0-255 such as ``(20, 255, 0, 100)``.

.. data:: ColorLike

An object representing a color such as a mapped integer, a string or
Expand Down
1 change: 0 additions & 1 deletion src_c/doc/typing_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
#define DOC_TYPING_SEQUENCELIKE ""
#define DOC_TYPING_COORDINATE ""
#define DOC_TYPING_INTCOORDINATE ""
#define DOC_TYPING_RGBATUPLE ""
#define DOC_TYPING_COLORLIKE ""
#define DOC_TYPING_RECTLIKE ""
3 changes: 0 additions & 3 deletions src_py/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"SequenceLike",
"FileLike",
"ColorLike",
"RGBATuple",
"Coordinate",
"IntCoordinate",
]
Expand Down Expand Up @@ -54,8 +53,6 @@ def __len__(self) -> int: ...
# This is used where ints are strictly required
IntCoordinate = SequenceLike[int]

# Used for functions that return an RGBA tuple
RGBATuple = Tuple[int, int, int, int]
ColorLike = Union[int, str, SequenceLike[int]]


Expand Down
Loading