Skip to content

Commit 6d825bf

Browse files
committed
black and pylint
1 parent a47aec7 commit 6d825bf

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

adafruit_slideshow.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@
4343
import time
4444
import os
4545
import random
46-
import displayio
4746
import json
47+
import displayio
48+
49+
4850
try:
4951
from adafruit_display_text import bitmap_label
5052
import terminalio
53+
5154
TEXT_SLIDES_ENABLED = True
5255
except ImportError:
5356
TEXT_SLIDES_ENABLED = False
@@ -199,14 +202,15 @@ def __init__(
199202
):
200203
def _check_json_file(file):
201204
if TEXT_SLIDES_ENABLED:
202-
with open(file) as f:
205+
with open(file) as _file_obj:
203206
try:
204-
json_data = json.loads(f.read())
207+
json_data = json.loads(_file_obj.read())
205208
if "text" in json_data:
206209
return True
207210
except ValueError:
208211
return False
209212
return False
213+
210214
self.loop = loop
211215
"""Specifies whether to loop through the slides continuously or play through the list once.
212216
``True`` will continue to loop, ``False`` will play only once."""
@@ -231,7 +235,10 @@ def _check_json_file(file):
231235
self._file_list = [
232236
folder + "/" + f
233237
for f in os.listdir(folder)
234-
if ((f.endswith(".bmp") or _check_json_file(folder + "/" + f)) and not f.startswith("."))
238+
if (
239+
(f.endswith(".bmp") or _check_json_file(folder + "/" + f))
240+
and not f.startswith(".")
241+
)
235242
]
236243

237244
self._order = None
@@ -336,7 +343,9 @@ def _create_label(self, file):
336343
if "scale" in json_data:
337344
_scale = int(json_data["scale"])
338345

339-
label = bitmap_label.Label(terminalio.FONT, text=json_data['text'], scale=_scale)
346+
label = bitmap_label.Label(
347+
terminalio.FONT, text=json_data["text"], scale=_scale
348+
)
340349
if "h_align" not in json_data or json_data["h_align"] == "LEFT":
341350
x_anchor_point = 0.0
342351
x_anchored_position = 0
@@ -375,15 +384,14 @@ def _create_label(self, file):
375384
label.anchored_position = (x_anchored_position, y_anchored_position)
376385
return label
377386

378-
379387
def update(self):
380388
"""Updates the slideshow to the next image."""
381389
now = time.monotonic()
382390
if not self.auto_advance or now - self._img_start < self.dwell:
383391
return True
384392
return self.advance()
385393

386-
# pylint: disable=too-many-branches
394+
# pylint: disable=too-many-branches, too-many-statements
387395
def advance(self):
388396
"""Displays the next image. Returns True when a new image was displayed, False otherwise."""
389397
if self._slide_file:
@@ -441,7 +449,9 @@ def advance(self):
441449
else:
442450
self._group.y = 0
443451

444-
image_tilegrid = displayio.TileGrid(odb, pixel_shader=displayio.ColorConverter())
452+
image_tilegrid = displayio.TileGrid(
453+
odb, pixel_shader=displayio.ColorConverter()
454+
)
445455

446456
self._group.append(image_tilegrid)
447457
if lbl:

0 commit comments

Comments
 (0)