| Index: third_party/pylint/gui.py
|
| diff --git a/third_party/pylint/gui.py b/third_party/pylint/gui.py
|
| index fcc84e0038a5633b6f6d0509bd977e6044f2a7c0..b3edd28d46108a2fdfb3f6e894eeaa5c4a243479 100644
|
| --- a/third_party/pylint/gui.py
|
| +++ b/third_party/pylint/gui.py
|
| @@ -14,17 +14,24 @@
|
| # this program; if not, write to the Free Software Foundation, Inc.,
|
| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
| """Tkinker gui for pylint"""
|
| +from __future__ import print_function
|
|
|
| import os
|
| import sys
|
| import re
|
| -import Queue
|
| from threading import Thread
|
| -from Tkinter import (Tk, Frame, Listbox, Entry, Label, Button, Scrollbar,
|
| - Checkbutton, Radiobutton, IntVar, StringVar)
|
| -from Tkinter import (TOP, LEFT, RIGHT, BOTTOM, END, X, Y, BOTH, SUNKEN, W,
|
| - HORIZONTAL, DISABLED, NORMAL, W)
|
| -from tkFileDialog import askopenfilename, askdirectory
|
| +
|
| +import six
|
| +
|
| +from six.moves.tkinter import (
|
| + Tk, Frame, Listbox, Entry, Label, Button, Scrollbar,
|
| + Checkbutton, Radiobutton, IntVar, StringVar,
|
| + TOP, LEFT, RIGHT, BOTTOM, END, X, Y, BOTH, SUNKEN, W,
|
| + HORIZONTAL, DISABLED, NORMAL, W,
|
| +)
|
| +from six.moves.tkinter_tkfiledialog import (
|
| + askopenfilename, askdirectory,
|
| +)
|
|
|
| import pylint.lint
|
| from pylint.reporters.guireporter import GUIReporter
|
| @@ -86,7 +93,7 @@ class BasicStream(object):
|
| """finalize what the contents of the dict should look like before output"""
|
| for item in self.outdict:
|
| num_empty = self.outdict[item].count('')
|
| - for _ in xrange(num_empty):
|
| + for _ in range(num_empty):
|
| self.outdict[item].remove('')
|
| if self.outdict[item]:
|
| self.outdict[item].pop(0)
|
| @@ -97,7 +104,7 @@ class BasicStream(object):
|
| self.gui.tabs = self.outdict
|
| try:
|
| self.gui.rating.set(self.outdict['Global evaluation'][0])
|
| - except:
|
| + except KeyError:
|
| self.gui.rating.set('Error')
|
| self.gui.refresh_results_window()
|
|
|
| @@ -118,7 +125,7 @@ class LintGui(object):
|
| #reporter
|
| self.reporter = None
|
| #message queue for output from reporter
|
| - self.msg_queue = Queue.Queue()
|
| + self.msg_queue = six.moves.queue.Queue()
|
| self.msgs = []
|
| self.visible_msgs = []
|
| self.filenames = []
|
| @@ -321,7 +328,7 @@ class LintGui(object):
|
| self.txt_module.focus_set()
|
|
|
|
|
| - def select_recent_file(self, event):
|
| + def select_recent_file(self, event): # pylint: disable=unused-argument
|
| """adds the selected file in the history listbox to the Module box"""
|
| if not self.showhistory.size():
|
| return
|
| @@ -352,7 +359,7 @@ class LintGui(object):
|
| try:
|
| for res in self.tabs[self.box.get()]:
|
| self.results.insert(END, res)
|
| - except:
|
| + except KeyError:
|
| pass
|
|
|
| def process_incoming(self):
|
| @@ -375,7 +382,7 @@ class LintGui(object):
|
| fg_color = COLORS.get(msg_str[:3], 'black')
|
| self.lb_messages.itemconfigure(END, fg=fg_color)
|
|
|
| - except Queue.Empty:
|
| + except six.moves.queue.Empty:
|
| pass
|
| return True
|
|
|
| @@ -395,7 +402,7 @@ class LintGui(object):
|
| """quit the application"""
|
| self.root.quit()
|
|
|
| - def halt(self):
|
| + def halt(self): # pylint: disable=no-self-use
|
| """program halt placeholder"""
|
| return
|
|
|
| @@ -476,7 +483,7 @@ class LintGui(object):
|
|
|
| self.root.configure(cursor='')
|
|
|
| - def show_sourcefile(self, event=None):
|
| + def show_sourcefile(self, event=None): # pylint: disable=unused-argument
|
| selected = self.lb_messages.curselection()
|
| if not selected:
|
| return
|
| @@ -503,7 +510,7 @@ def lint_thread(module, reporter, gui):
|
| def Run(args):
|
| """launch pylint gui from args"""
|
| if args:
|
| - print 'USAGE: pylint-gui\n launch a simple pylint gui using Tk'
|
| + print('USAGE: pylint-gui\n launch a simple pylint gui using Tk')
|
| sys.exit(1)
|
| gui = LintGui()
|
| gui.mainloop()
|
|
|