Commit 3aa5c56
fix: Thermo Skanit - Initialize plate_well_count to prevent UnboundLocalError (#1156)
## Summary
- Fixes UnboundLocalError in Thermo Skanit parser when processing plates
with empty wavelength data
- Initializes `plate_well_count` to 0 at the start of each plate
iteration to ensure the variable is always defined
## Problem
When the Thermo Skanit parser processes a plate where all wavelength
DataFrames are empty (no valid data), the `plate_well_count` variable
was never assigned a value. This caused an UnboundLocalError at line 379
when trying to access `plate_well_counts[plate_id]`.
## Solution
Initialize `plate_well_count = 0` at the beginning of each plate
iteration. This ensures the variable is always defined even when no
valid wavelength data is found.
This approach follows the established pattern in other parsers (e.g.,
QIAcuity dPCR) where 0 is used as a fallback value when plate well count
cannot be determined. The field is required in the ASM schema and will
be made optional in a future version.
## Test plan
- [x] Existing tests pass
- [x] Linting passes (ruff, black, mypy)
- [ ] Verify fix handles edge case of plates with empty wavelength data
without crashing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.1 <noreply@anthropic.com>1 parent 951a578 commit 3aa5c56
2 files changed
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| 324 | + | |
324 | 325 | | |
325 | 326 | | |
326 | 327 | | |
| |||
0 commit comments