From 62fe73e22b9989b4517ed5fd7ebd21a32bbd4f59 Mon Sep 17 00:00:00 2001 From: chris-greening Date: Mon, 10 Apr 2023 18:04:56 -0400 Subject: [PATCH 1/3] MODIFY: renamed transform to translate --- spyrograph/core/_trochoid.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spyrograph/core/_trochoid.py b/spyrograph/core/_trochoid.py index 7ddfdbc..402d7bd 100644 --- a/spyrograph/core/_trochoid.py +++ b/spyrograph/core/_trochoid.py @@ -90,7 +90,7 @@ def __init__( self.coords = list(zip(self.x, self.y, self.thetas)) - def transform(self, x: Number = 0, y: Number = 0) -> "_Trochoid": + def translate(self, x: Number = 0, y: Number = 0) -> "_Trochoid": """ Return a new shape translated by the given x and y offsets. @@ -113,7 +113,7 @@ def transform(self, x: Number = 0, y: Number = 0) -> "_Trochoid": """ # pylint: disable=no-value-for-parameter try: - transformed_shape = self.__class__( + translated_shape = self.__class__( R=self.R, r=self.r, d=self.d, @@ -121,13 +121,13 @@ def transform(self, x: Number = 0, y: Number = 0) -> "_Trochoid": origin=(self.origin[0]+x, self.origin[1]+y) ) except TypeError: - transformed_shape = self.__class__( + translated_shape = self.__class__( R=self.R, r=self.r, thetas=self.thetas, origin=(self.origin[0]+x, self.origin[1]+y) ) - return transformed_shape + return translated_shape def scale(self, factor: Number) -> Union["_Trochoid", "_Cycloid"]: """Return shape with input parameters scaled by a given input factor. From e6d39fa3bb60ff3524954e4dc4bde2c121579d85 Mon Sep 17 00:00:00 2001 From: chris-greening Date: Mon, 10 Apr 2023 18:05:57 -0400 Subject: [PATCH 2/3] MODIFY: modified test suite to reflect transform to translate name change --- tests/_trochoid.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/_trochoid.py b/tests/_trochoid.py index 1b43da8..eac80b0 100644 --- a/tests/_trochoid.py +++ b/tests/_trochoid.py @@ -45,28 +45,28 @@ def test_dunder_repr_doesnt_break_on_repr_call(self, instance): repr_val = repr(instance) assert isinstance(repr_val, str) - def test_transform_float_offset(self, instance): - up_and_left_transform_instance = instance.transform(x=100.33, y=-100.69) - assert instance.origin[0] + 100.33 == up_and_left_transform_instance.origin[0] - assert instance.origin[1] - 100.69 == up_and_left_transform_instance.origin[1] + def test_translate_float_offset(self, instance): + up_and_left_translate_instance = instance.translate(x=100.33, y=-100.69) + assert instance.origin[0] + 100.33 == up_and_left_translate_instance.origin[0] + assert instance.origin[1] - 100.69 == up_and_left_translate_instance.origin[1] - def test_transform_zero_offset(self, instance): - zero_transformed_instance = instance.transform(x=0, y=0) - assert instance.origin[0] == zero_transformed_instance.origin[0] - assert instance.origin[1] == zero_transformed_instance.origin[1] + def test_translate_zero_offset(self, instance): + zero_translateed_instance = instance.translate(x=0, y=0) + assert instance.origin[0] == zero_translateed_instance.origin[0] + assert instance.origin[1] == zero_translateed_instance.origin[1] - def test_transform_shape_x_direction(self, instance): - left_transformed_instance = instance.transform(x=-100) - assert instance.origin[0] - 100 == left_transformed_instance.origin[0] + def test_translate_shape_x_direction(self, instance): + left_translateed_instance = instance.translate(x=-100) + assert instance.origin[0] - 100 == left_translateed_instance.origin[0] - def test_transform_shape_y_direction(self, instance): - up_transformed_instance = instance.transform(y=100) - assert instance.origin[1] + 100 == up_transformed_instance.origin[1] + def test_translate_shape_y_direction(self, instance): + up_translateed_instance = instance.translate(y=100) + assert instance.origin[1] + 100 == up_translateed_instance.origin[1] - def test_transform_shape_x_and_y_same_transform_call(self, instance): - up_and_left_transform_instance = instance.transform(x=100, y=-100) - assert instance.origin[0] + 100 == up_and_left_transform_instance.origin[0] - assert instance.origin[1] - 100 == up_and_left_transform_instance.origin[1] + def test_translate_shape_x_and_y_same_translate_call(self, instance): + up_and_left_translate_instance = instance.translate(x=100, y=-100) + assert instance.origin[0] + 100 == up_and_left_translate_instance.origin[0] + assert instance.origin[1] - 100 == up_and_left_translate_instance.origin[1] def test_dunder_repr_values(self, instance): repr_val = repr(instance) From abc49961e2e76635a56b30c7191b4b9f08d615e8 Mon Sep 17 00:00:00 2001 From: chris-greening Date: Mon, 10 Apr 2023 18:07:05 -0400 Subject: [PATCH 3/3] MODIFY: modified minor patch version number to 0.26.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b3b77f4..2f9a5ad 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setuptools.setup( name="spyrograph", - version="0.25.3", + version="0.26.0", author="Chris Greening", author_email="chris@christophergreening.com", description="Library for drawing spirographs in Python",