combine KeyError & IndexError to common base class LookupError
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2015-2021 Mike Fährmann
|
||||
# Copyright 2015-2022 Mike Fährmann
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
@@ -168,7 +168,7 @@ def parse_bytes(value, default=0, suffixes="bkmgtp"):
|
||||
"""Convert a bytes-amount ("500k", "2.5M", ...) to int"""
|
||||
try:
|
||||
last = value[-1].lower()
|
||||
except (TypeError, KeyError, IndexError):
|
||||
except (TypeError, LookupError):
|
||||
return default
|
||||
|
||||
if last in suffixes:
|
||||
|
||||
Reference in New Issue
Block a user