|
32 | 32 | import time |
33 | 33 | import displayio |
34 | 34 |
|
35 | | -try: |
36 | | - import board |
37 | | -except NotImplementedError: |
38 | | - print("[adafruit-turtle.py]: Couldn't import board module.") |
39 | | - |
40 | 35 | __version__ = "0.0.0+auto.0" |
41 | 36 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_turtle.git" |
42 | 37 |
|
@@ -98,11 +93,11 @@ class Vec2D: |
98 | 93 | # k*a and a*k multiplication with scalar |
99 | 94 | # |a| absolute value of a |
100 | 95 | # a.rotate(angle) rotation |
101 | | - def __new__(cls, x, y): |
102 | | - return (x, y) |
| 96 | + def __init__(self, x, y): |
| 97 | + self.values = (x, y) |
103 | 98 |
|
104 | 99 | def __getitem__(self, index): |
105 | | - return getattr(self, index) |
| 100 | + return self.values[index] |
106 | 101 |
|
107 | 102 | def __add__(self, other): |
108 | 103 | return Vec2D(self[0] + other[0], self[1] + other[1]) |
@@ -154,6 +149,9 @@ def __init__(self, display=None, scale=1): |
154 | 149 | self._display = display |
155 | 150 | else: |
156 | 151 | try: |
| 152 | + # pylint: disable=import-outside-toplevel |
| 153 | + import board |
| 154 | + |
157 | 155 | self._display = board.DISPLAY |
158 | 156 | except AttributeError as err: |
159 | 157 | raise RuntimeError( |
@@ -404,6 +402,7 @@ def goto(self, x1, y1=None): |
404 | 402 |
|
405 | 403 | setpos = goto |
406 | 404 | setposition = goto |
| 405 | + |
407 | 406 | # pylint:enable=too-many-branches,too-many-statements |
408 | 407 |
|
409 | 408 | def setx(self, x): |
|
0 commit comments