[elbe-devel] [PATCH 3/3] aptpkgutils, asyncworker, egpg, fstab, junit: fix style errors

Akash Satamkar akash at linutronix.de
Thu Sep 26 15:22:06 CEST 2019


pylint and pycodestyle complains:
_____________________________________
elbepack/aptpkgutils.py:24:1: E302 expected 2 blank lines, found 1
elbepack/aptpkgutils.py:32:1: E302 expected 2 blank lines, found 1

elbepack/asyncworker.py:121:1: E302 expected 2 blank lines, found 1
elbepack/asyncworker.py:170:80: E501 line too long (85 > 79 characters)
elbepack/asyncworker.py:176:22: E225 missing whitespace around operator
elbepack/asyncworker.py:191:1: E302 expected 2 blank lines, found 1
elbepack/asyncworker.py:194:20: E225 missing whitespace around operator
elbepack/asyncworker.py:195:21: E225 missing whitespace around operator
elbepack/asyncworker.py:218:1: E302 expected 2 blank lines, found 1
elbepack/asyncworker.py:294:1: E302 expected 2 blank lines, found 1
elbepack/asyncworker.py:319:1: E302 expected 2 blank lines, found 1
elbepack/asyncworker.py:461:80: E501 line too long (80 > 79 characters)
elbepack/asyncworker.py:530:50: E231 missing whitespace after ':'

elbepack/egpg.py:176:1: E302 expected 2 blank lines, found 1
elbepack/egpg.py:187:1: E302 expected 2 blank lines, found 1
elbepack/egpg.py:242:1: E305 expected 2 blank lines after class or
function definition, found 1
elbepack/egpg.py:243:1: E302 expected 2 blank lines, found 0

elbepack/fstab.py:38:31: E127 continuation line
over-indented for visual indent

elbepack/junit.py:49:21: E261 at least two spaces
before inline comment
elbepack/junit.py:55:1: E265 block comment should start with '# '
___________________________________________________

fixed it

Signed-off-by: Akash Satamkar <akash at linutronix.de>
---
 elbepack/aptpkgutils.py |  2 ++
 elbepack/asyncworker.py | 19 +++++++++++++------
 elbepack/egpg.py        |  6 ++++++
 elbepack/fstab.py       |  2 +-
 elbepack/junit.py       |  4 ++--
 5 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
index 84dd0dce..c972d605 100644
--- a/elbepack/aptpkgutils.py
+++ b/elbepack/aptpkgutils.py
@@ -21,6 +21,7 @@ statestring = {
     NOTINSTALLED: "NOT INSTALLED"
 }
 
+
 def apt_pkg_md5(pkg):
     hashes = pkg._records.hashes
     for i in xrange(len(hashes)):
@@ -29,6 +30,7 @@ def apt_pkg_md5(pkg):
             return h.split(':')[1]
     return ""
 
+
 def getdeps(pkg):
     for dd in pkg.dependencies:
         for d in dd:
diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
index fe88b196..0e29eba5 100644
--- a/elbepack/asyncworker.py
+++ b/elbepack/asyncworker.py
@@ -118,6 +118,7 @@ class BuildCDROMsJob(AsyncWorkerJob):
             db.update_project_files(self.project)
             db.reset_busy(self.project.builddir, success)
 
+
 class BuildChrootTarJob(AsyncWorkerJob):
     def __init__(self, project):
         AsyncWorkerJob.__init__(self, project)
@@ -167,13 +168,14 @@ class BuildJob(AsyncWorkerJob):
                                build_bin=self.build_bin,
                                build_sources=self.build_src,
                                skip_pbuild=self.skip_pbuilder)
-        except (DebootstrapException, AptCacheCommitError, AptCacheUpdateError) as e:
+        except (DebootstrapException,
+                AptCacheCommitError, AptCacheUpdateError) as e:
             if isinstance(e, DebootstrapException):
                 err = "Debootstrap failed to install the base rootfilesystem."
             elif isinstance(e, AptCacheCommitError):
                 err = "Failed to commit the AptCache changes."
             elif isinstance(e, AptCacheUpdateError):
