combine KeyError & IndexError to common base class LookupError

This commit is contained in:
Mike Fährmann
2022-02-11 00:42:49 +01:00
parent f1c853c6ef
commit bc0e853d30
2 changed files with 3 additions and 3 deletions

View File

@@ -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: