Skip to content

Added more / (positional-only notation) #2691

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
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
30 changes: 15 additions & 15 deletions buildconfig/stubs/pygame/geometry.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,34 @@ class Circle:
@overload
def __init__(self, circle: _CircleValue) -> None: ...
@overload
def move(self, x: float, y: float) -> Circle: ...
def move(self, x: float, y: float, /) -> Circle: ...
@overload
def move(self, move_by: Coordinate) -> Circle: ...
def move(self, move_by: Coordinate, /) -> Circle: ...
@overload
def move_ip(self, x: float, y: float) -> None: ...
def move_ip(self, x: float, y: float, /) -> None: ...
@overload
def move_ip(self, move_by: Coordinate) -> None: ...
def move_ip(self, move_by: Coordinate, /) -> None: ...
@overload
def collidepoint(self, x: float, y: float) -> bool: ...
def collidepoint(self, x: float, y: float, /) -> bool: ...
@overload
def collidepoint(self, point: Coordinate) -> bool: ...
def collidepoint(self, point: Coordinate, /) -> bool: ...
@overload
def collidecircle(self, circle: _CircleValue) -> bool: ...
def collidecircle(self, circle: _CircleValue, /) -> bool: ...
@overload
def collidecircle(self, x: float, y: float, r: float) -> bool: ...
def collidecircle(self, x: float, y: float, r: float, /) -> bool: ...
@overload
def collidecircle(self, center: Coordinate, r: float) -> bool: ...
def collidecircle(self, center: Coordinate, r: float, /) -> bool: ...
@overload
def colliderect(self, rect: RectValue) -> bool: ...
def colliderect(self, rect: RectValue, /) -> bool: ...
@overload
def colliderect(self, x: float, y: float, w: float, h: float) -> bool: ...
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: Coordinate, size: Coordinate, /) -> bool: ...
@overload
def update(self, circle: _CircleValue) -> None: ...
def update(self, circle: _CircleValue, /) -> None: ...
@overload
def update(self, x: float, y: float, r: float) -> None: ...
def update(self, x: float, y: float, r: float, /) -> None: ...
@overload
def update(self, center: Coordinate, r: float) -> None: ...
def update(self, center: Coordinate, r: float, /) -> None: ...
def __copy__(self) -> Circle: ...
copy = __copy__
36 changes: 18 additions & 18 deletions docs/reST/ref/geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@
.. method:: collidepoint

| :sl:`test if a point is inside the circle`
| :sg:`collidepoint((x, y)) -> bool`
| :sg:`collidepoint(x, y) -> bool`
| :sg:`collidepoint(Vector2) -> bool`
| :sg:`collidepoint((x, y), /) -> bool`
| :sg:`collidepoint(x, y, /) -> bool`
| :sg:`collidepoint(vector2, /) -> bool`

The `collidepoint` method tests whether a given point is inside the `Circle`
(including the edge of the `Circle`). It takes a tuple of (x, y) coordinates, two
Expand All @@ -161,9 +161,9 @@
.. method:: collidecircle

| :sl:`test if two circles collide`
| :sg:`collidecircle(Circle) -> bool`
| :sg:`collidecircle(x, y, radius) -> bool`
| :sg:`collidecircle((x, y), radius) -> bool`
| :sg:`collidecircle(circle, /) -> bool`
| :sg:`collidecircle(x, y, radius, /) -> bool`
| :sg:`collidecircle((x, y), radius, /) -> bool`

The `collidecircle` method tests whether two `Circle` objects overlap. It takes either
a `Circle` object, a tuple of (x, y) coordinates and a radius, or separate x and y
Expand All @@ -179,9 +179,9 @@
.. method:: move

| :sl:`moves the circle by a given amount`
| :sg:`move((x, y)) -> Circle`
| :sg:`move(x, y) -> Circle`
| :sg:`move(Vector2) -> Circle`
| :sg:`move((x, y), /) -> Circle`
| :sg:`move(x, y, /) -> Circle`
| :sg:`move(vector2, /) -> Circle`

The `move` method allows you to create a new `Circle` object that is moved by a given
offset from the original `Circle`. This is useful if you want to move a `Circle` without
Expand All @@ -201,9 +201,9 @@
.. method:: move_ip

| :sl:`moves the circle by a given amount, in place`
| :sg:`move_ip((x, y)) -> None`
| :sg:`move_ip(x, y) -> None`
| :sg:`move_ip(Vector2) -> None`
| :sg:`move_ip((x, y), /) -> None`
| :sg:`move_ip(x, y, /) -> None`
| :sg:`move_ip(vector2, /) -> None`

The `move_ip` method is similar to the move method, but it moves the `Circle` in place,
modifying the original `Circle` object. This method takes the same types of arguments
Expand All @@ -222,10 +222,10 @@
.. method:: colliderect

| :sl:`checks if a rectangle intersects the circle`
| :sg:`colliderect(Rect) -> bool`
| :sg:`colliderect((x, y, width, height)) -> bool`
| :sg:`colliderect(x, y, width, height) -> bool`
| :sg:`colliderect((x, y), (width, height)) -> bool`
| :sg:`colliderect(rect, /) -> bool`
| :sg:`colliderect((x, y, width, height), /) -> bool`
| :sg:`colliderect(x, y, width, height, /) -> bool`
| :sg:`colliderect((x, y), (width, height), /) -> bool`

