[blivet:master 02/20] Disable some W0703 warnings.

mulhern amulhern at redhat.com
Fri Apr 11 18:03:44 UTC 2014


These warn about catching too general an exception Exception.

These cases use a particular idiom within a property
where there is always a fallback to another value if any exception is thrown.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/disklabel.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
index e5b7293..a741267 100644
--- a/blivet/formats/disklabel.py
+++ b/blivet/formats/disklabel.py
@@ -207,6 +207,7 @@ class DiskLabel(DeviceFormat):
         """ The disklabel type (eg: 'gpt', 'msdos') """
         try:
             lt = self.partedDisk.type
+        # pylint: disable=W0703
         except Exception:
             lt = self._labelType
         return lt
@@ -221,6 +222,7 @@ class DiskLabel(DeviceFormat):
         if not size:
             try:
                 size = Size(bytes=self.partedDevice.getLength(unit="B"))
+            # pylint: disable=W0703
             except Exception:
                 size = 0
 
@@ -329,6 +331,7 @@ class DiskLabel(DeviceFormat):
     def extendedPartition(self):
         try:
             extended = self.partedDisk.getExtendedPartition()
+        # pylint: disable=W0703
         except Exception:
             extended = None
         return extended
@@ -337,6 +340,7 @@ class DiskLabel(DeviceFormat):
     def logicalPartitions(self):
         try:
             logicals = self.partedDisk.getLogicalPartitions()
+        # pylint: disable=W0703
         except Exception:
             logicals = []
         return logicals
@@ -345,6 +349,7 @@ class DiskLabel(DeviceFormat):
     def firstPartition(self):
         try:
             part = self.partedDisk.getFirstPartition()
+        # pylint: disable=W0703
         except Exception:
             part = None
         return part
@@ -353,6 +358,7 @@ class DiskLabel(DeviceFormat):
     def partitions(self):
         try:
             parts = self.partedDisk.partitions
+        # pylint: disable=W0703
         except Exception:
             parts = []
             if flags.testing:
@@ -413,6 +419,7 @@ class DiskLabel(DeviceFormat):
         try:
             free = sum(Size(bytes=f.getLength(unit="B"))
                         for f in self.partedDisk.getFreeSpacePartitions())
+        # pylint: disable=W0703
         except Exception:
             sys_block_root = "/sys/class/block/"
 
-- 
1.8.3.1



More information about the anaconda-patches mailing list