From 2f91a086f8b85f6fc4ad6f5e6b36a540689068fb Mon Sep 17 00:00:00 2001
From: Laggy <aydencheong08@gmail.com>
Date: Fri, 29 Dec 2023 00:24:30 +0800
Subject: [PATCH] rename 'collideswith' to 'collide'

---
 benchmarks/GEOMETRY_circle_benchmark.py | 20 ++++++-------
 docs/circle.rst                         | 16 +++++-----
 docs/geometry.rst                       |  4 +--
 docs/line.rst                           | 14 ++++-----
 examples/circle_collision_game.py       |  2 +-
 geometry.pyi                            |  4 +--
 src_c/circle.c                          |  2 +-
 src_c/line.c                            |  2 +-
 test/test_circle.py                     | 34 ++++++++++-----------
 test/test_line.py                       | 40 ++++++++++++-------------
 10 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/benchmarks/GEOMETRY_circle_benchmark.py b/benchmarks/GEOMETRY_circle_benchmark.py
index 3c331f1d..4af0ebdf 100644
--- a/benchmarks/GEOMETRY_circle_benchmark.py
+++ b/benchmarks/GEOMETRY_circle_benchmark.py
@@ -263,16 +263,16 @@
 ]
 
 collideswith_tests = [
-    ("C rect", "c1.collideswith(r1)"),
-    ("NC rect", "c1.collideswith(r2)"),
-    ("C circle", "c1.collideswith(c2)"),
-    ("NC circle", "c1.collideswith(c2)"),
-    ("C point int", "c1.collideswith(p1)"),
-    ("NC point int", "c1.collideswith(p2)"),
-    ("C point float", "c1.collideswith(p3)"),
-    ("NC point float", "c1.collideswith(p4)"),
-    ("C line", "c1.collideswith(l1)"),
-    ("NC line", "c1.collideswith(l2)"),
+    ("C rect", "c1.collide(r1)"),
+    ("NC rect", "c1.collide(r2)"),
+    ("C circle", "c1.collide(c2)"),
+    ("NC circle", "c1.collide(c2)"),
+    ("C point int", "c1.collide(p1)"),
+    ("NC point int", "c1.collide(p2)"),
+    ("C point float", "c1.collide(p3)"),
+    ("NC point float", "c1.collide(p4)"),
+    ("C line", "c1.collide(l1)"),
+    ("NC line", "c1.collide(l2)"),
 ]
 
 contains_tests = [
diff --git a/docs/circle.rst b/docs/circle.rst
index d980971b..8612735f 100644
--- a/docs/circle.rst
+++ b/docs/circle.rst
@@ -266,17 +266,17 @@ Circle Methods
 
       .. ## Circle.collidepolygon ##
 
-    .. method:: collideswith
+    .. method:: collide
 
         | :sl:`test if a shape or point and the circle collide`
-        | :sg:`collideswith(Line) -> bool`
-        | :sg:`collideswith(Circle) -> bool`
-        | :sg:`collideswith(Rect) -> bool`
-        | :sg:`collideswith(Polygon) -> bool`
-        | :sg:`collideswith((x, y)) -> bool`
+        | :sg:`collide(Line) -> bool`
+        | :sg:`collide(Circle) -> bool`
+        | :sg:`collide(Rect) -> bool`
+        | :sg:`collide(Polygon) -> bool`
+        | :sg:`collide((x, y)) -> bool`
         | :sg:`contains(Vector2) -> bool`
 
-        The `collideswith` method tests whether a given shape or point collides (overlaps)
+        The `collide` method tests whether a given shape or point collides (overlaps)
         with a `Circle` object. The function takes in a single argument, which can be a
         `Line`, `Circle`, `Rect`, `Polygon`, tuple or list containing the x and y coordinates
         of a point, or a `Vector2` object. The function returns a boolean value of `True`
@@ -296,7 +296,7 @@ Circle Methods
             Collisions with a `Polygon` object are evaluated the same way the :meth:`collidepolygon`
             method does by default, meaning with only_edges set to `False`.
 
-      .. ## Circle.collideswith ##
+      .. ## Circle.collide ##
 
     .. method:: contains
 
diff --git a/docs/geometry.rst b/docs/geometry.rst
index 528f7bcb..e00f65a2 100644
--- a/docs/geometry.rst
+++ b/docs/geometry.rst
@@ -56,7 +56,7 @@ performing transformations and checking for collisions with other objects.
 
     collidepolygon: Checks if the circle collides with the given polygon.
 
-    collideswith: Checks if the circle collides with the given object.
+    collide: Checks if the circle collides with the given object.
 
     contains: Checks if the circle fully contains the given object.
 
@@ -128,7 +128,7 @@ other objects.
 
     collidepolygon: Checks if the line collides with the given polygon.
 
-    collideswith: Checks if the line collides with the given object.
+    collide: Checks if the line collides with the given object.
 
     as_circle: Returns a circle which fully encloses the line.
 
diff --git a/docs/line.rst b/docs/line.rst
index ac0f0270..e4f4113e 100644
--- a/docs/line.rst
+++ b/docs/line.rst
@@ -344,14 +344,14 @@ Line Methods
       .. ## Line.collidepolygon ##
 
 
-    .. method:: collideswith
+    .. method:: collide
 
         | :sl:`test if a shape or point and the line collide`
-        | :sg:`collideswith(Line) -> bool`
-        | :sg:`collideswith(Circle) -> bool`
-        | :sg:`collideswith(Rect) -> bool`
-        | :sg:`collideswith(Polygon) -> bool`
-        | :sg:`collideswith((x, y)) -> bool`
+        | :sg:`collide(Line) -> bool`
+        | :sg:`collide(Circle) -> bool`
+        | :sg:`collide(Rect) -> bool`
+        | :sg:`collide(Polygon) -> bool`
+        | :sg:`collide((x, y)) -> bool`
         | :sg:`contains(Vector2) -> bool`
 
         Returns `True` if any portion of the shape or point overlaps with the Line,
@@ -369,7 +369,7 @@ Line Methods
             Collisions with a `Polygon` object are evaluated the same way the :meth:`collidepolygon`
             method does by default, meaning with only_edges set to `False`.
 
-      .. ## Line.collideswith ##
+      .. ## Line.collide ##
 
 
     .. method:: as_circle
diff --git a/examples/circle_collision_game.py b/examples/circle_collision_game.py
index f3a7fe71..68e6cf2d 100644
--- a/examples/circle_collision_game.py
+++ b/examples/circle_collision_game.py
@@ -104,7 +104,7 @@ def get_new_circle_surf(
         is_circle = isinstance(shape, Circle)
         is_rect = isinstance(shape, pygame.Rect)
 
-        if feed_active and mouse_circle.collideswith(shape):
+        if feed_active and mouse_circle.collide(shape):
             if is_circle:
                 shape.r += 0.2
                 draw_circle(screen, coll_color, shape.center, shape.r, 3)
diff --git a/geometry.pyi b/geometry.pyi
index 02eca2d7..fef6d4b7 100644
--- a/geometry.pyi
+++ b/geometry.pyi
@@ -89,7 +89,7 @@ class Line(Sequence[float]):
     def update(self, a: Coordinate, b: Coordinate) -> None: ...
     @overload
     def update(self, single_arg: LineValue) -> None: ...
-    def collideswith(self, other: _CanBeCollided) -> bool: ...
+    def collide(self, other: _CanBeCollided) -> bool: ...
     @overload
     def collidepoint(self, x: float, y: float) -> bool: ...
     @overload
@@ -175,7 +175,7 @@ class Circle:
     def colliderect(self, rect: Rect) -> bool: ...
     @overload
     def colliderect(self, x: int, y: int, w: int, h: int) -> bool: ...
-    def collideswith(self, other: _CanBeCollided) -> bool: ...
+    def collide(self, other: _CanBeCollided) -> bool: ...
     def __copy__(self) -> Circle: ...
 
     copy = __copy__
diff --git a/src_c/circle.c b/src_c/circle.c
index c94a3085..0111cc01 100644
--- a/src_c/circle.c
+++ b/src_c/circle.c
@@ -504,7 +504,7 @@ static struct PyMethodDef pg_circle_methods[] = {
     {"collideline", (PyCFunction)pg_circle_collideline, METH_FASTCALL, NULL},
     {"collidepoint", (PyCFunction)pg_circle_collidepoint, METH_FASTCALL, NULL},
     {"colliderect", (PyCFunction)pg_circle_colliderect, METH_FASTCALL, NULL},
-    {"collideswith", (PyCFunction)pg_circle_collideswith, METH_O, NULL},
+    {"collide", (PyCFunction)pg_circle_collideswith, METH_O, NULL},
     {"collidepolygon", (PyCFunction)pg_circle_collidepolygon, METH_FASTCALL,
      NULL},
     {"as_rect", (PyCFunction)pg_circle_as_rect, METH_NOARGS, NULL},
diff --git a/src_c/line.c b/src_c/line.c
index bdc6d0b5..3b169bdd 100644
--- a/src_c/line.c
+++ b/src_c/line.c
@@ -755,7 +755,7 @@ static struct PyMethodDef pg_line_methods[] = {
     {"collidepoint", (PyCFunction)pg_line_collidepoint, METH_FASTCALL, NULL},
     {"collidecircle", (PyCFunction)pg_line_collidecircle, METH_FASTCALL, NULL},
     {"colliderect", (PyCFunction)pg_line_colliderect, METH_FASTCALL, NULL},
-    {"collideswith", (PyCFunction)pg_line_collideswith, METH_O, NULL},
+    {"collide", (PyCFunction)pg_line_collideswith, METH_O, NULL},
     {"collidepolygon", (PyCFunction)pg_line_collidepolygon, METH_FASTCALL,
      NULL},
     {"as_rect", (PyCFunction)pg_line_as_rect, METH_NOARGS, NULL},
diff --git a/test/test_circle.py b/test/test_circle.py
index 4d011430..8c54fa56 100644
--- a/test/test_circle.py
+++ b/test/test_circle.py
@@ -648,7 +648,7 @@ def test_colliderect(self):
         # barely colliding single
         self.assertTrue(c.colliderect(0, 4.9999999999999, 4, 4), msgt)
 
-    def test_collideswith_argtype(self):
+    def test_collide_argtype(self):
         """tests if the function correctly handles incorrect types as parameters"""
         invalid_types = (None, [], "1", (1,), Vector3(1, 1, 1), 1)
 
@@ -656,56 +656,56 @@ def test_collideswith_argtype(self):
 
         for value in invalid_types:
             with self.assertRaises(TypeError):
-                c.collideswith(value)
+                c.collide(value)
 
-    def test_collideswith_argnum(self):
+    def test_collide_argnum(self):
         c = Circle(10, 10, 4)
         args = [tuple(range(x)) for x in range(2, 4)]
 
         # no params
         with self.assertRaises(TypeError):
-            c.collideswith()
+            c.collide()
 
         # too many params
         for arg in args:
             with self.assertRaises(TypeError):
-                c.collideswith(*arg)
+                c.collide(*arg)
 
-    def test_collideswith(self):
-        """Ensures the collideswith function correctly registers collisions with circles, lines, rects and points"""
+    def test_collide(self):
+        """Ensures the collide function correctly registers collisions with circles, lines, rects and points"""
         c = Circle(0, 0, 5)
 
         # circle
         c2 = Circle(0, 10, 15)
         c3 = Circle(100, 100, 1)
-        self.assertTrue(c.collideswith(c2), E_T + "circles should collide here")
-        self.assertFalse(c.collideswith(c3), E_F + "circles should not collide here")
+        self.assertTrue(c.collide(c2), E_T + "circles should collide here")
+        self.assertFalse(c.collide(c3), E_F + "circles should not collide here")
 
         # line
         l = Line(0, 0, 10, 10)
         l2 = Line(50, 0, 50, 10)
-        self.assertTrue(c.collideswith(l), E_T + "line should collide here")
-        self.assertFalse(c.collideswith(l2), E_F + "line should not collide here")
+        self.assertTrue(c.collide(l), E_T + "line should collide here")
+        self.assertFalse(c.collide(l2), E_F + "line should not collide here")
 
         # rect
         r = Rect(0, 0, 10, 10)
         r2 = Rect(50, 0, 10, 10)
-        self.assertTrue(c.collideswith(r), E_T + "rect should collide here")
-        self.assertFalse(c.collideswith(r2), E_F + "rect should not collide here")
+        self.assertTrue(c.collide(r), E_T + "rect should collide here")
+        self.assertFalse(c.collide(r2), E_F + "rect should not collide here")
 
         # point
         p = (0, 0)
         p2 = (50, 0)
-        self.assertTrue(c.collideswith(p), E_T + "point should collide here")
-        self.assertFalse(c.collideswith(p2), E_F + "point should not collide here")
+        self.assertTrue(c.collide(p), E_T + "point should collide here")
+        self.assertFalse(c.collide(p2), E_F + "point should not collide here")
 
         # polygon
         c4 = Circle(0, 0, 15)
         po1 = Polygon([(-5, 0), (5, 0), (0, 5)])
         po2 = Polygon([(100, 150), (200, 225), (150, 200)])
 
-        self.assertTrue(c.collideswith(po1), E_T + "polygon should collide here")
-        self.assertFalse(c.collideswith(po2), E_F + "polygon should not collide here")
+        self.assertTrue(c.collide(po1), E_T + "polygon should collide here")
+        self.assertFalse(c.collide(po2), E_F + "polygon should not collide here")
 
     def test_as_rect_invalid_args(self):
         c = Circle(0, 0, 10)
diff --git a/test/test_line.py b/test/test_line.py
index 4a24562f..77ba38d7 100644
--- a/test/test_line.py
+++ b/test/test_line.py
@@ -505,7 +505,7 @@ def test_attrib_centery(self):
         with self.assertRaises(AttributeError):
             del line.centery
 
-    def test_collideswith_argtype(self):
+    def test_collide_argtype(self):
         """tests if the function correctly handles incorrect types as parameters"""
         invalid_types = (None, [], "1", (1,), Vector3(1, 1, 1), 1)
 
@@ -513,49 +513,49 @@ def test_collideswith_argtype(self):
 
         for value in invalid_types:
             with self.assertRaises(TypeError):
-                l.collideswith(value)
+                l.collide(value)
 
-    def test_collideswith_argnum(self):
+    def test_collide_argnum(self):
         l = Line(10, 10, 4, 4)
         args = [tuple(range(x)) for x in range(2, 4)]
 
         # no params
         with self.assertRaises(TypeError):
-            l.collideswith()
+            l.collide()
 
         # too many params
         for arg in args:
             with self.assertRaises(TypeError):
-                l.collideswith(*arg)
+                l.collide(*arg)
 
-    def test_collideswith(self):
-        """Ensures the collideswith function correctly registers collisions with circles, lines, rects and points"""
+    def test_collide(self):
+        """Ensures the collide function correctly registers collisions with circles, lines, rects and points"""
         l = Line(10, 10, 200, 200)
 
         # line
         l2 = Line(400, 300, 10, 100)
         l3 = Line(400, 300, 10, 200)
 
-        self.assertTrue(l.collideswith(l2), E_T + "lines should collide here")
-        self.assertFalse(l.collideswith(l3), E_F + "lines should not collide here")
+        self.assertTrue(l.collide(l2), E_T + "lines should collide here")
+        self.assertFalse(l.collide(l3), E_F + "lines should not collide here")
 
         # circle
         c = Circle(10, 10, 10)
         c2 = Circle(50, 10, 10)
-        self.assertTrue(l.collideswith(c), E_T + "circle should collide here")
-        self.assertFalse(l.collideswith(c2), E_F + "circle should not collide here")
+        self.assertTrue(l.collide(c), E_T + "circle should collide here")
+        self.assertFalse(l.collide(c2), E_F + "circle should not collide here")
 
         # rect
         r = Rect(10, 10, 10, 10)
         r2 = Rect(50, 10, 10, 10)
-        self.assertTrue(l.collideswith(r), E_T + "rect should collide here")
-        self.assertFalse(l.collideswith(r2), E_F + "rect should not collide here")
+        self.assertTrue(l.collide(r), E_T + "rect should collide here")
+        self.assertFalse(l.collide(r2), E_F + "rect should not collide here")
 
         # point
         p = (11, 11)
         p2 = (60, 80)
-        self.assertTrue(c.collideswith(p), E_T + "point should collide here")
-        self.assertFalse(c.collideswith(p2), E_F + "point should not collide here")
+        self.assertTrue(c.collide(p), E_T + "point should collide here")
+        self.assertFalse(c.collide(p2), E_F + "point should not collide here")
 
         # polygon
         l4 = Line(0, 0, 10, 10)
@@ -565,11 +565,11 @@ def test_collideswith(self):
         po4 = Polygon((5, 5), (5, 10), (0, 10), (2.5, 2.5))
         po5 = Polygon((0, 0), (0, 10), (-5, 10), (-5, 0))
 
-        self.assertTrue(l4.collideswith(po1))
-        self.assertFalse(l4.collideswith(po2))
-        self.assertTrue(l4.collideswith(po3))
-        self.assertTrue(l4.collideswith(po4))
-        self.assertTrue(l4.collideswith(po5))
+        self.assertTrue(l4.collide(po1))
+        self.assertFalse(l4.collide(po2))
+        self.assertTrue(l4.collide(po3))
+        self.assertTrue(l4.collide(po4))
+        self.assertTrue(l4.collide(po5))
 
     def test_meth_copy(self):
         line = Line(1, 2, 3, 4)