[elbe-devel] [PATCH 31/37] flake8: Do not use bare except, specify exception instead (E722)
Eduard Krein
eduard.krein at linutronix.de
Wed Feb 7 16:33:55 CET 2024
Am Mittwoch, dem 07.02.2024 um 15:28 +0100 schrieb Benedikt Spranger:
> Target all flake8 E722 warnings.
>
> Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
Reviewed-by: Eduard Krein <eduard.krein at linutronix.de>
> ---
> elbepack/commands/check-build.py | 2 +-
> elbepack/repodir.py | 2 +-
> elbepack/tests/test_xml.py | 8 ++++----
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/elbepack/commands/check-build.py
> b/elbepack/commands/check-build.py
> index 9d6e6275..7ec82df5 100644
> --- a/elbepack/commands/check-build.py
> +++ b/elbepack/commands/check-build.py
> @@ -81,7 +81,7 @@ class CheckBase:
> except CheckException as E:
> logging.exception(E)
> self.ret = 1
> - except:
> + except Exception:
> logging.error(traceback.format_exc())
> self.ret = 1
> return self.ret
> diff --git a/elbepack/repodir.py b/elbepack/repodir.py
> index aed240dd..2cdda4d0 100644
> --- a/elbepack/repodir.py
> +++ b/elbepack/repodir.py
> @@ -51,7 +51,7 @@ def preprocess_repodir(xml, xmldir):
> keyfile = os.path.join(hostdir,
> repodir.attrib['signed-by'])
> auth_el = Element("raw-key")
> auth_el.text = "\n" + open(keyfile,
> encoding='ascii').read()
> - except:
> + except Exception:
> raise RepodirError(
> f"{keyfile} is not a valid ascii-armored OpenPGP
> keyring")
> else:
> diff --git a/elbepack/tests/test_xml.py b/elbepack/tests/test_xml.py
> index fb271043..4377d97c 100644
> --- a/elbepack/tests/test_xml.py
> +++ b/elbepack/tests/test_xml.py
> @@ -46,8 +46,8 @@ class TestSimpleXML(ElbeTestCase):
> with self.subTest(f'check build {cmd}'):
> system(f'{sys.executable} {elbe_exe} check-
> build {cmd} "{build_dir}"')
>
> - except:
> - raise
> + except Exception as e:
> + raise e
> else:
> # This is a tear down of the project, it's okay if
> it fails
> system(
> @@ -80,8 +80,8 @@ class TestPbuilder(ElbeTestCase):
> uuid = f.read()
> system(f'cd "{build_dir}/libgpio"; \
> {sys.executable} {elbe_exe} pbuilder
> build --project {uuid}')
> - except:
> - raise
> + except Exception as e:
> + raise e
> else:
> # This is a tearDown of the project, it's okay if it
> fails
> system(
--
Eduard Krein
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 19; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/legal/data-protection.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br.,HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas
Gleixner, Sharon Heck, Yulia Beck, Tiffany Silva
More information about the elbe-devel
mailing list