[elbe-devel] [PATCH 10/13] pylinit - redefinition of variable type

Manuel Traut manut at linutronix.de
Wed Aug 29 21:07:31 CEST 2018


if a variable is assigned in if AND else this seems to be an issue of
  pylint (see comment in code)

for other cases this should fix the issue.

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/commands/mkcdrom.py |  6 ++++++
 elbepack/elbeproject.py      | 11 ++++++++++-
 elbepack/hdimg.py            | 12 ++++++++++++
 elbepack/xmlpreprocess.py    |  5 +++--
 4 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/elbepack/commands/mkcdrom.py b/elbepack/commands/mkcdrom.py
index f00e9645..db2f8d82 100644
--- a/elbepack/commands/mkcdrom.py
+++ b/elbepack/commands/mkcdrom.py
@@ -81,6 +81,9 @@ def run_command(argv):
     else:
         builddir = os.path.abspath(os.path.curdir)
         rfs = ChRootFilesystem(args[0])
+        # pylint: disable=redefined-variable-type
+        # this is a pylint issue fixed in
+        # 05d4e517bba0adbd3dc5ad3fa79746dc8ed9f9a3
         arch = opt.arch
         codename = opt.codename
         init_codename = opt.init_codename
@@ -89,6 +92,9 @@ def run_command(argv):
             log = ASCIIDocLog(opt.log)
         else:
             log = StdoutLog()
+            # pylint: disable=redefined-variable-type
+            # this is a pylint issue fixed in
+            # 05d4e517bba0adbd3dc5ad3fa79746dc8ed9f9a3
 
     generated_files = []
     if opt.source:
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 0f29695a..8bcd53df 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -180,6 +180,10 @@ class ElbeProject (object):
             self.log = ASCIIDocLog(logpath)
         else:
             self.log = StdoutLog()
+            # pylint: disable=redefined-variable-type
+            # this is a pylint issue fixed in
+            # 05d4e517bba0adbd3dc5ad3fa79746dc8ed9f9a3
+
 
         self.repo = ProjectRepo(self.arch, self.codename,
                                 os.path.join(self.builddir, "repo"), self.log)
@@ -422,9 +426,14 @@ class ElbeProject (object):
         self.write_log_header()
 
         # Validate Apt Sources
-        m = ValidationMode.CHECK_BINARIES
         if build_sources:
             m = ValidationMode.CHECK_ALL
+        else:
+            m = ValidationMode.CHECK_BINARIES
+            # pylint: disable=redefined-variable-type
+            # this is a pylint issue fixed in
+            # 05d4e517bba0adbd3dc5ad3fa79746dc8ed9f9a3
+
         self.xml.validate_apt_sources(m, self.arch)
 
         if self.xml.has('target/pbuilder') and not skip_pbuild:
diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
index 9604ca79..ea3b1078 100644
--- a/elbepack/hdimg.py
+++ b/elbepack/hdimg.py
@@ -490,12 +490,24 @@ def do_image_hd(outf, hd, fslabel, target, grub_version, grub_fw_type=None):
         grub = grubinstaller199(outf)
     elif grub_version == 202 and grub_fw_type == "efi":
         grub = grubinstaller202(outf, "efi")
+        # pylint: disable=redefined-variable-type
+        # this is a pylint issue fixed in
+        # 05d4e517bba0adbd3dc5ad3fa79746dc8ed9f9a3
     elif grub_version == 202 and grub_fw_type == "hybrid":
         grub = grubinstaller202(outf, "hybrid")
+        # pylint: disable=redefined-variable-type
+        # this is a pylint issue fixed in
+        # 05d4e517bba0adbd3dc5ad3fa79746dc8ed9f9a3
     elif grub_version == 202:
         grub = grubinstaller202(outf)
+        # pylint: disable=redefined-variable-type
+        # this is a pylint issue fixed in
+        # 05d4e517bba0adbd3dc5ad3fa79746dc8ed9f9a3
     else:
         grub = grubinstaller_base(outf)
+        # pylint: disable=redefined-variable-type
+        # this is a pylint issue fixed in
+        # 05d4e517bba0adbd3dc5ad3fa79746dc8ed9f9a3
 
     current_sector = 2048
     for part in hd:
diff --git a/elbepack/xmlpreprocess.py b/elbepack/xmlpreprocess.py
index b05ac547..654b9eeb 100644
--- a/elbepack/xmlpreprocess.py
+++ b/elbepack/xmlpreprocess.py
@@ -28,8 +28,9 @@ def xmlpreprocess(fname, output, variants=None):
 
     # first convert variants to a set
     if not variants:
-        variants = []
-    variants = set(variants)
+        variants = set([])
+    else:
+        variants = set(variants)
 
     schema_file = "https://www.linutronix.de/projects/Elbe/dbsfed.xsd"
     parser = XMLParser(huge_tree=True)
-- 
2.18.0




More information about the elbe-devel mailing list