[PATCH] Fixup various errors detected by pylint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've been running pylint on a subset of anaconda:
booty storage iw/*.py platform.py

And it has found various errors this commit fixes:
- Restore line accidently dropped from iscsi.py
- execWithPulseProgress should propagate the return value of
  execWithCallback
- storage.formats.fs:535 (FS.doCheck): self.intf should be just intf
- storage.formats.fs: add missing "import sys" (for sys.exit)
- advanced_config.py add missing import for NetworkConfigurator
- lvm_dialog_gui.py: VolumeGroupEditor.editLogicalVolume dev was renamed to d
- partition_gui.py: remove an unneeded semicolon
- partition_gui.py: PartitionWindow.createCB rc should be dialog_rc
- storage.FSSet.write: put docstring in the proper place
- platform.Sparc.minimumSector: sectors should be sector
---
 iutil.py               |    2 +-
 iw/advanced_storage.py |    1 +
 iw/lvm_dialog_gui.py   |    2 +-
 iw/partition_gui.py    |    4 ++--
 platform.py            |    2 +-
 storage/__init__.py    |    2 +-
 storage/formats/fs.py  |    7 ++++---
 storage/iscsi.py       |    1 +
 8 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/iutil.py b/iutil.py
index 3cee3f0..bd1cca8 100644
--- a/iutil.py
+++ b/iutil.py
@@ -351,7 +351,7 @@ def _pulseProgressCallback(data, callback_data=None):
 def execWithPulseProgress(command, argv, stdin = None, stdout = None,
                           stderr = None, echo = True, progress = None,
                           root = '/'):
-    execWithCallback(command, argv, stdin=stdin, stdout=stdout,
+    return execWithCallback(command, argv, stdin=stdin, stdout=stdout,
                      stderr=stderr, echo=echo, callback=_pulseProgressCallback,
                      callback_data=progress, root=root)
 
diff --git a/iw/advanced_storage.py b/iw/advanced_storage.py
index 22ddff7..f7d5a07 100644
--- a/iw/advanced_storage.py
+++ b/iw/advanced_storage.py
@@ -27,6 +27,7 @@ import iutil
 import network
 import storage.fcoe
 import storage.iscsi
+from netconfig_dialog import NetworkConfigurator
 
 def addFcoeDrive(anaconda):
     (dxml, dialog) = gui.getGladeWidget("fcoe-config.glade", "fcoeDialog")
diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index a93a646..44cd840 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -645,7 +645,7 @@ class VolumeGroupEditor:
                         if (d.type != "lvmlv" or d.vg.id != self.vg.id) and \
                            mp == mountpoint and \
                            not (isinstance(d, LUKSDevice) and
-                                full_name in [d.name for d in dev.parents]):
+                                full_name in [dev.name for dev in d.parents]):
                             used = True
                             break
 
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index f3f0ff9..094ada0 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -1507,7 +1507,7 @@ class PartitionWindow(InstallWindow):
         # in the back when we pop up other screens.
         if dialog_rc != 1:
             log.error("I received a dialog_rc != 1 (%d) witch should not "
-                    "happen" % rc)
+                    "happen" % dialog_rc)
             self.dialog.destroy()
             return
 
@@ -1771,7 +1771,7 @@ class PartitionWindow(InstallWindow):
 
         while True:
             vgeditor.editLogicalVolume(lv, isNew = isNew)
-            actions = vgeditor.convertToActions();
+            actions = vgeditor.convertToActions()
 
             for action in actions:
                 # FIXME: handle exceptions
diff --git a/platform.py b/platform.py
index d5c1e68..4b65198 100644
--- a/platform.py
+++ b/platform.py
@@ -466,7 +466,7 @@ class Sparc(Platform):
     @property
     def minimumSector(self, disk):
         (cylinders, heads, sector) = disk.device.biosGeometry
-        start = long(sectors * heads)
+        start = long(sector * heads)
         start /= long(1024 / disk.device.sectorSize)
         return start+1
 
diff --git a/storage/__init__.py b/storage/__init__.py
index eb4d69f..356e2d7 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -2004,10 +2004,10 @@ class FSSet(object):
         return migratable
 
     def write(self, instPath=None):
+        """ write out all config files based on the set of filesystems """
         if not instPath:
             instPath = self.rootpath
 
-        """ write out all config files based on the set of filesystems """
         # /etc/fstab
         fstab_path = os.path.normpath("%s/etc/fstab" % instPath)
         fstab = self.fstab()
diff --git a/storage/formats/fs.py b/storage/formats/fs.py
index b07bd4a..21f9fea 100644
--- a/storage/formats/fs.py
+++ b/storage/formats/fs.py
@@ -29,6 +29,7 @@
 """
 import math
 import os
+import sys
 import tempfile
 import selinux
 import isys
@@ -532,9 +533,9 @@ class FS(DeviceFormat):
                          "interactively.  Restart installation after you "
                          "have corrected the problems on the filesystem.")
 
-                self.intf.messageWindow(_("Unrecoverable Error"),
-                                        hdr + "\n\n" + msg + "\n\n" + help,
-                                        custom_icon='error')
+                intf.messageWindow(_("Unrecoverable Error"),
+                                   hdr + "\n\n" + msg + "\n\n" + help,
+                                   custom_icon='error')
                 sys.exit(0)
             else:
                 raise FSError(hdr + msg)
diff --git a/storage/iscsi.py b/storage/iscsi.py
index 1499fd4..68c2c9d 100644
--- a/storage/iscsi.py
+++ b/storage/iscsi.py
@@ -283,6 +283,7 @@ class iscsi(object):
             return
 
         # set iscsi nodes to autostart
+        root = anaconda.id.storage.rootDevice
         for node in self.nodes:
             autostart = True
             disks = self.getNodeDisks(node, anaconda.id.storage)
-- 
1.6.5.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux