[PATCH 8/9] Add exception specifications for regexes and imports to match PEP8

From: Elisha Hollander
Date: Mon May 24 2021 - 11:47:11 EST


---
scripts/checkkconfigsymbols.py | 2 +-
tools/perf/scripts/python/compaction-times.py | 2 +-
tools/perf/scripts/python/export-to-postgresql.py | 2 +-
tools/perf/scripts/python/export-to-sqlite.py | 2 +-
tools/perf/scripts/python/exported-sql-viewer.py | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py
index 1548f9ce4682..63b7e526fa34 100755
--- a/scripts/checkkconfigsymbols.py
+++ b/scripts/checkkconfigsymbols.py
@@ -107,7 +107,7 @@ def parse_options():
if args.ignore:
try:
re.match(args.ignore, "this/is/just/a/test.c")
- except:
+ except re.error:
sys.exit("Please specify a valid Python regex.")

return args
diff --git a/tools/perf/scripts/python/compaction-times.py b/tools/perf/scripts/python/compaction-times.py
index 83098803144b..e89398ddff50 100644
--- a/tools/perf/scripts/python/compaction-times.py
+++ b/tools/perf/scripts/python/compaction-times.py
@@ -302,7 +302,7 @@ if argc >= 1:
else:
try:
comm_re=re.compile(opt)
- except:
+ except re.error:
sys.stderr.write("invalid regex '%s'" % opt)
sys.exit(usage)
f = comm_filter(comm_re)
diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py
index d187e46c2683..570c77d92678 100644
--- a/tools/perf/scripts/python/export-to-postgresql.py
+++ b/tools/perf/scripts/python/export-to-postgresql.py
@@ -217,7 +217,7 @@ if not "pyside-version-1" in sys.argv:
try:
from PySide2.QtSql import *
pyside_version_1 = False
- except:
+ except ImportError:
pass

if pyside_version_1:
diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py
index 8043a7272a56..3d6d90382798 100644
--- a/tools/perf/scripts/python/export-to-sqlite.py
+++ b/tools/perf/scripts/python/export-to-sqlite.py
@@ -74,7 +74,7 @@ if not "pyside-version-1" in sys.argv:
try:
from PySide2.QtSql import *
pyside_version_1 = False
- except:
+ except ImportError:
pass

if pyside_version_1:
diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index 7c37d212c3ab..3e8f473e1fd1 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -117,7 +117,7 @@ if not "--pyside-version-1" in sys.argv:
from PySide2.QtSql import *
from PySide2.QtWidgets import *
pyside_version_1 = False
- except:
+ except ImportError:
pass

if pyside_version_1:
--
2.25.1