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

Rect and Color type hint fixes #2079

Merged
merged 1 commit into from Sep 6, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions buildconfig/pygame-stubs/color.pyi
@@ -1,4 +1,4 @@
from typing import Text, Tuple, Union, overload, List
from typing import Text, Tuple, Union, overload, List, Optional

_ColorValue = Union[
"Color", str, Tuple[int, int, int], List[int], int, Tuple[int, int, int, int]
Expand All @@ -15,11 +15,9 @@ class Color:
i1i2i3: Tuple[float, float, float]
__hash__: None # type: ignore
@overload
def __init__(self, name: Text) -> None: ...
def __init__(self, r: int, g: int, b: int, a: Optional[int] = ...) -> None: ...
@overload
def __init__(self, r: int, g: int, b: int, a: int = ...) -> None: ...
@overload
def __init__(self, rgbvalue: Union[Text, int]) -> None: ...
def __init__(self, rgbvalue: _ColorValue) -> None: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
Expand Down
14 changes: 13 additions & 1 deletion buildconfig/pygame-stubs/rect.pyi
Expand Up @@ -51,18 +51,30 @@ class Rect(object):
@overload
def __init__(
self,
left_top_width_height: Union[Tuple[float, float, float, float], List[float]],
left_top_width_height: Union[Rect, Tuple[float, float, float, float], List[float]]
) -> None: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
def __getitem__(self, s: slice) -> List[int]: ...
def copy(self) -> Rect: ...
@overload
def move(self, x: float, y: float) -> Rect: ...
@overload
def move(self, move_by: _Coordinate) -> Rect: ...
@overload
def move_ip(self, x: float, y: float) -> None: ...
@overload
def move_ip(self, move_by: _Coordinate) -> None: ...
@overload
def inflate(self, x: float, y: float) -> Rect: ...
@overload
def inflate(self, inflate_by: _Coordinate) -> Rect: ...
@overload
def inflate_ip(self, x: float, y: float) -> None: ...
@overload
def inflate_ip(self, inflate_by: _Coordinate) -> None: ...
@overload
def clamp(self, rect: Union[_RectStyle, Rect]) -> Rect: ...
@overload
def clamp(
Expand Down