Skip to content

Commit 3aaa39f

Browse files
authored
Merge pull request #211 from pygame-community/rename_line_flip
renamed line_flip to flip_ab
2 parents ae97262 + ca997eb commit 3aaa39f

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

docs/geometry.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ other objects.
110110

111111
scale_ip: Scales the line by the given amount in place.
112112

113-
flip: Switches the endpoints of the line.
113+
flip_ab: Switches the endpoints of the line.
114114

115-
flip_ip: Switches the endpoints of the line in place.
115+
flip_ab_ip: Switches the endpoints of the line in place.
116116

117117
update: Updates the line's attributes.
118118

docs/line.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,25 +237,25 @@ Line Methods
237237

238238
.. ## Line.scale_ip ##
239239
240-
.. method:: flip
240+
.. method:: flip_ab
241241

242242
| :sl:`flips the line a and b points`
243-
| :sg:`flip() -> Line`
243+
| :sg:`flip_ab() -> Line`
244244
245245
Returns a new `Line` that has the `a` and `b` points flipped.
246246
The original `Line` is not modified.
247247

248-
.. ## Line.flip ##
248+
.. ## Line.flip_ab ##
249249
250-
.. method:: flip_ip
250+
.. method:: flip_ab_ip
251251

252252
| :sl:`flips the line a and b points, in place`
253-
| :sg:`flip_ip() -> None`
253+
| :sg:`flip_ab_ip() -> None`
254254
255255
Flips the `Line`'s `b` and `b` points. The original `Line` is modified.
256256
Always returns None.
257257

258-
.. ## Line.flip_ip ##
258+
.. ## Line.flip_ab_ip ##
259259
260260
.. method:: is_parallel
261261

geometry.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ class Line(Sequence[float]):
131131
def scale(self, factor_and_origin: Sequence[float, float]) -> Line: ...
132132
@overload
133133
def scale_ip(self, factor_and_origin: Sequence[float, float]) -> None: ...
134-
def flip(self) -> Line: ...
135-
def flip_ip(self) -> None: ...
134+
def flip_ab(self) -> Line: ...
135+
def flip_ab_ip(self) -> None: ...
136136
def is_parallel(self, line: LineValue) -> bool: ...
137137
def is_perpendicular(self, line: LineValue) -> bool: ...
138138
def as_points(self, n_points: int) -> List[Tuple[float, float]]: ...

src_c/line.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ pg_line_flip(pgLineObject *self, PyObject *_null)
479479
}
480480

481481
static PyObject *
482-
pg_line_flip_ip(pgLineObject *self, PyObject *_null)
482+
pg_line_flip_ab_ip(pgLineObject *self, PyObject *_null)
483483
{
484484
double tx = self->line.x2;
485485
double ty = self->line.y2;
@@ -754,8 +754,8 @@ static struct PyMethodDef pg_line_methods[] = {
754754
{"move", (PyCFunction)pg_line_move, METH_FASTCALL, NULL},
755755
{"move_ip", (PyCFunction)pg_line_move_ip, METH_FASTCALL, NULL},
756756
{"at", (PyCFunction)pg_line_at, METH_O, NULL},
757-
{"flip", (PyCFunction)pg_line_flip, METH_NOARGS, NULL},
758-
{"flip_ip", (PyCFunction)pg_line_flip_ip, METH_NOARGS, NULL},
757+
{"flip_ab", (PyCFunction)pg_line_flip, METH_NOARGS, NULL},
758+
{"flip_ab_ip", (PyCFunction)pg_line_flip_ab_ip, METH_NOARGS, NULL},
759759
{"as_points", (PyCFunction)pg_line_as_points, METH_O, NULL},
760760
{"as_segments", (PyCFunction)pg_line_as_segments, METH_O, NULL},
761761
{"scale", (PyCFunction)pg_line_scale, METH_FASTCALL, NULL},

test/test_line.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ def test_meth_scale_ip(self):
725725
def test_meth_flip(self):
726726
line = Line(1.1, 2.2, 3.3, 4.4)
727727

728-
ret = line.flip()
728+
ret = line.flip_ab()
729729

730730
self.assertIsInstance(ret, Line)
731731
self.assertEqual(ret.x1, 3.3)
@@ -734,20 +734,20 @@ def test_meth_flip(self):
734734
self.assertEqual(ret.y2, 2.2)
735735

736736
with self.assertRaises(TypeError):
737-
line.flip(1)
737+
line.flip_ab(1)
738738

739-
def test_meth_flip_ip(self):
739+
def test_meth_flip_ab_ip(self):
740740
line = Line(1.1, 2.2, 3.3, 4.4)
741741

742-
line.flip_ip()
742+
line.flip_ab_ip()
743743

744744
self.assertEqual(line.x1, 3.3)
745745
self.assertEqual(line.y1, 4.4)
746746
self.assertEqual(line.x2, 1.1)
747747
self.assertEqual(line.y2, 2.2)
748748

749749
with self.assertRaises(TypeError):
750-
line.flip_ip(1)
750+
line.flip_ab_ip(1)
751751

752752
def test_meth_collidepoint(self):
753753
A = Line(0, 0, 1, 1)

0 commit comments

Comments
 (0)