fix utils
This commit is contained in:
4
utils.py
4
utils.py
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user