[Buildroot] [git commit branch/2020.02.x] support/scripts/pkg-stats: fix flake8 E722 warning

Peter Korsgaard peter at korsgaard.com
Fri Aug 28 15:45:16 UTC 2020


commit: https://git.buildroot.net/buildroot/commit/?id=6a8e31a27a2fdcf6f1efa588394202465cff0d4e
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2020.02.x

flake8 complains with:

  support/scripts/pkg-stats:339:13: E722 do not use bare 'except'

Due to the construct:

  try:
     something
  except:
     print("some message")
     raise

Which is in fact OK because the exception is re-raised. This issue is
discussed at https://github.com/PyCQA/pycodestyle/issues/703, and the
general agreement is that these "bare except" are OK, and should be
ignored from flake8 using a noqa statement.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
(cherry picked from commit 3b5bc480a59a100e835b8d7739ce71c4f14d2dba)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 support/scripts/pkg-stats | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index d6239024eb..fda950862a 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -336,7 +336,7 @@ class CVE:
             filename = CVE.download_nvd_year(nvd_dir, year)
             try:
                 content = ijson.items(gzip.GzipFile(filename), 'CVE_Items.item')
-            except:
+            except:  # noqa: E722
                 print("ERROR: cannot read %s. Please remove the file then rerun this script" % filename)
                 raise
             for cve in content:


More information about the buildroot mailing list