Skip to content

Commit 7bd58e6

Browse files
committed
More pylint related work
1 parent be3864b commit 7bd58e6

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

adafruit_pyoa.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
https://github.com/adafruit/circuitpython/releases
4242
"""
4343

44-
#pylint: disable=too-many-instance-attributes,no-self-use
44+
#pylint: disable=too-many-instance-attributes,no-self-use,line-too-long
4545

4646
# imports
4747
import time
@@ -59,6 +59,8 @@
5959
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PYOA.git"
6060

6161
class PYOA_Graphics():
62+
"""A choose your own adventure game framework."""
63+
6264
def __init__(self):
6365
self.root_group = displayio.Group(max_size=15)
6466

@@ -101,7 +103,8 @@ def __init__(self):
101103

102104
self.touchscreen = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
103105
board.TOUCH_YD, board.TOUCH_YU,
104-
calibration=((5200, 59000), (5800, 57000)),
106+
calibration=((5200, 59000),
107+
(5800, 57000)),
105108
size=(320, 240))
106109
self._gamedirectory = None
107110
self._gamefilename = None
@@ -131,7 +134,7 @@ def _fade_to_black(self):
131134
# turn off background so we can render the text
132135
self.set_background(None, with_fade=False)
133136
self.set_text(None, None)
134-
for i in range(len(self._button_group)):
137+
for _ in range(len(self._button_group)):
135138
self._button_group.pop()
136139

137140
def _display_buttons(self, card):
@@ -251,7 +254,7 @@ def display_card(self, card_num):
251254
if page_struct.get('page_id', None) == destination_page_id:
252255
return page_number # found the matching card!
253256
# eep if we got here something went wrong
254-
raise RuntimeError("Could not find card with matching 'page_id': ", goto_page)
257+
raise RuntimeError("Could not find card with matching 'page_id': ", destination_page_id)
255258

256259
def play_sound(self, filename, *, wait_to_finish=True, loop=False):
257260
"""Play a sound
@@ -289,6 +292,12 @@ def play_sound(self, filename, *, wait_to_finish=True, loop=False):
289292
self._speaker_enable.value = False
290293

291294
def set_text(self, text, color):
295+
"""Display the test for a card.
296+
297+
:param text: the text to display
298+
:param color: the text color
299+
300+
"""
292301
if self._text_group:
293302
self._text_group.pop()
294303
if not text or not color:

examples/pyoa_simpletest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
#pylint disable=wrong-import-position
2+
13
import sys
24
sys.path.append('/Adafruit_CircuitPython_PYOA')
35

6+
import board
7+
import digitalio
48
import adafruit_sdcard
59
import storage
610
from adafruit_pyoa import PYOA_Graphics
7-
import board
8-
import digitalio
911

1012
try:
1113
sdcard = adafruit_sdcard.SDCard(board.SPI(), digitalio.DigitalInOut(board.SD_CS))

0 commit comments

Comments
 (0)