[PATCH 2/2 rhel7-branch] Fix the rest of the new pylint error messages.
Chris Lumens
clumens at redhat.com
Fri Oct 17 14:55:16 UTC 2014
Related: rhbz#1121678
---
pyanaconda/anaconda_log.py | 3 +--
pyanaconda/rescue.py | 2 +-
pyanaconda/ui/__init__.py | 4 ++--
pyanaconda/ui/gui/spokes/lib/passphrase.py | 2 +-
pyanaconda/ui/gui/spokes/password.py | 4 ++--
pyanaconda/ui/gui/spokes/user.py | 4 ++--
pyanaconda/ui/tui/simpleline/base.py | 8 ++++----
pyanaconda/ui/tui/spokes/__init__.py | 2 +-
pyanaconda/vnc.py | 6 +++---
scripts/makebumpver | 2 +-
tests/pylint/runpylint.sh | 3 ++-
11 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/pyanaconda/anaconda_log.py b/pyanaconda/anaconda_log.py
index 9b331e3..90d2909 100644
--- a/pyanaconda/anaconda_log.py
+++ b/pyanaconda/anaconda_log.py
@@ -176,8 +176,7 @@ class AnacondaLog:
The warnings mechanism is used by some libraries we use,
notably pykickstart.
"""
- self.anaconda_logger.warning("%s" % warnings.formatwarning(
- message, category, filename, lineno, line))
+ self.anaconda_logger.warning(warnings.formatwarning(message, category, filename, lineno, line))
def restartSyslog(self):
os.system("systemctl restart rsyslog.service")
diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
index 934122e..faad3c5 100644
--- a/pyanaconda/rescue.py
+++ b/pyanaconda/rescue.py
@@ -430,7 +430,7 @@ def doRescue(intf, rescue_mount, ksdata):
pass
except (ValueError, LookupError, SyntaxError, NameError):
raise
- except Exception as e:
+ except Exception as e: # pylint: disable=W0703
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 c60698d..2cbf76a 100644
--- a/pyanaconda/ui/__init__.py
+++ b/pyanaconda/ui/__init__.py
@@ -163,10 +163,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 369a998..226159b 100644
--- a/pyanaconda/ui/gui/spokes/lib/passphrase.py
+++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py
@@ -104,7 +104,7 @@ class PassphraseDialog(GUIObject):
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/gui/spokes/password.py b/pyanaconda/ui/gui/spokes/password.py
index 0ae2586..72ecc96 100644
--- a/pyanaconda/ui/gui/spokes/password.py
+++ b/pyanaconda/ui/gui/spokes/password.py
@@ -117,7 +117,7 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke):
strength = checkPassword(self.pw.get_text())
_pwq_error = None
except PWQError as e:
- _pwq_error = e[1]
+ _pwq_error = e.message
strength = 0
if strength < 50:
@@ -183,7 +183,7 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke):
pass
else:
self._error = _("You have provided a weak password: %s. "
- " Press Done again to use anyway.") % e[1]
+ " Press Done again to use anyway.") % e.message
self._oldweak = pw
return False
diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
index 2da338e..e40b413 100644
--- a/pyanaconda/ui/gui/spokes/user.py
+++ b/pyanaconda/ui/gui/spokes/user.py
@@ -351,7 +351,7 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke):
strength = self._pwq.check(self.pw.get_text(), None, None)
_pwq_error = None
except pwquality.PWQError as e:
- _pwq_error = e[1]
+ _pwq_error = e.message
strength = 0
if strength < 50:
@@ -426,7 +426,7 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke):
pass
else:
self._error = _("You have provided a weak password: %s. "
- " Press Done again to use anyway.") % e[1]
+ " Press Done again to use anyway.") % e.message
self._oldweak = pw
return False
diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
index d737ede..8a17e72 100644
--- a/pyanaconda/ui/tui/simpleline/base.py
+++ b/pyanaconda/ui/tui/simpleline/base.py
@@ -284,7 +284,7 @@ class App(object):
self._redraw = False
except ExitMainLoop:
raise
- except Exception:
+ except Exception: # pylint: disable=W0703
send_exception(self.queue, sys.exc_info())
return False
@@ -343,7 +343,7 @@ class App(object):
prompt = last_screen.prompt(self._screens[-1][1])
except ExitMainLoop:
raise
- except Exception:
+ except Exception: # pylint: disable=W0703
send_exception(self.queue, sys.exc_info())
continue
@@ -400,7 +400,7 @@ class App(object):
handler(event, data)
except ExitMainLoop:
raise
- except Exception:
+ except Exception: # pylint: disable=W0703
send_exception(self.queue, sys.exc_info())
def raw_input(self, prompt, hidden=False):
@@ -441,7 +441,7 @@ class App(object):
return True
except ExitMainLoop:
raise
- except Exception:
+ except Exception: # pylint: disable=W0703
send_exception(self.queue, sys.exc_info())
return False
diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py
index 5e121ca..84f1c3c 100644
--- a/pyanaconda/ui/tui/spokes/__init__.py
+++ b/pyanaconda/ui/tui/spokes/__init__.py
@@ -126,7 +126,7 @@ class EditTUIDialog(NormalTUISpoke):
if strength < 50:
error = _("The password you have provided is weak")
except PWQError as e:
- error = e[1]
+ error = e.message
if error:
error = _("You have provided a weak password: %s. ") % error
error += _("\nWould you like to use it anyway?")
diff --git a/pyanaconda/vnc.py b/pyanaconda/vnc.py
index d6cd3e0..2ae8901 100644
--- a/pyanaconda/vnc.py
+++ b/pyanaconda/vnc.py
@@ -176,7 +176,7 @@ class VncServer:
sys.exit(1)
self.log.error(P_("Giving up attempting to connect after %d try!\n",
"Giving up attempting to connect after %d tries!\n",
- maxTries) % (maxTries,))
+ maxTries), maxTries)
return False
def VNCListen(self):
@@ -185,11 +185,11 @@ class VncServer:
We dont really have to do anything for the server to listen :)
"""
if self.connxinfo != None:
- self.log.info(_("Please manually connect your vnc client to %s to begin the install.") % (self.connxinfo,))
+ self.log.info(_("Please manually connect your vnc client to %s to begin the install."), self.connxinfo)
else:
self.log.info(_("Please manually connect your vnc client to <IP ADDRESS>:%s "
"to begin the install. Switch to the shell (Ctrl-B 2) and "
- "run 'ip addr' to find the <IP ADDRESS>.") % (self.display,))
+ "run 'ip addr' to find the <IP ADDRESS>."), self.display)
def startServer(self):
self.log.info(_("Starting VNC..."))
diff --git a/scripts/makebumpver b/scripts/makebumpver
index 29822d9..4ab94c4 100755
--- a/scripts/makebumpver
+++ b/scripts/makebumpver
@@ -242,7 +242,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
diff --git a/tests/pylint/runpylint.sh b/tests/pylint/runpylint.sh
index b720520..3615052 100755
--- a/tests/pylint/runpylint.sh
+++ b/tests/pylint/runpylint.sh
@@ -60,6 +60,7 @@ export NON_STRICT_OPTIONS="--disable=W0212"
export DISABLED_ERR_OPTIONS="--disable=E1103"
# W0110 - map/filter on lambda could be replaced by comprehension
+# W0123 - Use of eval
# W0141 - Used builtin function %r
# W0142 - Used * or ** magic
# W0511 - Used when a warning note as FIXME or XXX is detected.
@@ -69,7 +70,7 @@ export DISABLED_ERR_OPTIONS="--disable=E1103"
# I0011 - Locally disabling %s (i.e., pylint: disable)
# I0012 - Locally enabling %s (i.e., pylint: enable)
# I0013 - Ignoring entire file (i.e., pylint: skip-file)
-export DISABLED_WARN_OPTIONS="--disable=W0110,W0141,W0142,W0511,W0603,W0613,W0614,I0011,I0012,I0013"
+export DISABLED_WARN_OPTIONS="--disable=W0110,W0123,W0141,W0142,W0511,W0603,W0613,W0614,I0011,I0012,I0013"
usage () {
echo "usage: `basename $0` [--strict] [--help] [files...]"
--
1.9.3
More information about the anaconda-patches
mailing list