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

Rename pygame.typing.Coordinate to Point, fix related grammar #3139

Merged
merged 4 commits into from
Oct 4, 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
42 changes: 21 additions & 21 deletions buildconfig/stubs/pygame/_sdl2/video.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from pygame.rect import Rect
from pygame.surface import Surface
from pygame.window import Window as Window

from pygame.typing import ColorLike, RectLike, Coordinate
from pygame.typing import ColorLike, RectLike, Point

WINDOWPOS_UNDEFINED: int
WINDOWPOS_CENTERED: int
Expand Down Expand Up @@ -74,26 +74,26 @@ class Texture:
) -> None: ...
def draw_triangle(
self,
p1_xy: Coordinate,
p2_xy: Coordinate,
p3_xy: Coordinate,
p1_uv: Coordinate = (0.0, 0.0),
p2_uv: Coordinate = (1.0, 1.0),
p3_uv: Coordinate = (0.0, 1.0),
p1_xy: Point,
p2_xy: Point,
p3_xy: Point,
p1_uv: Point = (0.0, 0.0),
p2_uv: Point = (1.0, 1.0),
p3_uv: Point = (0.0, 1.0),
p1_mod: Iterable[int] = (255, 255, 255, 255),
p2_mod: Iterable[int] = (255, 255, 255, 255),
p3_mod: Iterable[int] = (255, 255, 255, 255),
) -> None: ...
def draw_quad(
self,
p1_xy: Coordinate,
p2_xy: Coordinate,
p3_xy: Coordinate,
p4_xy: Coordinate,
p1_uv: Coordinate = (0.0, 0.0),
p2_uv: Coordinate = (1.0, 0.0),
p3_uv: Coordinate = (1.0, 1.0),
p4_uv: Coordinate = (0.0, 1.0),
p1_xy: Point,
p2_xy: Point,
p3_xy: Point,
p4_xy: Point,
p1_uv: Point = (0.0, 0.0),
p2_uv: Point = (1.0, 0.0),
p3_uv: Point = (1.0, 1.0),
p4_uv: Point = (0.0, 1.0),
p1_mod: Iterable[int] = (255, 255, 255, 255),
p2_mod: Iterable[int] = (255, 255, 255, 255),
p3_mod: Iterable[int] = (255, 255, 255, 255),
Expand Down Expand Up @@ -155,21 +155,21 @@ class Renderer:
area: Optional[RectLike] = None,
special_flags: int = 0,
) -> Rect: ...
def draw_line(self, p1: Coordinate, p2: Coordinate) -> None: ...
def draw_point(self, point: Coordinate) -> None: ...
def draw_line(self, p1: Point, p2: Point) -> None: ...
def draw_point(self, point: Point) -> None: ...
def draw_rect(self, rect: RectLike) -> None: ...
def fill_rect(self, rect: RectLike) -> None: ...
def draw_triangle(
self, p1: Coordinate, p2: Coordinate, p3: Coordinate
self, p1: Point, p2: Point, p3: Point
) -> None: ...
def fill_triangle(
self, p1: Coordinate, p2: Coordinate, p3: Coordinate
self, p1: Point, p2: Point, p3: Point
) -> None: ...
def draw_quad(
self, p1: Coordinate, p2: Coordinate, p3: Coordinate, p4: Coordinate
self, p1: Point, p2: Point, p3: Point, p4: Point
) -> None: ...
def fill_quad(
self, p1: Coordinate, p2: Coordinate, p3: Coordinate, p4: Coordinate
self, p1: Point, p2: Point, p3: Point, p4: Point
) -> None: ...
def to_surface(
self, surface: Optional[Surface] = None, area: Optional[RectLike] = None
Expand Down
4 changes: 2 additions & 2 deletions buildconfig/stubs/pygame/camera.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC, abstractmethod
from typing import List, Optional, Tuple, Union, Literal

from pygame.typing import IntCoordinate
from pygame.typing import IntPoint

from pygame.surface import Surface

Expand Down Expand Up @@ -36,7 +36,7 @@ class Camera(AbstractCamera):
def __init__(
self,
device: Union[str, int] = 0,
size: IntCoordinate = (640, 480),
size: IntPoint = (640, 480),
format: str = "RGB",
) -> None: ...
def start(self) -> None: ...
Expand Down
12 changes: 6 additions & 6 deletions buildconfig/stubs/pygame/cursors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from typing import Any, Iterator, Literal, Tuple, Union, overload

from pygame.surface import Surface

from pygame.typing import FileLike, IntCoordinate, SequenceLike
from pygame.typing import FileLike, IntPoint, SequenceLike

_Small_string = Tuple[
str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str
Expand Down Expand Up @@ -64,15 +64,15 @@ class Cursor:
@overload
def __init__(
self,
size: IntCoordinate,
hotspot: IntCoordinate,
size: IntPoint,
hotspot: IntPoint,
xormasks: SequenceLike[int],
andmasks: SequenceLike[int],
) -> None: ...
@overload
def __init__(
self,
hotspot: IntCoordinate,
hotspot: IntPoint,
surface: Surface,
) -> None: ...
def __iter__(self) -> Iterator[Any]: ...
Expand All @@ -81,11 +81,11 @@ class Cursor:
def __hash__(self) -> int: ...
def __getitem__(
self, index: int
) -> Union[int, IntCoordinate, Surface]: ...
) -> Union[int, IntPoint, Surface]: ...
def copy(self) -> Cursor: ...
type: Literal["system", "color", "bitmap"]
data: Union[
Tuple[int],
Tuple[Tuple[int, int], Tuple[int, int], Tuple[int, ...], Tuple[int, ...]],
Tuple[IntCoordinate, Surface],
Tuple[IntPoint, Surface],
]
12 changes: 6 additions & 6 deletions buildconfig/stubs/pygame/display.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ from pygame._sdl2 import Window

from pygame.typing import (
ColorLike,
Coordinate,
IntCoordinate,
Point,
IntPoint,
RectLike,
SequenceLike,
)
Expand Down Expand Up @@ -37,7 +37,7 @@ def init() -> None: ...
def quit() -> None: ...
def get_init() -> bool: ...
def set_mode(
size: Coordinate = (0, 0),
size: Point = (0, 0),
flags: int = 0,
depth: int = 0,
display: int = 0,
Expand All @@ -52,7 +52,7 @@ def update(
@overload
def update(x: int, y: int, w: int, h: int, /) -> None: ...
@overload
def update(xy: Coordinate, wh: Coordinate, /) -> None: ...
def update(xy: Point, wh: Point, /) -> None: ...
def get_driver() -> str: ...
def Info() -> _VidInfo: ...
def get_wm_info() -> Dict[str, int]: ...
Expand All @@ -62,7 +62,7 @@ def list_modes(
display: int = 0,
) -> List[Tuple[int, int]]: ...
def mode_ok(
size: IntCoordinate,
size: IntPoint,
flags: int = 0,
depth: int = 0,
display: int = 0,
Expand All @@ -85,7 +85,7 @@ def set_palette(palette: SequenceLike[ColorLike], /) -> None: ...
def get_num_displays() -> int: ...
def get_window_size() -> Tuple[int, int]: ...
def get_window_position() -> Tuple[int, int]:...
def set_window_position(position: Coordinate) -> None:...
def set_window_position(position: Point) -> None:...
def get_allow_screensaver() -> bool: ...
def set_allow_screensaver(value: bool = True) -> None: ...
def get_desktop_sizes() -> List[Tuple[int, int]]: ...
Expand Down
22 changes: 11 additions & 11 deletions buildconfig/stubs/pygame/draw.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from pygame.rect import Rect
from pygame.surface import Surface
from typing import overload

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

def rect(
surface: Surface,
Expand All @@ -18,13 +18,13 @@ def rect(
def polygon(
surface: Surface,
color: ColorLike,
points: SequenceLike[Coordinate],
points: SequenceLike[Point],
width: int = 0,
) -> Rect: ...
def circle(
surface: Surface,
color: ColorLike,
center: Coordinate,
center: Point,
radius: float,
width: int = 0,
draw_top_right: bool = False,
Expand All @@ -36,15 +36,15 @@ def circle(
def aacircle(
surface: Surface,
color: ColorLike,
center: Coordinate,
center: Point,
radius: float,
width: int = 0,
) -> Rect: ...
@overload
def aacircle(
surface: Surface,
color: ColorLike,
center: Coordinate,
center: Point,
radius: float,
width: int = 0,
draw_top_right: bool = False,
Expand All @@ -66,26 +66,26 @@ def arc(
def line(
surface: Surface,
color: ColorLike,
start_pos: Coordinate,
end_pos: Coordinate,
start_pos: Point,
end_pos: Point,
width: int = 1,
) -> Rect: ...
def lines(
surface: Surface,
color: ColorLike,
closed: bool,
points: SequenceLike[Coordinate],
points: SequenceLike[Point],
width: int = 1,
) -> Rect: ...
def aaline(
surface: Surface,
color: ColorLike,
start_pos: Coordinate,
end_pos: Coordinate,
start_pos: Point,
end_pos: Point,
) -> Rect: ...
def aalines(
surface: Surface,
color: ColorLike,
closed: bool,
points: SequenceLike[Coordinate],
points: SequenceLike[Point],
) -> Rect: ...
34 changes: 17 additions & 17 deletions buildconfig/stubs/pygame/geometry.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ from typing import (
)

from pygame import Rect, FRect
from pygame.typing import Coordinate, RectLike, SequenceLike
from pygame.typing import Point, RectLike, SequenceLike
from .rect import Rect, FRect
from .math import Vector2

_CanBeCircle = Union[Circle, Tuple[Coordinate, float], SequenceLike[float]]
_CanBeCircle = Union[Circle, Tuple[Point, float], SequenceLike[float]]

class _HasCirclettribute(Protocol):
# An object that has a circle attribute that is either a circle, or a function
# that returns a circle
circle: Union[_CanBeCircle, Callable[[], _CanBeCircle]]

_CircleValue = Union[_CanBeCircle, _HasCirclettribute]
_CanBeCollided = Union[Circle, Rect, FRect, Coordinate, Vector2]
_CanBeCollided = Union[Circle, Rect, FRect, Point, Vector2]
_CanBeIntersected = Union[Circle]

class Circle:
Expand Down Expand Up @@ -64,53 +64,53 @@ class Circle:
@property
def center(self) -> Tuple[float, float]: ...
@center.setter
def center(self, value: Coordinate) -> None: ...
def center(self, value: Point) -> None: ...
@property
def top(self) -> Tuple[float, float]: ...
@top.setter
def top(self, value: Coordinate) -> None: ...
def top(self, value: Point) -> None: ...
@property
def left(self) -> Tuple[float, float]: ...
@left.setter
def left(self, value: Coordinate) -> None: ...
def left(self, value: Point) -> None: ...
@property
def bottom(self) -> Tuple[float, float]: ...
@bottom.setter
def bottom(self, value: Coordinate) -> None: ...
def bottom(self, value: Point) -> None: ...
@property
def right(self) -> Tuple[float, float]: ...
@right.setter
def right(self, value: Coordinate) -> None: ...
def right(self, value: Point) -> None: ...
@overload
def __init__(self, x: float, y: float, r: float) -> None: ...
@overload
def __init__(self, pos: Coordinate, r: float) -> None: ...
def __init__(self, pos: Point, r: float) -> None: ...
@overload
def __init__(self, circle: _CircleValue) -> None: ...
@overload
def move(self, x: float, y: float, /) -> Circle: ...
@overload
def move(self, move_by: Coordinate, /) -> Circle: ...
def move(self, move_by: Point, /) -> Circle: ...
@overload
def move_ip(self, x: float, y: float, /) -> None: ...
@overload
def move_ip(self, move_by: Coordinate, /) -> None: ...
def move_ip(self, move_by: Point, /) -> None: ...
@overload
def collidepoint(self, x: float, y: float, /) -> bool: ...
@overload
def collidepoint(self, point: Coordinate, /) -> bool: ...
def collidepoint(self, point: Point, /) -> bool: ...
@overload
def collidecircle(self, circle: _CircleValue, /) -> bool: ...
@overload
def collidecircle(self, x: float, y: float, r: float, /) -> bool: ...
@overload
def collidecircle(self, center: Coordinate, r: float, /) -> bool: ...
def collidecircle(self, center: Point, r: float, /) -> bool: ...
@overload
def colliderect(self, rect: RectLike, /) -> bool: ...
@overload
def colliderect(self, x: float, y: float, w: float, h: float, /) -> bool: ...
@overload
def colliderect(self, topleft: Coordinate, size: Coordinate, /) -> bool: ...
def colliderect(self, topleft: Point, size: Point, /) -> bool: ...
def collideswith(self, other: _CanBeCollided, /) -> bool: ...
def collidelist(self, colliders: Sequence[_CanBeCollided], /) -> int: ...
def collidelistall(self, colliders: Sequence[_CanBeCollided], /) -> List[int]: ...
Expand All @@ -121,13 +121,13 @@ class Circle:
@overload
def update(self, x: float, y: float, r: float, /) -> None: ...
@overload
def update(self, center: Coordinate, r: float, /) -> None: ...
def update(self, center: Point, r: float, /) -> None: ...
@overload
def rotate(self, angle: float, rotation_point: Coordinate, /) -> Circle: ...
def rotate(self, angle: float, rotation_point: Point, /) -> Circle: ...
@overload
def rotate(self, angle: float, /) -> Circle: ...
@overload
def rotate_ip(self, angle: float, rotation_point: Coordinate, /) -> None: ...
def rotate_ip(self, angle: float, rotation_point: Point, /) -> None: ...
@overload
def rotate_ip(self, angle: float, /) -> None: ...
def as_rect(self) -> Rect: ...
Expand Down
12 changes: 6 additions & 6 deletions buildconfig/stubs/pygame/gfxdraw.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pygame.surface import Surface

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

def pixel(surface: Surface, x: int, y: int, color: ColorLike, /) -> None: ...
def hline(surface: Surface, x1: int, x2: int, y: int, color: ColorLike, /) -> None: ...
Expand Down Expand Up @@ -73,17 +73,17 @@ def filled_trigon(
color: ColorLike, /
) -> None: ...
def polygon(
surface: Surface, points: SequenceLike[Coordinate], color: ColorLike, /
surface: Surface, points: SequenceLike[Point], color: ColorLike, /
) -> None: ...
def aapolygon(
surface: Surface, points: SequenceLike[Coordinate], color: ColorLike, /
surface: Surface, points: SequenceLike[Point], color: ColorLike, /
) -> None: ...
def filled_polygon(
surface: Surface, points: SequenceLike[Coordinate], color: ColorLike, /
surface: Surface, points: SequenceLike[Point], color: ColorLike, /
) -> None: ...
def textured_polygon(
surface: Surface, points: SequenceLike[Coordinate], texture: Surface, tx: int, ty: int, /
surface: Surface, points: SequenceLike[Point], texture: Surface, tx: int, ty: int, /
) -> None: ...
def bezier(
surface: Surface, points: SequenceLike[Coordinate], steps: int, color: ColorLike, /
surface: Surface, points: SequenceLike[Point], steps: int, color: ColorLike, /
) -> None: ...
Loading
Loading