From e9e6e5701e79b2d8ec23cae7cf6ca37e16dbe289 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Thu, 12 Oct 2017 17:45:50 +0300 Subject: [PATCH] Misc pylint fixes that are reported usually once --- src/bin/image-minimizer | 2 +- src/pylorax/__init__.py | 4 ++-- src/pylorax/imgutils.py | 2 +- src/pylorax/logmonitor.py | 2 +- src/pylorax/yumhelper.py | 2 +- tests/pylint/runpylint.py | 1 + 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bin/image-minimizer b/src/bin/image-minimizer index 27c3b52a..0b38d31d 100755 --- a/src/bin/image-minimizer +++ b/src/bin/image-minimizer @@ -191,7 +191,7 @@ if __name__ == "__main__": except SystemExit, e: sys.exit(e.code) except KeyboardInterrupt, e: - print >> sys.stderr, _("Aborted at user request") + print >> sys.stderr, "Aborted at user request" except Exception, e: print e sys.exit(1) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 81b3f730..873a56f8 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -70,7 +70,7 @@ class ArchData(DataHolder): arm="arm", armhfp="arm") def __init__(self, buildarch): - self.buildarch = buildarch + DataHolder.__init__(self, buildarch=buildarch) self.basearch = getBaseArch(buildarch) self.libdir = "lib64" if self.basearch in self.lib64_arches else "lib" self.bcj = self.bcj_arch.get(self.basearch) @@ -143,7 +143,7 @@ class Lorax(BaseLoraxClass): # remove some environmental variables that can cause problems with package scripts env_remove = ('DISPLAY', 'DBUS_SESSION_BUS_ADDRESS') - [os.environ.pop(k) for k in env_remove if k in os.environ] + _ = [os.environ.pop(k) for k in env_remove if k in os.environ] self._configured = True diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py index a9c31b8d..86f7a6e8 100644 --- a/src/pylorax/imgutils.py +++ b/src/pylorax/imgutils.py @@ -67,7 +67,7 @@ def compress(command, rootdir, outfile, compression="xz", compressargs=None): except OSError as e: logger.error(e) # Kill off any hanging processes - [p.kill() for p in (find, archive, comp) if p] + _ = [p.kill() for p in (find, archive, comp) if p] return 1 def mkcpio(rootdir, outfile, compression="xz", compressargs=None): diff --git a/src/pylorax/logmonitor.py b/src/pylorax/logmonitor.py index 07f7560c..cb43f289 100644 --- a/src/pylorax/logmonitor.py +++ b/src/pylorax/logmonitor.py @@ -61,7 +61,7 @@ class LogRequestHandler(SocketServer.BaseRequestHandler): except socket.timeout: pass - except: + except Exception: break def finish(self): diff --git a/src/pylorax/yumhelper.py b/src/pylorax/yumhelper.py index 3aff95d8..64d85075 100644 --- a/src/pylorax/yumhelper.py +++ b/src/pylorax/yumhelper.py @@ -34,7 +34,7 @@ class LoraxDownloadCallback(yum.callbacks.DownloadBaseCallback): yum.callbacks.DownloadBaseCallback.__init__(self) self.output = output.LoraxOutput() - pattern = "\((?P\d+)/(?P\d+)\):\s+(?P.*)" + pattern = r"\((?P\d+)/(?P\d+)\):\s+(?P.*)" self.pattern = re.compile(pattern) def updateProgress(self, name, frac, fread, ftime): diff --git a/tests/pylint/runpylint.py b/tests/pylint/runpylint.py index 5fc5a994..b7b7f3a5 100755 --- a/tests/pylint/runpylint.py +++ b/tests/pylint/runpylint.py @@ -26,6 +26,7 @@ class LoraxLintConfig(PocketLintConfig): self.falsePositives = [ FalsePositive(r"No name 'version' in module 'pylorax'"), FalsePositive(r"Module 'pylorax' has no 'version' member"), FalsePositive(r"Instance of 'int' has no .* member"), + FalsePositive(r"Catching too general exception Exception"), ] @property