@@ -113,7 +113,7 @@ def __mul__(self, other: Union[float, Vec2D]) -> Union[float, Vec2D]:
113
113
return self [0 ] * other [0 ] + self [1 ] * other [1 ]
114
114
return Vec2D (self [0 ] * other , self [1 ] * other )
115
115
116
- def __rmul__ (self , other : Union [ float , int ] ) -> Vec2D :
116
+ def __rmul__ (self , other : float ) -> Optional [ Vec2D ] :
117
117
if isinstance (other , (float , int )):
118
118
return Vec2D (self [0 ] * other , self [1 ] * other )
119
119
return None
@@ -176,7 +176,7 @@ def __init__(self, display: Any = None, scale: float = 1) -> None:
176
176
self ._angleOffset : float = 0
177
177
self ._bg_color = 0
178
178
179
- self ._splash : Any = displayio .Group ()
179
+ self ._splash : displayio . Group = displayio .Group ()
180
180
self ._bgscale : int = 1
181
181
if self ._w == self ._h :
182
182
i = 1
@@ -243,14 +243,14 @@ def __init__(self, display: Any = None, scale: float = 1) -> None:
243
243
self .pencolor (Color .WHITE )
244
244
self ._bg_pic = None
245
245
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
249
249
self ._drawturtle ()
250
- self ._stamps : Dict [ int , Any ] = {}
250
+ self ._stamps = {}
251
251
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
254
254
gc .collect ()
255
255
self ._display .show (self ._splash )
256
256
@@ -752,12 +752,12 @@ def towards(
752
752
:param y: a number if x is a number, else None
753
753
754
754
"""
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 ( )
759
759
760
- result = math .degrees (math .atan2 (xn - x0 , yn - y0 ))
760
+ result = math .degrees (math .atan2 (x1 - x0 , y1 - y0 ))
761
761
result /= self ._degreesPerAU
762
762
return (self ._angleOffset + self ._angleOrient * result ) % self ._fullcircle
763
763
@@ -1056,7 +1056,7 @@ def isvisible(self) -> bool:
1056
1056
1057
1057
# pylint:disable=too-many-statements, too-many-branches
1058
1058
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 )
1060
1060
) -> None :
1061
1061
"""
1062
1062
Change the turtle.
0 commit comments