Skip to content

Make copy methods explicit for linting #3129

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

Merged
merged 2 commits into from
Sep 29, 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
2 changes: 1 addition & 1 deletion buildconfig/stubs/pygame/cursors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Cursor:
def __getitem__(
self, index: int
) -> Union[int, IntCoordinate, Surface]: ...
copy = __copy__
def copy(self) -> Cursor: ...
type: Literal["system", "color", "bitmap"]
data: Union[
Tuple[int],
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/stubs/pygame/geometry.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ class Circle:
def rotate_ip(self, angle: float, /) -> None: ...
def as_rect(self) -> Rect: ...
def as_frect(self) -> FRect: ...
def copy(self) -> Circle: ...
def __copy__(self) -> Circle: ...
copy = __copy__
2 changes: 1 addition & 1 deletion buildconfig/stubs/pygame/mask.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def from_threshold(
class Mask:
def __init__(self, size: Coordinate, fill: bool = False) -> None: ...
def __copy__(self) -> Mask: ...
copy = __copy__
def copy(self) -> Mask: ...
def get_size(self) -> Tuple[int, int]: ...
def get_rect(self, **kwargs: Any) -> Rect: ... # Dict type needs to be completed
def get_at(self, pos: Coordinate) -> int: ...
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/stubs/pygame/math.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class _GenericVector(Collection[float]):
@overload
def __imul__(self: _TVec, other: float) -> _TVec: ...
def __copy__(self: _TVec) -> _TVec: ...
copy = __copy__
def copy(self: _TVec) -> _TVec: ...
def __safe_for_unpickling__(self) -> Literal[True]: ...
def __contains__(self, other: float) -> bool: ... # type: ignore[override]
def dot(self: _TVec, other: Union[SequenceLike[float], _TVec], /) -> float: ...
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/stubs/pygame/rect.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class _GenericRect(Collection[_N]):
@overload
def __setitem__(self, key: slice, value: Union[float, RectLike]) -> None: ...
def __copy__(self) -> Self: ...
copy = __copy__
def copy(self) -> Self: ...
@overload
def move(self, x: float, y: float, /) -> Self: ...
@overload
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/stubs/pygame/surface.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Surface:
) -> None: ...
def __copy__(self) -> Surface: ...
def __deepcopy__(self, memo) -> Surface: ...
copy = __copy__
def copy(self) -> Surface: ...
def blit(
self,
source: Surface,
Expand Down
4 changes: 2 additions & 2 deletions src_py/cursors.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ def __eq__(self, other):
def __ne__(self, other):
return not self.__eq__(other)

def __copy__(self):
def copy(self):
"""Clone the current Cursor object.
You can do the same thing by doing Cursor(Cursor)."""
return self.__class__(self)

copy = __copy__
__copy__ = copy

def __hash__(self):
return hash(tuple([self.type] + list(self.data)))
Expand Down
Loading