Skip to content

Commit e9ee4c7

Browse files
authored
Merge pull request #3129 from damusss/copy-__copy__-invert
Make `copy` methods explicit for linting
2 parents 5d9b30e + f455947 commit e9ee4c7

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

buildconfig/stubs/pygame/cursors.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Cursor:
8282
def __getitem__(
8383
self, index: int
8484
) -> Union[int, IntCoordinate, Surface]: ...
85-
copy = __copy__
85+
def copy(self) -> Cursor: ...
8686
type: Literal["system", "color", "bitmap"]
8787
data: Union[
8888
Tuple[int],

buildconfig/stubs/pygame/geometry.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ class Circle:
116116
def rotate_ip(self, angle: float, /) -> None: ...
117117
def as_rect(self) -> Rect: ...
118118
def as_frect(self) -> FRect: ...
119+
def copy(self) -> Circle: ...
119120
def __copy__(self) -> Circle: ...
120-
copy = __copy__

buildconfig/stubs/pygame/mask.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def from_threshold(
1717
class Mask:
1818
def __init__(self, size: Coordinate, fill: bool = False) -> None: ...
1919
def __copy__(self) -> Mask: ...
20-
copy = __copy__
20+
def copy(self) -> Mask: ...
2121
def get_size(self) -> Tuple[int, int]: ...
2222
def get_rect(self, **kwargs: Any) -> Rect: ... # Dict type needs to be completed
2323
def get_at(self, pos: Coordinate) -> int: ...

buildconfig/stubs/pygame/math.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class _GenericVector(Collection[float]):
6565
@overload
6666
def __imul__(self: _TVec, other: float) -> _TVec: ...
6767
def __copy__(self: _TVec) -> _TVec: ...
68-
copy = __copy__
68+
def copy(self: _TVec) -> _TVec: ...
6969
def __safe_for_unpickling__(self) -> Literal[True]: ...
7070
def __contains__(self, other: float) -> bool: ... # type: ignore[override]
7171
def dot(self: _TVec, other: Union[SequenceLike[float], _TVec], /) -> float: ...

buildconfig/stubs/pygame/rect.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class _GenericRect(Collection[_N]):
143143
@overload
144144
def __setitem__(self, key: slice, value: Union[float, RectLike]) -> None: ...
145145
def __copy__(self) -> Self: ...
146-
copy = __copy__
146+
def copy(self) -> Self: ...
147147
@overload
148148
def move(self, x: float, y: float, /) -> Self: ...
149149
@overload

buildconfig/stubs/pygame/surface.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Surface:
6464
) -> None: ...
6565
def __copy__(self) -> Surface: ...
6666
def __deepcopy__(self, memo) -> Surface: ...
67-
copy = __copy__
67+
def copy(self) -> Surface: ...
6868
def blit(
6969
self,
7070
source: Surface,

src_py/cursors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ def __eq__(self, other):
106106
def __ne__(self, other):
107107
return not self.__eq__(other)
108108

109-
def __copy__(self):
109+
def copy(self):
110110
"""Clone the current Cursor object.
111111
You can do the same thing by doing Cursor(Cursor)."""
112112
return self.__class__(self)
113113

114-
copy = __copy__
114+
__copy__ = copy
115115

116116
def __hash__(self):
117117
return hash(tuple([self.type] + list(self.data)))

0 commit comments

Comments
 (0)