Skip to content

Commit

Permalink
Adapt to non-systematic RdsOn
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqwsx committed Aug 6, 2023
1 parent 0706003 commit c1df946
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions jlcparts/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,23 @@ def rdsOnMaxAtVgsAtIds(value):
def readRds(v):
if v == "-":
return "NaN", "NaN", "NaN"
resistance, voltage, current = re.fullmatch(
#
match = re.fullmatch(
r"\s*([\w.]+)\s*(?:[@\s]\s*([-~\w.]+?)\s*(?:(?:[,,]|(?<=[vam])(?=\d))([-\w.]+)\s*)?)?",
v,
re.I
).groups()
)
if match is not None:
resistance, voltage, current = match.groups()
else:
# There some components in the form 2.5Ω@VGS=10V, try this format
resistance, voltage = re.fullmatch(
r"\s*(.*Ω)\s*@\s*VGS=\s*(.*V)\s*",
v,
re.I
)
current = None

if current is None:
current = "-"
if voltage is None:
Expand Down

1 comment on commit c1df946

@maksz42
Copy link
Contributor

@maksz42 maksz42 commented on c1df946 Aug 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to call groups()

Please sign in to comment.