mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
Cleanup:
* Remove unused imports * Convert some more 1/0 to True/False * Shorten up a long line
This commit is contained in:
parent
539594f2f5
commit
6453c1f218
1 changed files with 5 additions and 9 deletions
|
@ -17,9 +17,6 @@ XXX Redesign this interface (yet again) as follows:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import imp
|
|
||||||
import tkMessageBox
|
import tkMessageBox
|
||||||
|
|
||||||
indent_message = """Error: Inconsistent indentation detected!
|
indent_message = """Error: Inconsistent indentation detected!
|
||||||
|
@ -69,15 +66,14 @@ class ScriptBinding:
|
||||||
try:
|
try:
|
||||||
tabnanny.process_tokens(tokenize.generate_tokens(f.readline))
|
tabnanny.process_tokens(tokenize.generate_tokens(f.readline))
|
||||||
except tokenize.TokenError, msg:
|
except tokenize.TokenError, msg:
|
||||||
self.errorbox("Token error",
|
self.errorbox("Token error", "Token error:\n%s" % msg)
|
||||||
"Token error:\n%s" % str(msg))
|
return False
|
||||||
return 0
|
|
||||||
except tabnanny.NannyNag, nag:
|
except tabnanny.NannyNag, nag:
|
||||||
# The error messages from tabnanny are too confusing...
|
# The error messages from tabnanny are too confusing...
|
||||||
self.editwin.gotoline(nag.get_lineno())
|
self.editwin.gotoline(nag.get_lineno())
|
||||||
self.errorbox("Tab/space error", indent_message)
|
self.errorbox("Tab/space error", indent_message)
|
||||||
return 0
|
return False
|
||||||
return 1
|
return True
|
||||||
|
|
||||||
def checksyntax(self, filename):
|
def checksyntax(self, filename):
|
||||||
f = open(filename, 'r')
|
f = open(filename, 'r')
|
||||||
|
@ -103,7 +99,7 @@ class ScriptBinding:
|
||||||
self.editwin.gotoline(lineno)
|
self.editwin.gotoline(lineno)
|
||||||
self.errorbox("Syntax error",
|
self.errorbox("Syntax error",
|
||||||
"There's an error in your program:\n" + msg)
|
"There's an error in your program:\n" + msg)
|
||||||
return 1
|
return True
|
||||||
|
|
||||||
def run_script_event(self, event):
|
def run_script_event(self, event):
|
||||||
filename = self.getfilename()
|
filename = self.getfilename()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue