Skip to content

Commit 4438c08

Browse files
moffa90claude
andcommitted
fix: address PR review comments - remove unused imports and fix bare excepts
- Remove unused imports (asdict, Any, EMC2305Error) - Replace bare except clauses with except Exception - Add explanatory comments for intentionally ignored exceptions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8af8618 commit 4438c08

5 files changed

Lines changed: 12 additions & 13 deletions

File tree

emc2305/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"""
99

1010
import logging
11-
from dataclasses import dataclass, field, asdict
11+
from dataclasses import dataclass, field
1212
from pathlib import Path
13-
from typing import Optional, Dict, Any
13+
from typing import Optional, Dict
1414
from enum import Enum
1515

1616
try:

examples/python/test_fan_control.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ def main():
9494
try:
9595
# Set fan to safe speed before exit
9696
fan_controller.set_pwm_duty_cycle(1, 30)
97-
except:
98-
pass
97+
except Exception:
98+
pass # Ignore cleanup errors - fan_controller may not exist
9999

100100

101101
if __name__ == "__main__":

examples/python/test_fault_detection.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ def main():
155155
for channel in range(1, 6):
156156
try:
157157
fan_controller.set_pwm_duty_cycle(channel, 50)
158-
except:
159-
pass
158+
except Exception:
159+
pass # Ignore errors for channels without fans
160160

161161
time.sleep(3)
162162

@@ -188,10 +188,10 @@ def main():
188188
for channel in range(1, 6):
189189
try:
190190
fan_controller.set_pwm_duty_cycle(channel, 40)
191-
except:
192-
pass
193-
except:
194-
pass
191+
except Exception:
192+
pass # Ignore errors for channels without fans
193+
except Exception:
194+
pass # Ignore cleanup errors - fan_controller may not exist
195195

196196

197197
if __name__ == "__main__":

examples/python/test_fsc_mode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ def main():
126126
try:
127127
# Set fan to safe idle speed
128128
fan_controller.set_target_rpm(1, 1500)
129-
except:
130-
pass
129+
except Exception:
130+
pass # Ignore cleanup errors - fan_controller may not exist
131131

132132

133133
if __name__ == "__main__":

tests/test_driver_unit.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
ControlMode,
1515
FanStatus,
1616
FanConfig,
17-
EMC2305Error,
1817
EMC2305DeviceNotFoundError,
1918
EMC2305ValidationError,
2019
)

0 commit comments

Comments
 (0)