misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
Simone Margaritelli 2019-11-08 13:28:37 +01:00
parent 5760864495
commit fce57ad8eb
No known key found for this signature in database
GPG Key ID: 82E42E7F3B34C97E

@ -121,10 +121,10 @@ def load_config(args):
def parse_max_size(s):
parts = re.findall(r'(^\d+)([bBkKmMgG]?)', s)
if len(parts) != 1:
if len(parts) != 1 or len(parts[0]) != 2:
raise Exception("can't parse %s as a max size" % s)
num, unit = parts[0][1]
num, unit = parts[0]
num = int(num)
unit = unit.lower()