Skip to content

Commit

Permalink
Handle zero voltage rating resistor cases (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
Suke0811 authored Sep 20, 2024
1 parent 5ac5c56 commit aead961
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions edg/parts/JlcResistor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ def parse_row(row: PartsTableRow) -> Optional[Dict[PartsTableColumn, Any]]:
new_cols[cls.POWER_RATING] = Range.zero_to_upper(
PartParserUtil.parse_value(extracted_values['power'][1], 'W'))

new_cols[cls.VOLTAGE_RATING] = Range.zero_to_upper(
PartParserUtil.parse_value(extracted_values['voltage'][1], 'V'))
if 'voltage' in extracted_values:
new_cols[cls.VOLTAGE_RATING] = Range.zero_to_upper(
PartParserUtil.parse_value(extracted_values.get('voltage', ('', '0V'))[1], 'V'))
else:
new_cols[cls.VOLTAGE_RATING] = Range(0, 0)

return new_cols
except (KeyError, PartParserUtil.ParseError):
Expand Down

0 comments on commit aead961

Please sign in to comment.