Skip to content

Commit

Permalink
Merge pull request #3129 from damusss/copy-__copy__-invert
Browse files Browse the repository at this point in the history
Make `copy` methods explicit for linting
  • Loading branch information
zoldalma999 authored Sep 29, 2024
2 parents 5d9b30e + f455947 commit e9ee4c7
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
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 @@ -116,5 +116,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

0 comments on commit e9ee4c7

Please sign in to comment.