The `colliderect` method tests whether a given rectangle intersects the `Circle`. It
takes either a `Rect` object, a tuple of (x, y, width, height) coordinates, or separate
Expand All @@ -237,8 +237,8 @@
.. method:: update

| :sl:`updates the circle position and radius`
| :sg:`update((x, y), radius) -> None`
| :sg:`update(x, y, radius) -> None`
| :sg:`update((x, y), radius, /) -> None`
| :sg:`update(x, y, radius, /) -> None`

The `update` method allows you to set the position and radius of a `Circle` object in
place. This method takes either a tuple of (x, y) coordinates, two separate x and
Expand Down
2 changes: 1 addition & 1 deletion docs/reST/ref/mouse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ scroll, such as ``which`` (it will tell you what exact mouse device trigger the
.. function:: set_relative_mode

| :sl:`set relative mouse mode`
| :sg:`set_relative_mode(enable) -> None`
| :sg:`set_relative_mode(enable, /) -> None`

Sets the relative mouse mode state.
While the mouse is in relative mode, the cursor is hidden,
Expand Down
12 changes: 6 additions & 6 deletions src_c/doc/geometry_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#define DOC_CIRCLE_DIAMETER "diameter -> float\ndiameter of the circle"
#define DOC_CIRCLE_AREA "area -> float\narea of the circle"
#define DOC_CIRCLE_CIRCUMFERENCE "circumference -> float\ncircumference of the circle"
#define DOC_CIRCLE_COLLIDEPOINT "collidepoint((x, y)) -> bool\ncollidepoint(x, y) -> bool\ncollidepoint(Vector2) -> bool\ntest if a point is inside the circle"
#define DOC_CIRCLE_COLLIDECIRCLE "collidecircle(Circle) -> bool\ncollidecircle(x, y, radius) -> bool\ncollidecircle((x, y), radius) -> bool\ntest if two circles collide"
#define DOC_CIRCLE_MOVE "move((x, y)) -> Circle\nmove(x, y) -> Circle\nmove(Vector2) -> Circle\nmoves the circle by a given amount"
#define DOC_CIRCLE_MOVEIP "move_ip((x, y)) -> None\nmove_ip(x, y) -> None\nmove_ip(Vector2) -> None\nmoves the circle by a given amount, in place"
#define DOC_CIRCLE_COLLIDERECT "colliderect(Rect) -> bool\ncolliderect((x, y, width, height)) -> bool\ncolliderect(x, y, width, height) -> bool\ncolliderect((x, y), (width, height)) -> bool\nchecks if a rectangle intersects the circle"
#define DOC_CIRCLE_UPDATE "update((x, y), radius) -> None\nupdate(x, y, radius) -> None\nupdates the circle position and radius"
#define DOC_CIRCLE_COLLIDEPOINT "collidepoint((x, y), /) -> bool\ncollidepoint(x, y, /) -> bool\ncollidepoint(vector2, /) -> bool\ntest if a point is inside the circle"
#define DOC_CIRCLE_COLLIDECIRCLE "collidecircle(circle, /) -> bool\ncollidecircle(x, y, radius, /) -> bool\ncollidecircle((x, y), radius, /) -> bool\ntest if two circles collide"
#define DOC_CIRCLE_MOVE "move((x, y), /) -> Circle\nmove(x, y, /) -> Circle\nmove(vector2, /) -> Circle\nmoves the circle by a given amount"
#define DOC_CIRCLE_MOVEIP "move_ip((x, y), /) -> None\nmove_ip(x, y, /) -> None\nmove_ip(vector2, /) -> None\nmoves the circle by a given amount, in place"
#define DOC_CIRCLE_COLLIDERECT "colliderect(rect, /) -> bool\ncolliderect((x, y, width, height), /) -> bool\ncolliderect(x, y, width, height, /) -> bool\ncolliderect((x, y), (width, height), /) -> bool\nchecks if a rectangle intersects the circle"
#define DOC_CIRCLE_UPDATE "update((x, y), radius, /) -> None\nupdate(x, y, radius, /) -> None\nupdates the circle position and radius"
#define DOC_CIRCLE_COPY "copy() -> Circle\nreturns a copy of the circle"
2 changes: 1 addition & 1 deletion src_c/doc/mouse_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
#define DOC_MOUSE_SETCURSOR "set_cursor(pygame.cursors.Cursor) -> None\nset_cursor(size, hotspot, xormasks, andmasks) -> None\nset_cursor(hotspot, surface) -> None\nset_cursor(constant) -> None\nset the mouse cursor to a new cursor"
#define DOC_MOUSE_GETCURSOR "get_cursor() -> pygame.cursors.Cursor\nget the current mouse cursor"
#define DOC_MOUSE_GETRELATIVEMODE "get_relative_mode() -> bool\nquery whether relative mouse mode is enabled"
#define DOC_MOUSE_SETRELATIVEMODE "set_relative_mode(enable) -> None\nset relative mouse mode"
#define DOC_MOUSE_SETRELATIVEMODE "set_relative_mode(enable, /) -> None\nset relative mouse mode"