[PATCH] Fix more messages the new pylint found.

Chris Lumens clumens at redhat.com
Fri Oct 17 14:04:40 UTC 2014


Most of these are obvious.  The lambda-related ones are to make sure the
variable in question is looked up in the right scope.
---
 pyanaconda/rescue.py                       | 2 +-
 pyanaconda/ui/__init__.py                  | 4 ++--
 pyanaconda/ui/gui/spokes/lib/passphrase.py | 2 +-
 pyanaconda/ui/tui/simpleline/base.py       | 8 ++++----
 pyanaconda/users.py                        | 2 +-
 scripts/makebumpver                        | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
index a07a4ab..2ee1098 100644
--- a/pyanaconda/rescue.py
+++ b/pyanaconda/rescue.py
@@ -425,7 +425,7 @@ def doRescue(intf, rescue_mount, ksdata):
                     pass
         except (ValueError, LookupError, SyntaxError, NameError):
             raise
-        except Exception as e:
+        except Exception as e:    # pylint: disable=broad-except
             log.error("doRescue caught exception: %s", e)
             if flags.automatedInstall:
                 log.error("An error occurred trying to mount some or all of your system")
diff --git a/pyanaconda/ui/__init__.py b/pyanaconda/ui/__init__.py
index b1eb060..209f9a1 100644
--- a/pyanaconda/ui/__init__.py
+++ b/pyanaconda/ui/__init__.py
@@ -176,10 +176,10 @@ class UserInterface(object):
 
         actionClasses = []
         for hub in hubs:
-            actionClasses.extend(sorted(filter(lambda obj: getattr(obj, "preForHub", None) == hub, spokes),
+            actionClasses.extend(sorted(filter(lambda obj, h=hub: getattr(obj, "preForHub", None) == h, spokes),
                                         key=lambda obj: obj.priority))
             actionClasses.append(hub)
-            actionClasses.extend(sorted(filter(lambda obj: getattr(obj, "postForHub", None) == hub, spokes),
+            actionClasses.extend(sorted(filter(lambda obj, h=hub: getattr(obj, "postForHub", None) == h, spokes),
                                         key=lambda obj: obj.priority))
 
         return actionClasses
diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.py b/pyanaconda/ui/gui/spokes/lib/passphrase.py
index 685d711..add87e1 100644
--- a/pyanaconda/ui/gui/spokes/lib/passphrase.py
+++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py
@@ -111,7 +111,7 @@ class PassphraseDialog(GUIObject, GUIInputCheckHandler):
         try:
             strength = self._pwq.check(passphrase, None, None)
         except pwquality.PWQError as e:
-            self._pwq_error = e[1]
+            self._pwq_error = e.message
 
         if strength < 50:
             val = 1
diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
index 572e512..dcf3ba0 100644
--- a/pyanaconda/ui/tui/simpleline/base.py
+++ b/pyanaconda/ui/tui/simpleline/base.py
@@ -283,7 +283,7 @@ class App(object):
                 self._redraw = False
             except ExitMainLoop:
                 raise
-            except Exception:
+            except Exception:    # pylint: disable=broad-except
                 send_exception(self.queue, sys.exc_info())
                 return False
 
@@ -342,7 +342,7 @@ class App(object):
                     prompt = last_screen.prompt(self._screens[-1][1])
                 except ExitMainLoop:
                     raise
-                except Exception:
+                except Exception:    # pylint: disable=broad-except
                     send_exception(self.queue, sys.exc_info())
                     continue
 
@@ -399,7 +399,7 @@ class App(object):
                         handler(event, data)
                     except ExitMainLoop:
                         raise
-                    except Exception:
+                    except Exception:    # pylint: disable=broad-except
                         send_exception(self.queue, sys.exc_info())
 
     def raw_input(self, prompt, hidden=False):
@@ -437,7 +437,7 @@ class App(object):
                     return True
             except ExitMainLoop:
                 raise
-            except Exception:
+            except Exception:    # pylint: disable=broad-except
                 send_exception(self.queue, sys.exc_info())
                 return False
 
diff --git a/pyanaconda/users.py b/pyanaconda/users.py
index b5b076b..951c4e7 100644
--- a/pyanaconda/users.py
+++ b/pyanaconda/users.py
@@ -176,7 +176,7 @@ def validatePassword(pw, user="root", settings=None):
             # Leave valid alone here: the password is weak but can still
             # be accepted.
             # PWQError values are built as a tuple of (int, str)
-            message = e[1]
+            message = e.message
 
     return (valid, strength, message)
 
diff --git a/scripts/makebumpver b/scripts/makebumpver
index 275ef0e..a7df696 100755
--- a/scripts/makebumpver
+++ b/scripts/makebumpver
@@ -251,7 +251,7 @@ class MakeBumpVer:
 
         if self.ignore and self.ignore != '':
             for commit in self.ignore.split(','):
-                lines = filter(lambda x: not x.startswith(commit), lines)
+                lines = filter(lambda x, c=commit: not x.startswith(c), lines)
 
         rpm_log = []
         bad_bump = False
-- 
1.9.3



More information about the anaconda-patches mailing list