[master 8/8] Fix the other pylint-discovered errors.
clumens
installerbot-noreply at redhat.com
Thu Jul 16 19:58:08 UTC 2015
From: Chris Lumens <clumens at redhat.com>
Most of these can be gotten rid of by disabling the error messages. This
is okay because a lot of the errors only turn up under python3 (like when
pocketlint is running), but the code in question is only reachable under
python2.
---
examples/meh_test.py | 2 +-
meh/dump.py | 4 ++--
meh/handler.py | 1 +
meh/safe_string.py | 4 ++--
meh/ui/gui.py | 5 ++++-
meh/ui/text.py | 4 ++--
6 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/examples/meh_test.py b/examples/meh_test.py
index 16e81cb..5725b7d 100755
--- a/examples/meh_test.py
+++ b/examples/meh_test.py
@@ -17,7 +17,7 @@ def __init__(self):
self.binary_data = '\xff\xff\xfe'
if __name__ == "__main__":
- print "***Running python-meh test***"
+ print("***Running python-meh test***")
config = meh.Config(programName="myMehTest", programVersion="1.0-1",
programArch="noarch",
diff --git a/meh/dump.py b/meh/dump.py
index 9a9db09..c746e57 100644
--- a/meh/dump.py
+++ b/meh/dump.py
@@ -35,12 +35,12 @@
# Python 2/3 compatibilty
try:
- longtype = long
+ longtype = long # pylint: disable=undefined-variable
except NameError:
longtype = int
try:
- unitype = unicode
+ unitype = unicode # pylint: disable=undefined-variable
except NameError:
unitype = str
diff --git a/meh/handler.py b/meh/handler.py
index 939731c..6ae0a5d 100644
--- a/meh/handler.py
+++ b/meh/handler.py
@@ -55,6 +55,7 @@ def __init__(self, confObj, intfClass, exnClass):
self._exitcode = 10
self._exn = None
+ self.exnFile = None
self.exnText = ""
def _setExitCode(self, code):
diff --git a/meh/safe_string.py b/meh/safe_string.py
index 7fd0c56..714ce37 100644
--- a/meh/safe_string.py
+++ b/meh/safe_string.py
@@ -42,13 +42,13 @@ def __add__(self, other):
if PY > 2:
return SafeStr(str.__add__(self, str(other)))
- if not (isinstance(other, str) or isinstance(other, unicode)):
+ if not (isinstance(other, str) or isinstance(other, unicode)): # pylint: disable=undefined-variable
if hasattr(other, "__str__"):
other = other.__str__()
else:
other = "OMITTED OBJECT WITHOUT __str__ METHOD"
- if isinstance(other, unicode):
+ if isinstance(other, unicode): # pylint: disable=undefined-variable
ret = SafeStr(str.__add__(self, other.encode("utf-8")))
else:
try:
diff --git a/meh/ui/gui.py b/meh/ui/gui.py
index 4941898..d512f6f 100644
--- a/meh/ui/gui.py
+++ b/meh/ui/gui.py
@@ -67,6 +67,7 @@ def saveExceptionWindow(self, signature, *args, **kwargs):
class SaveExceptionWindow(AbstractSaveExceptionWindow):
def __init__(self, signature, *args, **kwargs):
+ AbstractSaveExceptionWindow.__init__(self, signature, *args, **kwargs)
self.signature = signature
def run(self, *args, **kwargs):
@@ -139,6 +140,8 @@ def on_main_window_deleted(self, *args):
class MessageWindow(AbstractMessageWindow):
def __init__(self, title, text, *args, **kwargs):
AbstractMessageWindow.__init__(self, title, text, *args, **kwargs)
+ self.rc = 0
+
self.dialog = Gtk.MessageDialog(buttons=Gtk.ButtonsType.OK,
type=Gtk.MessageType.INFO,
message_format=text)
@@ -154,7 +157,7 @@ def run(self, *args, **kwargs):
self.dialog.destroy()
class ExitWindow(MessageWindow):
- def __init__(self, title, text, *args, **kwargs):
+ def __init__(self, title, text, *args, **kwargs): # pylint: disable=super-init-not-called
self.dialog = Gtk.MessageDialog(buttons=Gtk.ButtonsType.NONE,
type=Gtk.MessageType.INFO,
message_format=text)
diff --git a/meh/ui/text.py b/meh/ui/text.py
index 4d99190..e4d99f2 100644
--- a/meh/ui/text.py
+++ b/meh/ui/text.py
@@ -30,7 +30,7 @@
if sys.version_info.major == 3:
raw_input_fn = input
else:
- raw_input_fn = raw_input
+ raw_input_fn = raw_input # pylint: disable=undefined-variable
import gettext
_ = lambda x: gettext.ldgettext("python-meh", x)
@@ -43,7 +43,7 @@ class IOHandler(object):
"""
- def __init__(self, in_func=raw_input_fn, out_func=print):
+ def __init__(self, in_func=raw_input_fn, out_func=print): # pylint: disable=used-before-assignment
"""
Constructor for the IOhandler class. Arguments can be used to override
default I/O functions with the custom ones.
--
To view this commit on github, visit https://github.com/rhinstaller/python-meh/commit/c39d20e82178647ed2f8cf93dd9056a70d071b13
More information about the anaconda-patches
mailing list