Skip to content

Commit f03cfc7

Browse files
committed
merge main, handle PR feedback
1 parent 53d222e commit f03cfc7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

adafruit_turtle.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __mul__(self, other: Union[float, Vec2D]) -> Union[float, Vec2D]:
113113
return self[0] * other[0] + self[1] * other[1]
114114
return Vec2D(self[0] * other, self[1] * other)
115115

116-
def __rmul__(self, other: Union[float, int]) -> Vec2D:
116+
def __rmul__(self, other: float) -> Optional[Vec2D]:
117117
if isinstance(other, (float, int)):
118118
return Vec2D(self[0] * other, self[1] * other)
119119
return None
@@ -176,7 +176,7 @@ def __init__(self, display: Any = None, scale: float = 1) -> None:
176176
self._angleOffset: float = 0
177177
self._bg_color = 0
178178

179-
self._splash: Any = displayio.Group()
179+
self._splash: displayio.Group = displayio.Group()
180180
self._bgscale: int = 1
181181
if self._w == self._h:
182182
i = 1
@@ -243,14 +243,14 @@ def __init__(self, display: Any = None, scale: float = 1) -> None:
243243
self.pencolor(Color.WHITE)
244244
self._bg_pic = None
245245
self._bg_pic_filename = ""
246-
self._turtle_pic: Any = None
247-
self._turtle_odb: Any = None
248-
self._turtle_alt_sprite: Any = None
246+
self._turtle_pic = None
247+
self._turtle_odb = None
248+
self._turtle_alt_sprite = None
249249
self._drawturtle()
250-
self._stamps: Dict[int, Any] = {}
250+
self._stamps = {}
251251
self._turtle_odb_use = 0
252-
self._turtle_odb_file: Optional[str] = None
253-
self._odb_tilegrid: Any = None
252+
self._turtle_odb_file = None
253+
self._odb_tilegrid = None
254254
gc.collect()
255255
self._display.show(self._splash)
256256

@@ -752,12 +752,12 @@ def towards(
752752
:param y: a number if x is a number, else None
753753
754754
"""
755-
yn: float = x1[1] if y1 is None else y1 # type: ignore
756-
xn: float = x1[0] if y1 is None else x1 # type: ignore
757-
p = self.pos()
758-
x0, y0 = (p[0], p[1])
755+
if y1 is None:
756+
y1 = x1[1]
757+
x1 = x1[0]
758+
x0, y0 = self.pos()
759759

760-
result = math.degrees(math.atan2(xn - x0, yn - y0))
760+
result = math.degrees(math.atan2(x1 - x0, y1 - y0))
761761
result /= self._degreesPerAU
762762
return (self._angleOffset + self._angleOrient * result) % self._fullcircle
763763

@@ -1056,7 +1056,7 @@ def isvisible(self) -> bool:
10561056

10571057
# pylint:disable=too-many-statements, too-many-branches
10581058
def changeturtle(
1059-
self, source: Any = None, dimensions: Tuple[int, int] = (12, 12)
1059+
self, source: Optional[Union[displayio.TileGrid, str]] = None, dimensions: Tuple[int, int] = (12, 12)
10601060
) -> None:
10611061
"""
10621062
Change the turtle.

0 commit comments

Comments
 (0)