[elbe-devel] [PATCH 14/28] pylint: fix unnecessary parenthesis

Torben Hohn torben.hohn at linutronix.de
Wed Aug 22 11:29:08 CEST 2018


pylint complains like this:
elbepack/updated.py:300: [C0325(superfluous-parens), ] Unnecessary parens after 'not' keyword

fix them all

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/aptpkgutils.py          | 2 +-
 elbepack/commands/control.py     | 4 ++--
 elbepack/commands/prjrepo.py     | 4 ++--
 elbepack/commands/remove_sign.py | 2 +-
 elbepack/commands/sign.py        | 2 +-
 elbepack/daemons/soap/esoap.py   | 6 +++---
 elbepack/initvmaction.py         | 2 +-
 elbepack/updated.py              | 2 +-
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
index a5303dfb..2d8c42f1 100644
--- a/elbepack/aptpkgutils.py
+++ b/elbepack/aptpkgutils.py
@@ -105,7 +105,7 @@ class PackageBase(object):
 
 class APTPackage(PackageBase):
     def __init__(self, pkg, cache=None):
-        if type(pkg) == str:
+        if isiinstance(pkg, str):
             pkg = cache[pkg]
 
         iver = pkg.installed and pkg.installed.version
diff --git a/elbepack/commands/control.py b/elbepack/commands/control.py
index 16ee5c96..f59016bc 100644
--- a/elbepack/commands/control.py
+++ b/elbepack/commands/control.py
@@ -144,13 +144,13 @@ def run_command(argv):
                   "versions of elbe in initvm and on your machine." % (
                       v_server, elbe_version), file=sys.stderr)
 
-            if not (opt.ignore_version):
+            if not opt.ignore_version:
                 sys.exit(20)
     except AttributeError:
         print("the elbe installation inside the initvm doesn't provide a \
 get_version interface. Please create a new initvm or upgrade \
 elbe inside the existing initvm.", file=sys.stderr)
-        if not (opt.ignore_version):
+        if not opt.ignore_version:
             sys.exit(20)
 
     try:
diff --git a/elbepack/commands/prjrepo.py b/elbepack/commands/prjrepo.py
index aaca99ab..51e2b845 100644
--- a/elbepack/commands/prjrepo.py
+++ b/elbepack/commands/prjrepo.py
@@ -112,13 +112,13 @@ def run_command(argv):
                       v_server, elbe_version),
                   file=sys.stderr)
 
-            if not (opt.ignore_version):
+            if not opt.ignore_version:
                 sys.exit(20)
     except AttributeError:
         print("the elbe installation inside the initvm doesn't provide a \
 get_version interface. Please create a new initvm or upgrade \
 elbe inside the existing initvm.", file=sys.stderr)
-        if not (opt.ignore_version):
+        if not opt.ignore_version:
             sys.exit(20)
 
     # Check whether subcommand exists
diff --git a/elbepack/commands/remove_sign.py b/elbepack/commands/remove_sign.py
index 918cc32a..1905ef25 100644
--- a/elbepack/commands/remove_sign.py
+++ b/elbepack/commands/remove_sign.py
@@ -10,7 +10,7 @@ from elbepack.gpg import unsign_file
 
 
 def run_command(argv):
-    if(len(argv) != 1):
+    if len(argv) != 1:
         print("Wrong number of arguments.")
         print("Please pass the name of the file to unsign.")
         return
diff --git a/elbepack/commands/sign.py b/elbepack/commands/sign.py
index 538f22a6..d7d2620f 100644
--- a/elbepack/commands/sign.py
+++ b/elbepack/commands/sign.py
@@ -10,7 +10,7 @@ from elbepack.gpg import sign_file
 
 
 def run_command(argv):
-    if(len(argv) != 2):
+    if len(argv) != 2:
         print("Wrong number of arguments.")
         print("Please pass the name of the file to sign "
               "and a valid gnupg fingerprint.")
diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
index e5d7b628..3ec1b903 100644
--- a/elbepack/daemons/soap/esoap.py
+++ b/elbepack/daemons/soap/esoap.py
@@ -92,7 +92,7 @@ class ESoap (ServiceBase):
         # pylint: disable=too-many-arguments
 
         fn = os.path.join(builddir, fname)
-        if (part == 0):
+        if part == 0:
             if self.app.pm.db.is_busy(builddir):
                 return -1
             self.app.pm.db.set_busy(builddir, ["empty_project", "needs_build",
@@ -106,7 +106,7 @@ class ESoap (ServiceBase):
             with open(fn, 'a') as fp:
                 fp.flush()
             self.app.pm.db.reset_busy(builddir, "has_changes")
-            if (fname == "source.xml"):
+            if fname == "source.xml":
                 # ensure that the project cache is reloaded
                 self.app.pm.close_current_project(uid)
                 self.app.pm.open_project(
@@ -128,7 +128,7 @@ class ESoap (ServiceBase):
         file_name = builddir + "/" + filename
         file_stat = os.stat(file_name)
 
-        if (pos >= file_stat.st_size):
+        if pos >= file_stat.st_size:
             return "EndOfFile"
 
         with open(file_name) as fp:
diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index 6660b93a..61382701 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -78,7 +78,7 @@ class InitVMAction(object):
         try:
             self.conn = libvirt.open("qemu:///system")
         except libvirt.libvirtError as verr:
-            if type(verr.args[0]) is not str:
+            if not isinstance(verr.args[0], str):
                 raise
             if verr.args[0].startswith('Failed to connect socket to'):
                 print("", file=sys.stderr)
diff --git a/elbepack/updated.py b/elbepack/updated.py
index b08420da..7e2418f5 100644
--- a/elbepack/updated.py
+++ b/elbepack/updated.py
@@ -297,7 +297,7 @@ def _apply_update(fname, status):
     percent = 0
     for p in hl_cache:
         i = i + 1
-        if not (i % step):
+        if not i % step:
             percent = percent + 10
             status.log(str(percent) + "% - " + str(i) + "/" + str(count))
             status.set_progress(2, str(percent) + "%")
-- 
2.11.0




More information about the elbe-devel mailing list