Actually pass format args to ValueErrors in utils.parse_number

This commit is contained in:
jesopo 2018-10-12 11:21:57 +01:00
parent f096bddff4
commit d427e29936

View file

@ -92,7 +92,7 @@ def parse_number(s):
unit = s[-1].lower()
number = s[:-1]
if not number.isdigit():
raise ValueError("Invalid format '%s' passed to parse_number")
raise ValueError("Invalid format '%s' passed to parse_number" % number)
number = int(number)
if unit == "k":
@ -102,7 +102,7 @@ def parse_number(s):
elif unit == "b":
number *= 1_000_000_000
else:
raise ValueError("Unknown unit '%s' given to parse_number")
raise ValueError("Unknown unit '%s' given to parse_number" % unit)
return str(number)
IS_TRUE = ["true", "yes", "on", "y"]