-                err ="Failed to build the Apt Cache."
+                err = "Failed to build the Apt Cache."
 
             logging.exception("%s\n"
                               "Probable cause might be:\n"
@@ -188,11 +190,12 @@ class BuildJob(AsyncWorkerJob):
             db.update_project_files(self.project)
             db.reset_busy(self.project.builddir, success)
 
+
 class PdebuildJob(AsyncWorkerJob):
     def __init__(self, project, cpuset=-1, profile=""):
         AsyncWorkerJob.__init__(self, project)
-        self.cpuset=cpuset
-        self.profile=profile
+        self.cpuset = cpuset
+        self.profile = profile
 
     def enqueue(self, queue, db):
         db.set_busy(self.project.builddir,
@@ -215,6 +218,7 @@ class PdebuildJob(AsyncWorkerJob):
             db.update_project_files(self.project)
             db.reset_busy(self.project.builddir, success)
 
+
 class CreatePbuilderJob(AsyncWorkerJob):
     def __init__(self, project):
         AsyncWorkerJob.__init__(self, project)
@@ -291,6 +295,7 @@ class APTUpdateJob(AsyncWorkerJob):
         finally:
             db.reset_busy(self.project.builddir, success)
 
+
 class APTUpdUpgrJob(AsyncWorkerJob):
     def __init__(self, project):
         AsyncWorkerJob.__init__(self, project)
@@ -316,6 +321,7 @@ class APTUpdUpgrJob(AsyncWorkerJob):
         finally:
             db.reset_busy(self.project.builddir, success)
 
+
 class APTCommitJob(AsyncWorkerJob):
     def __init__(self, project):
         AsyncWorkerJob.__init__(self, project)
@@ -458,7 +464,8 @@ class CheckoutVersionJob(AsyncWorkerJob):
         # given version and restore the status, indicating that we need a
         # complete rebuild
         if old_status == "build_failed":
-            logging.warning("Previous project status indicated a failed build\n"
+            logging.warning("Previous project status "
+                            "indicated a failed build\n"
                             "Just checking out the XML file.")
 
             try:
@@ -527,7 +534,7 @@ class AsyncWorker(Thread):
             job = self.queue.get()
             if job is not None:
                 with savecwd():
-                    with elbe_logging({"projects":job.project.builddir}):
+                    with elbe_logging({"projects": job.project.builddir}):
                         job.execute(self.db)
             else:
                 loop = False
diff --git a/elbepack/egpg.py b/elbepack/egpg.py
index 55a624e9..16a1b54b 100644
--- a/elbepack/egpg.py
+++ b/elbepack/egpg.py
@@ -173,6 +173,7 @@ def unsign_file(fname):
 
     return None
 
+
 def unlock_key(fingerprint):
     ctx = core.Context()
     ctx.set_engine_info(PROTOCOL_OpenPGP,
@@ -184,6 +185,7 @@ def unlock_key(fingerprint):
            "--preset -P requiredToAvoidUserInput %s" % str(keygrip),
            env_add={"GNUPGHOME": "/var/cache/elbe/gnupg"})
 
+
 def sign(infile, outfile, fingerprint):
 
     ctx = core.Context()
@@ -239,7 +241,11 @@ def get_fingerprints():
 # default-cache-ttl and max-cache-ttl values.  Thus we're setting the
 # least maximum value of the type unsigned long to ensure that the
 # passphrase is 'never' removed from gpg-agent.
+
+
 EOT = 4294967295
+
+
 def generate_elbe_internal_key():
     hostfs.mkdir_p("/var/cache/elbe/gnupg")
     hostfs.write_file("/var/cache/elbe/gnupg/gpg-agent.conf", 0o600,
diff --git a/elbepack/fstab.py b/elbepack/fstab.py
index 8c938e4f..5bfb6386 100644
--- a/elbepack/fstab.py
+++ b/elbepack/fstab.py
@@ -35,7 +35,7 @@ def get_mtdnum(xml, label):
 def get_devicelabel(xml, node):
     if node.text("fs/type") == "ubifs":
         return "ubi%s:%s" % (get_mtdnum(xml, node.text("label")),
-                              node.text("label"))
+                             node.text("label"))
 
     return "LABEL=" + node.text("label")
 
diff --git a/elbepack/junit.py b/elbepack/junit.py
index ab759332..49258de6 100644
--- a/elbepack/junit.py
+++ b/elbepack/junit.py
@@ -46,13 +46,13 @@ class TestSuite(object):
             try:
                 test_cases.append(self.do_test(test, self.target))
             except TestException as E:
-                pass # TODO - Handle me!
+                pass  # TODO - Handle me!
         ts = junit.TestSuite(name=self.node.et.attrib["name"],
                              test_cases=test_cases)
         return ts
 
 
-#pylint: disable=too-few-public-methods,no-member
+# pylint: disable=too-few-public-methods,no-member
 @TestSuite.register("BaseTest", register=False)
 class BaseTest(object):
 
-- 
2.20.1




More information about the elbe-devel mailing list