Skip to content

Commit f57629a

Browse files
committed
pylint fixes, remove unused imports
1 parent edfec3d commit f57629a

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

Metro/Metro_RP2350_FlappyNyanCat/code.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import random
1414
import sys
1515
import terminalio
16-
from displayio import Group, TileGrid, Bitmap, release_displays, Palette
16+
from displayio import Group, TileGrid, Bitmap, Palette
1717
import supervisor
1818
import bitmaptools
1919
from adafruit_display_text.bitmap_label import Label
@@ -591,7 +591,8 @@ def shift_post(post):
591591

592592
# if player pressed p
593593
if "p" in cur_btn_val:
594-
supervisor.set_next_code_file(__file__, working_directory=Path(__file__).parent.absolute())
594+
supervisor.set_next_code_file(__file__,
595+
working_directory=Path(__file__).parent.absolute())
595596
supervisor.reload()
596597

597598
# if player pressed q

Metro/Metro_RP2350_Memory/memory_game/code.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def update_score_text():
4444
Update the score text on the display for each player
4545
"""
4646
for _ in range(2):
47-
out_str = f"p{_+1} score: {player_scores[_]}"
47+
out_str = f"p{_ + 1} score: {player_scores[_]}"
4848
score_lbls[_].text = out_str
4949

5050

@@ -62,7 +62,7 @@ def update_score_text():
6262
# initial state is title screen
6363
CUR_STATE = STATE_TITLE
6464

65-
request_display_config(320,240)
65+
request_display_config(320, 240)
6666
display = supervisor.runtime.display
6767

6868
# main group will hold all the visual elements
@@ -304,13 +304,15 @@ def update_score_text():
304304
device, 0
305305
)
306306

307-
_possible_interface_index, _possible_endpoint_address = adafruit_usb_host_descriptors.find_boot_mouse_endpoint(
308-
device)
307+
_possible_interface_index, _possible_endpoint_address = (
308+
adafruit_usb_host_descriptors.find_boot_mouse_endpoint(device))
309+
309310
if _possible_interface_index is not None and _possible_endpoint_address is not None:
310311
mouse = device
311312
mouse_interface_index = _possible_interface_index
312313
mouse_endpoint_address = _possible_endpoint_address
313-
print(f"mouse interface: {mouse_interface_index} endpoint_address: {hex(mouse_endpoint_address)}")
314+
print(f"mouse interface: {mouse_interface_index}", end="")
315+
print(f"endpoint_address: {hex(mouse_endpoint_address)}")
314316

315317
mouse_was_attached = None
316318
if mouse is not None:
@@ -324,6 +326,7 @@ def update_score_text():
324326
# set configuration on the mouse so we can use it
325327
mouse.set_configuration()
326328

329+
327330
def atexit_callback():
328331
"""
329332
re-attach USB devices to kernel if needed.
@@ -333,6 +336,7 @@ def atexit_callback():
333336
if mouse_was_attached and not mouse.is_kernel_driver_active(0):
334337
mouse.attach_kernel_driver(0)
335338

339+
336340
atexit.register(atexit_callback)
337341

338342
# Buffer to hold data read from the mouse
@@ -396,8 +400,8 @@ def atexit_callback():
396400

397401
# if both cards were the same i.e. they found a match
398402
if (
399-
card_tgs[cards_flipped_this_turn[0]][0]
400-
== card_tgs[cards_flipped_this_turn[1]][0]
403+
card_tgs[cards_flipped_this_turn[0]][0]
404+
== card_tgs[cards_flipped_this_turn[1]][0]
401405
):
402406

403407
# set the cards tile index to show a blank spot instead of a card
@@ -414,8 +418,8 @@ def atexit_callback():
414418
# of cards then the code knows the game is over because each pair is worth 1
415419
# point
416420
if (
417-
player_scores[0] + player_scores[1]
418-
>= (grid_size[0] * grid_size[1]) // 2
421+
player_scores[0] + player_scores[1]
422+
>= (grid_size[0] * grid_size[1]) // 2
419423
):
420424

421425
# if the player's scores are equal
@@ -498,7 +502,8 @@ def atexit_callback():
498502
# button bounding box
499503
if play_again_btn.contains(coords):
500504
# set next code file to this one
501-
supervisor.set_next_code_file(__file__, working_directory=Path(__file__).parent.absolute())
505+
supervisor.set_next_code_file(__file__,
506+
working_directory=Path(__file__).parent.absolute())
502507
# reload
503508
supervisor.reload()
504509

Metro/Metro_RP2350_Snake/code.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import sys
44
import time
55
from micropython import const
6-
import board
7-
import picodvi
8-
import framebufferio
96
import supervisor
107
import displayio
118
import terminalio

0 commit comments

Comments
 (0)