Skip to content

Commit 8e27ae8

Browse files
authored
Judicious pylint statements
1 parent 8c7957b commit 8e27ae8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Metro/Metro_RP2350_Breakout/code.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
try:
3434
piezo = pwmio.PWMOut(board.D23, frequency=440, duty_cycle=0,
3535
variable_frequency=True)
36-
except Exception as e:
36+
except Exception as e: # pylint: disable=broad-except
3737
print("Piezo initialization error:", e)
3838
piezo = None
3939

@@ -171,17 +171,18 @@ def check_keys():
171171
any_key = True
172172
try:
173173
key = sys.stdin.read(1)
174-
if key in ('a', 'A'): # Left movement
174+
if key in ('a', 'A'): # Left movement
175175
l_pressed = True
176176
elif key in ('d', 'D'): # Right movement
177177
r_pressed = True
178-
elif key == ' ': # Space for start/launch
178+
elif key == ' ': # Space for start/launch
179179
s_pressed = True
180-
except Exception as e:
180+
except Exception as e: # pylint: disable=broad-except
181181
print("Input error:", e)
182182

183183
return (l_pressed, r_pressed, s_pressed, any_key)
184184

185+
# pylint: disable=redefined-outer-name
185186
def create_game_elements():
186187
"""Create and return all game display elements"""
187188
game_group = displayio.Group()
@@ -288,7 +289,7 @@ def create_game_elements():
288289

289290
def reset_ball():
290291
"""Reset the ball position and set it initially stationary"""
291-
global ball_dx, ball_dy, ball_pos_x, ball_pos_y
292+
global ball_dx, ball_dy, ball_pos_x, ball_pos_y # pylint: disable=global-statement
292293
ball_pos_x = float(display.width // 2)
293294
ball_pos_y = float(display.height - PADDLE_HEIGHT - DISPLAY_LINE - BALL_RADIUS * 3)
294295
ball.x = int(ball_pos_x)
@@ -298,7 +299,7 @@ def reset_ball():
298299

299300
def launch_ball():
300301
"""Launch the ball in a random upward direction"""
301-
global ball_dx, ball_dy, ball_speed
302+
global ball_dx, ball_dy, ball_speed # pylint: disable=global-statement
302303
ball_speed = BALL_SPEED_INITIAL
303304
angle = random.uniform(0.5, 0.8) # Launch at angle between 45-65 degrees
304305
ball_dx = ball_speed * random.choice([-angle, angle])

0 commit comments

Comments
 (0)