fix utils

This commit is contained in:
2025-12-13 17:29:20 +01:00
parent 47da49e09d
commit c4b9fba17e

View File

@@ -6,7 +6,7 @@ def parse_values(raw_input):
tokens = raw_input.replace(',', ' ').split() tokens = raw_input.replace(',', ' ').split()
for token in tokens: for token in tokens:
match = re.fullmatch(r'([0-9]*\.?[0-9]+)\s*([KM]?)', token) match = re.fullmatch(r'([0-9]*\.?[0-9]+)\s*([numkMGµ]?)', token)
if not match: if not match:
raise ValueError(f"Invalid component value '{token}'") raise ValueError(f"Invalid component value '{token}'")
@@ -29,7 +29,7 @@ def parse_values(raw_input):
case "G": case "G":
multiplier = 1e3 multiplier = 1e3
case _: case _:
1.0 multiplier = 1.0
values.append(number * multiplier) values.append(number * multiplier)