From 9252d448b6a956f57074a6ebad6e437fd2d63fc1 Mon Sep 17 00:00:00 2001 From: Suke0811 <49264928+Suke0811@users.noreply.github.com> Date: Fri, 20 Sep 2024 01:00:47 -0700 Subject: [PATCH] Update: handling zero voltage rating cases --- edg/parts/JlcResistor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/edg/parts/JlcResistor.py b/edg/parts/JlcResistor.py index 80a3e4ef2..a3c0a5d5d 100644 --- a/edg/parts/JlcResistor.py +++ b/edg/parts/JlcResistor.py @@ -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):