Skip to content

Commit afd1288

Browse files
committed
pylint fixes
1 parent 6755083 commit afd1288

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

ESP-NOW_Juggling/esp-now-midi-ball.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def get_battery_voltage():
6060
lis3dh.set_tap(1, 90)
6161
has_accelerometer = True
6262
print("LIS3DH accelerometer initialized with tap detection")
63-
except Exception as e:
63+
except Exception as e: # pylint:disable=broad-except
6464
print(f"Accelerometer init failed: {e}")
6565
has_accelerometer = False
6666

@@ -123,8 +123,8 @@ def check_tap():
123123
return False
124124
try:
125125
return lis3dh.tapped
126-
except Exception as e:
127-
print(f"Accelerometer read error: {e}")
126+
except Exception as er: # pylint:disable=broad-except
127+
print(f"Accelerometer read error: {er}")
128128
return False
129129

130130

@@ -138,8 +138,8 @@ def send_trigger_message(trigger_type="tap"):
138138
# print(f"TX: {message}")
139139
flash()
140140
return True
141-
except Exception as ex:
142-
print(f"Send error: {ex}")
141+
except Exception as exc: # pylint:disable=broad-except
142+
print(f"Send error: {exc}")
143143
return False
144144

145145

@@ -155,8 +155,8 @@ def send_battery_report():
155155
e.send(message, broadcast_peer)
156156
print(f"TX Battery: {message} ({voltage:.2f}V, color: {CURRENT_COLOR:06X})")
157157
return True
158-
except Exception as ex:
159-
print(f"Battery report send error: {ex}")
158+
except Exception as exb: # pylint:disable=broad-except
159+
print(f"Battery report send error: {exb}")
160160
return False
161161

162162

@@ -179,7 +179,7 @@ def send_battery_report():
179179
if tap_state:
180180
print(f"Cleared startup tap {i + 1}")
181181
time.sleep(0.1)
182-
except Exception:
182+
except Exception: # pylint:disable=broad-except
183183
pass
184184
print("Accelerometer ready for tap detection")
185185

ESP-NOW_Juggling/esp-now-midi-bridge.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def parse_trigger_message(message_str):
119119
trigger_type = parts[2] # pylint:disable=redefined-outer-name
120120
timestamp = parts[3] # pylint:disable=redefined-outer-name
121121
return device_id, trigger_type, timestamp
122-
except Exception:
122+
except Exception: # pylint:disable=broad-except
123123
pass
124124

125125
return None, None, None
@@ -137,7 +137,7 @@ def parse_battery_message(message_str):
137137
voltage = parts[2] # pylint:disable=redefined-outer-name
138138
color_hex = int(parts[3], 16) # pylint:disable=redefined-outer-name
139139
return device_id, voltage, color_hex
140-
except Exception:
140+
except Exception: # pylint:disable=broad-except
141141
pass
142142

143143
return None, None, None
@@ -163,8 +163,8 @@ def send_midi_note(device_id, velocity=100, duration=0.05): # pylint:disable=re
163163
midi.send(NoteOn(note, velocity))
164164
time.sleep(duration)
165165
midi.send(NoteOff(note, 0))
166-
except Exception as e: # pylint:disable=redefined-outer-name
167-
print(f"MIDI error: {e}")
166+
except Exception as err: # pylint:disable=broad-except
167+
print(f"MIDI error: {err}")
168168

169169

170170
def send_color_command(device_id): # pylint:disable=redefined-outer-name
@@ -181,7 +181,7 @@ def send_color_command(device_id): # pylint:disable=redefined-outer-name
181181
print(f"{device_id} color now: {ball_colors[device_id]:06X}")
182182

183183
return True
184-
except Exception as ex:
184+
except Exception as ex: # pylint:disable=broad-except
185185
print(f"Color send error: {ex}")
186186
return False
187187

0 commit comments

Comments
 (0)