diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-09-11 20:36:02 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-09-11 20:36:02 (GMT) |
commit | aaab30e00cc3e8d90c71b8657c284feeb4ac1413 (patch) | |
tree | d055e0bd374770014d9afdff1b961418b1828584 /Tools/idle | |
parent | 6a0477b099560a452e37fe77c3850bf232487c16 (diff) | |
download | cpython-aaab30e00cc3e8d90c71b8657c284feeb4ac1413.zip cpython-aaab30e00cc3e8d90c71b8657c284feeb4ac1413.tar.gz cpython-aaab30e00cc3e8d90c71b8657c284feeb4ac1413.tar.bz2 |
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)
This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.
Diffstat (limited to 'Tools/idle')
-rw-r--r-- | Tools/idle/AutoIndent.py | 16 | ||||
-rw-r--r-- | Tools/idle/Bindings.py | 1 | ||||
-rw-r--r-- | Tools/idle/CallTips.py | 2 | ||||
-rw-r--r-- | Tools/idle/ClassBrowser.py | 3 | ||||
-rw-r--r-- | Tools/idle/ColorDelegator.py | 3 | ||||
-rw-r--r-- | Tools/idle/EditorWindow.py | 15 | ||||
-rw-r--r-- | Tools/idle/FormatParagraph.py | 21 | ||||
-rw-r--r-- | Tools/idle/GrepDialog.py | 1 | ||||
-rw-r--r-- | Tools/idle/IdleHistory.py | 12 | ||||
-rw-r--r-- | Tools/idle/MultiScrolledLists.py | 1 | ||||
-rw-r--r-- | Tools/idle/OldStackViewer.py | 3 | ||||
-rw-r--r-- | Tools/idle/ParenMatch.py | 6 | ||||
-rw-r--r-- | Tools/idle/PyParse.py | 49 | ||||
-rw-r--r-- | Tools/idle/PyShell.py | 4 | ||||
-rw-r--r-- | Tools/idle/ReplaceDialog.py | 1 | ||||
-rw-r--r-- | Tools/idle/SearchDialogBase.py | 1 | ||||
-rw-r--r-- | Tools/idle/SearchEngine.py | 5 | ||||
-rw-r--r-- | Tools/idle/StackViewer.py | 3 | ||||
-rw-r--r-- | Tools/idle/TreeWidget.py | 1 | ||||
-rw-r--r-- | Tools/idle/UndoDelegator.py | 2 | ||||
-rw-r--r-- | Tools/idle/eventparse.py | 5 |
21 files changed, 65 insertions, 90 deletions
diff --git a/Tools/idle/AutoIndent.py b/Tools/idle/AutoIndent.py index f8bb847..7bc195b 100644 --- a/Tools/idle/AutoIndent.py +++ b/Tools/idle/AutoIndent.py @@ -1,4 +1,3 @@ -import string #from Tkinter import TclError #import tkMessageBox #import tkSimpleDialog @@ -168,15 +167,15 @@ class AutoIndent: return "break" # Ick. It may require *inserting* spaces if we back up over a # tab character! This is written to be clear, not fast. - expand, tabwidth = string.expandtabs, self.tabwidth - have = len(expand(chars, tabwidth)) + tabwidth = self.tabwidth + have = len(chars.expandtabs(tabwidth)) assert have > 0 want = ((have - 1) // self.indentwidth) * self.indentwidth ncharsdeleted = 0 while 1: chars = chars[:-1] ncharsdeleted = ncharsdeleted + 1 - have = len(expand(chars, tabwidth)) + have = len(chars.expandtabs(tabwidth)) if have <= want or chars[-1] not in " \t": break text.undo_block_start() @@ -210,8 +209,7 @@ class AutoIndent: if self.usetabs: pad = '\t' else: - effective = len(string.expandtabs(prefix, - self.tabwidth)) + effective = len(prefix.expandtabs(self.tabwidth)) n = self.indentwidth pad = ' ' * (n - effective % n) text.insert("insert", pad) @@ -376,7 +374,7 @@ class AutoIndent: head, tail, chars, lines = self.get_region() tabwidth = self._asktabwidth() for pos in range(len(lines)): - lines[pos] = string.expandtabs(lines[pos], tabwidth) + lines[pos] = lines[pos].expandtabs(tabwidth) self.set_region(head, tail, chars, lines) def toggle_tabs_event(self, event): @@ -417,12 +415,12 @@ class AutoIndent: head = text.index("insert linestart") tail = text.index("insert lineend +1c") chars = text.get(head, tail) - lines = string.split(chars, "\n") + lines = chars.split("\n") return head, tail, chars, lines def set_region(self, head, tail, chars, lines): text = self.text - newchars = string.join(lines, "\n") + newchars = "\n".join(lines) if newchars == chars: text.bell() return diff --git a/Tools/idle/Bindings.py b/Tools/idle/Bindings.py index 8bf0e70..a7d3802 100644 --- a/Tools/idle/Bindings.py +++ b/Tools/idle/Bindings.py @@ -6,7 +6,6 @@ # Debug menu here, which is only present in the PythonShell window. import sys -import string from keydefs import * menudefs = [ diff --git a/Tools/idle/CallTips.py b/Tools/idle/CallTips.py index dc25083..d8445a4 100644 --- a/Tools/idle/CallTips.py +++ b/Tools/idle/CallTips.py @@ -141,7 +141,7 @@ def get_arg_text(ob): items.append("...") if fob.func_code.co_flags & 0x8: items.append("***") - argText = string.join(items , ", ") + argText = ", ".join(items) argText = "(%s)" % argText except: pass diff --git a/Tools/idle/ClassBrowser.py b/Tools/idle/ClassBrowser.py index 19f3b7e..6e4b2a3 100644 --- a/Tools/idle/ClassBrowser.py +++ b/Tools/idle/ClassBrowser.py @@ -12,7 +12,6 @@ XXX TO DO: import os import sys -import string import pyclbr # XXX Patch pyclbr with dummies if it's vintage Python 1.5.2: @@ -117,7 +116,7 @@ class ModuleBrowserTreeItem(TreeItem): if sup.module != cl.module: sname = "%s.%s" % (sup.module, sname) supers.append(sname) - s = s + "(%s)" % string.join(supers, ", ") + s = s + "(%s)" % ", ".join(supers) items.append((cl.lineno, s)) self.classes[s] = cl items.sort() diff --git a/Tools/idle/ColorDelegator.py b/Tools/idle/ColorDelegator.py index 3d2ecef..059108f 100644 --- a/Tools/idle/ColorDelegator.py +++ b/Tools/idle/ColorDelegator.py @@ -1,5 +1,4 @@ import time -import string import re import keyword from Tkinter import * @@ -14,7 +13,7 @@ DEBUG = 0 def any(name, list): - return "(?P<%s>" % name + string.join(list, "|") + ")" + return "(?P<%s>" % name + "|".join(list) + ")" def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py index e8b63ff..c0ae556 100644 --- a/Tools/idle/EditorWindow.py +++ b/Tools/idle/EditorWindow.py @@ -1,6 +1,5 @@ import sys import os -import string import re import imp from Tkinter import * @@ -221,7 +220,7 @@ class EditorWindow: self.text.after_idle(self.set_line_and_column) def set_line_and_column(self, event=None): - line, column = string.split(self.text.index(INSERT), '.') + line, column = self.text.index(INSERT).split('.') self.status_bar.set_label('column', 'Col: %s' % column) self.status_bar.set_label('line', 'Ln: %s' % line) @@ -344,14 +343,14 @@ class EditorWindow: except TclError: name = "" else: - name = string.strip(name) + name = name.strip() if not name: name = tkSimpleDialog.askstring("Module", "Enter the name of a Python module\n" "to search on sys.path and open:", parent=self.text) if name: - name = string.strip(name) + name = name.strip() if not name: return # XXX Ought to insert current file's directory in front of path @@ -408,7 +407,7 @@ class EditorWindow: f.close() except IOError: return False - return line[:2] == '#!' and string.find(line, 'python') >= 0 + return line.startswith('#!') and 'python' in line def close_hook(self): if self.flist: @@ -580,7 +579,7 @@ class EditorWindow: if keydefs: self.apply_bindings(keydefs) for vevent in keydefs.keys(): - methodname = string.replace(vevent, "-", "_") + methodname = vevent.replace("-", "_") while methodname[:1] == '<': methodname = methodname[1:] while methodname[-1:] == '>': @@ -700,7 +699,7 @@ class EditorWindow: def prepstr(s): # Helper to extract the underscore from a string, e.g. # prepstr("Co_py") returns (2, "Copy"). - i = string.find(s, '_') + i = s.find('_') if i >= 0: s = s[:i] + s[i+1:] return i, s @@ -717,7 +716,7 @@ def get_accelerator(keydefs, event): if not keylist: return "" s = keylist[0] - s = re.sub(r"-[a-z]\b", lambda m: string.upper(m.group()), s) + s = re.sub(r"-[a-z]\b", lambda m: m.group().upper(), s) s = re.sub(r"\b\w+\b", lambda m: keynames.get(m.group(), m.group()), s) s = re.sub("Key-", "", s) s = re.sub("Control-", "Ctrl-", s) diff --git a/Tools/idle/FormatParagraph.py b/Tools/idle/FormatParagraph.py index ea18cc0..c1bc769 100644 --- a/Tools/idle/FormatParagraph.py +++ b/Tools/idle/FormatParagraph.py @@ -14,7 +14,6 @@ # spaces, they will not be considered part of the same block. # * Fancy comments, like this bulleted list, arent handled :-) -import string import re class FormatParagraph: @@ -50,14 +49,14 @@ class FormatParagraph: find_paragraph(text, text.index("insert")) if comment_header: # Reformat the comment lines - convert to text sans header. - lines = string.split(data, "\n") + lines = data.split("\n") lines = map(lambda st, l=len(comment_header): st[l:], lines) - data = string.join(lines, "\n") + data = "\n".join(lines) # Reformat to 70 chars or a 20 char width, whichever is greater. format_width = max(70-len(comment_header), 20) newdata = reformat_paragraph(data, format_width) # re-split and re-insert the comment header. - newdata = string.split(newdata, "\n") + newdata = newdata.split("\n") # If the block ends in a \n, we dont want the comment # prefix inserted after it. (Im not sure it makes sense to # reformat a comment block that isnt made of complete @@ -68,7 +67,7 @@ class FormatParagraph: block_suffix = "\n" newdata = newdata[:-1] builder = lambda item, prefix=comment_header: prefix+item - newdata = string.join(map(builder, newdata), '\n') + block_suffix + newdata = '\n'.join(map(builder, newdata)) + block_suffix else: # Just a normal text format newdata = reformat_paragraph(data) @@ -84,7 +83,7 @@ class FormatParagraph: text.see("insert") def find_paragraph(text, mark): - lineno, col = map(int, string.split(mark, ".")) + lineno, col = map(int, mark.split(".")) line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) while text.compare("%d.0" % lineno, "<", "end") and is_all_white(line): lineno = lineno + 1 @@ -109,7 +108,7 @@ def find_paragraph(text, mark): return first, last, comment_header, text.get(first, last) def reformat_paragraph(data, limit=70): - lines = string.split(data, "\n") + lines = data.split("\n") i = 0 n = len(lines) while i < n and is_all_white(lines[i]): @@ -130,18 +129,18 @@ def reformat_paragraph(data, limit=70): word = words[j] if not word: continue # Can happen when line ends in whitespace - if len(string.expandtabs(partial + word)) > limit and \ + if len((partial + word).expandtabs()) > limit and \ partial != indent1: - new.append(string.rstrip(partial)) + new.append(partial.rstrip()) partial = indent2 partial = partial + word + " " if j+1 < len(words) and words[j+1] != " ": partial = partial + " " i = i+1 - new.append(string.rstrip(partial)) + new.append(partial.rstrip()) # XXX Should reformat remaining paragraphs as well new.extend(lines[i:]) - return string.join(new, "\n") + return "\n".join(new) def is_all_white(line): return re.match(r"^\s*$", line) is not None diff --git a/Tools/idle/GrepDialog.py b/Tools/idle/GrepDialog.py index 61c77c3..ed5a979 100644 --- a/Tools/idle/GrepDialog.py +++ b/Tools/idle/GrepDialog.py @@ -1,4 +1,3 @@ -import string import os import re import fnmatch diff --git a/Tools/idle/IdleHistory.py b/Tools/idle/IdleHistory.py index b882c92..46e70e1 100644 --- a/Tools/idle/IdleHistory.py +++ b/Tools/idle/IdleHistory.py @@ -1,5 +1,3 @@ -import string - class History: def __init__(self, text, output_sep = "\n"): @@ -22,11 +20,11 @@ class History: def _get_source(self, start, end): # Get source code from start index to end index. Lines in the # text control may be separated by sys.ps2 . - lines = string.split(self.text.get(start, end), self.output_sep) - return string.join(lines, "\n") + lines = self.text.get(start, end).split(self.output_sep) + return "\n".join(lines) def _put_source(self, where, source): - output = string.join(string.split(source, "\n"), self.output_sep) + output = self.output_sep.join(source.split("\n")) self.text.insert(where, output) def history_do(self, reverse): @@ -68,7 +66,7 @@ class History: self.history_prefix = prefix def history_store(self, source): - source = string.strip(source) + source = source.strip() if len(source) > 2: # avoid duplicates try: @@ -80,7 +78,7 @@ class History: self.history_prefix = None def recall(self, s): - s = string.strip(s) + s = s.strip() self.text.tag_remove("sel", "1.0", "end") self.text.delete("iomark", "end-1c") self.text.mark_set("insert", "end-1c") diff --git a/Tools/idle/MultiScrolledLists.py b/Tools/idle/MultiScrolledLists.py index 6c140df..6398b86 100644 --- a/Tools/idle/MultiScrolledLists.py +++ b/Tools/idle/MultiScrolledLists.py @@ -3,7 +3,6 @@ # the right list displays the substructure of the selected item # in the left list. -import string from Tkinter import * from WindowList import ListedToplevel from Separator import HSeparator diff --git a/Tools/idle/OldStackViewer.py b/Tools/idle/OldStackViewer.py index 2fa4127..4f295e8 100644 --- a/Tools/idle/OldStackViewer.py +++ b/Tools/idle/OldStackViewer.py @@ -1,4 +1,3 @@ -import string import sys import os from Tkinter import * @@ -121,7 +120,7 @@ class StackViewer(ScrolledList): filename = code.co_filename funcname = code.co_name sourceline = linecache.getline(filename, lineno) - sourceline = string.strip(sourceline) + sourceline = sourceline.strip() if funcname in ("?", "", None): item = "%s, line %d: %s" % (modname, lineno, sourceline) else: diff --git a/Tools/idle/ParenMatch.py b/Tools/idle/ParenMatch.py index 17d76c2..1be60c0 100644 --- a/Tools/idle/ParenMatch.py +++ b/Tools/idle/ParenMatch.py @@ -10,8 +10,6 @@ We'll have to fix IDLE to do something reasonable when two or more extensions what to capture the same event. """ -import string - import PyParse from AutoIndent import AutoIndent, index2line from IdleConf import idleconf @@ -177,10 +175,10 @@ class LastOpenBracketFinder: if i is None \ or keysym_type(buf[i]) != right_keysym_type: return None - lines_back = string.count(buf[i:], "\n") - 1 + lines_back = buf[i:].count("\n") - 1 # subtract one for the "\n" added to please the parser upto_open = buf[:i] - j = string.rfind(upto_open, "\n") + 1 # offset of column 0 of line + j = upto_open.rfind("\n") + 1 # offset of column 0 of line offset = i - j return "%d.%d" % (lno - lines_back, offset) diff --git a/Tools/idle/PyParse.py b/Tools/idle/PyParse.py index c8212b2..422a86c 100644 --- a/Tools/idle/PyParse.py +++ b/Tools/idle/PyParse.py @@ -1,4 +1,3 @@ -import string import re import sys @@ -7,7 +6,7 @@ C_NONE, C_BACKSLASH, C_STRING, C_BRACKET = range(4) if 0: # for throwaway debugging output def dump(*stuff): - sys.__stdout__.write(string.join(map(str, stuff), " ") + "\n") + sys.__stdout__.write(" ".join(map(str, stuff)) + "\n") # Find what looks like the start of a popular stmt. @@ -103,7 +102,7 @@ for ch in ")}]": _tran[ord(ch)] = ')' for ch in "\"'\\\n#": _tran[ord(ch)] = ch -_tran = string.join(_tran, '') +_tran = ''.join(_tran) del ch try: @@ -153,13 +152,12 @@ class Parser: # Python 1.5.2 (#0, Apr 13 1999, ... def find_good_parse_start(self, use_ps1, is_char_in_string=None, - _rfind=string.rfind, _synchre=_synchre): str, pos = self.str, None if use_ps1: # shell window ps1 = '\n' + sys.ps1 - i = _rfind(str, ps1) + i = str.rfind(ps1) if i >= 0: pos = i + len(ps1) # make it look like there's a newline instead @@ -178,10 +176,10 @@ class Parser: # bumped to a legitimate synch point. limit = len(str) for tries in range(5): - i = _rfind(str, ":\n", 0, limit) + i = str.rfind(":\n", 0, limit) if i < 0: break - i = _rfind(str, '\n', 0, i) + 1 # start of colon line + i = str.rfind('\n', 0, i) + 1 # start of colon line m = _synchre(str, i, limit) if m and not is_char_in_string(m.start()): pos = m.start() @@ -226,7 +224,7 @@ class Parser: # based) of the non-continuation lines. # Creates self.{goodlines, continuation}. - def _study1(self, _replace=string.replace, _find=string.find): + def _study1(self): if self.study_level >= 1: return self.study_level = 1 @@ -236,12 +234,12 @@ class Parser: # uninteresting characters. This can cut the number of chars # by a factor of 10-40, and so greatly speed the following loop. str = self.str - str = string.translate(str, _tran) - str = _replace(str, 'xxxxxxxx', 'x') - str = _replace(str, 'xxxx', 'x') - str = _replace(str, 'xx', 'x') - str = _replace(str, 'xx', 'x') - str = _replace(str, '\nx', '\n') + str = str.translate(_tran) + str = str.replace('xxxxxxxx', 'x') + str = str.replace('xxxx', 'x') + str = str.replace('xx', 'x') + str = str.replace('xx', 'x') + str = str.replace('\nx', '\n') # note that replacing x\n with \n would be incorrect, because # x may be preceded by a backslash @@ -322,7 +320,7 @@ class Parser: if ch == '#': # consume the comment - i = _find(str, '\n', i) + i = str.find('\n', i) assert i >= 0 continue @@ -363,8 +361,7 @@ class Parser: # self.lastopenbracketpos # if continuation is C_BRACKET, index of last open bracket - def _study2(self, _rfind=string.rfind, _find=string.find, - _ws=string.whitespace): + def _study2(self): if self.study_level >= 2: return self._study1() @@ -381,7 +378,7 @@ class Parser: q = p for nothing in range(goodlines[i-1], goodlines[i]): # tricky: sets p to 0 if no preceding newline - p = _rfind(str, '\n', 0, p-1) + 1 + p = str.rfind('\n', 0, p-1) + 1 # The stmt str[p:q] isn't a continuation, but may be blank # or a non-indenting comment line. if _junkre(str, p): @@ -444,7 +441,7 @@ class Parser: if ch == '#': # consume comment and trailing newline - p = _find(str, '\n', p, q) + 1 + p = str.find('\n', p, q) + 1 assert p > 0 continue @@ -465,13 +462,13 @@ class Parser: # Assuming continuation is C_BRACKET, return the number # of spaces the next line should be indented. - def compute_bracket_indent(self, _find=string.find): + def compute_bracket_indent(self): self._study2() assert self.continuation == C_BRACKET j = self.lastopenbracketpos str = self.str n = len(str) - origi = i = string.rfind(str, '\n', 0, j) + 1 + origi = i = str.rfind('\n', 0, j) + 1 j = j+1 # one beyond open bracket # find first list item; set i to start of its line while j < n: @@ -482,7 +479,7 @@ class Parser: break else: # this line is junk; advance to next line - i = j = _find(str, '\n', j) + 1 + i = j = str.find('\n', j) + 1 else: # nothing interesting follows the bracket; # reproduce the bracket line's indentation + a level @@ -490,8 +487,7 @@ class Parser: while str[j] in " \t": j = j+1 extra = self.indentwidth - return len(string.expandtabs(str[i:j], - self.tabwidth)) + extra + return len(str[i:j].expandtabs(self.tabwidth)) + extra # Return number of physical lines in last stmt (whether or not # it's an interesting stmt! this is intended to be called when @@ -517,7 +513,7 @@ class Parser: # See whether the initial line starts an assignment stmt; i.e., # look for an = operator - endpos = string.find(str, '\n', startpos) + 1 + endpos = str.find('\n', startpos) + 1 found = level = 0 while i < endpos: ch = str[i] @@ -553,8 +549,7 @@ class Parser: while str[i] not in " \t\n": i = i+1 - return len(string.expandtabs(str[self.stmt_start : - i], + return len(str[self.stmt_start:i].expandtabs(\ self.tabwidth)) + 1 # Return the leading whitespace on the initial line of the last diff --git a/Tools/idle/PyShell.py b/Tools/idle/PyShell.py index e71a9a1..7fd28eb 100644 --- a/Tools/idle/PyShell.py +++ b/Tools/idle/PyShell.py @@ -208,7 +208,7 @@ class ModifiedInterpreter(InteractiveInterpreter): # Stuff source in the filename cache filename = "<pyshell#%d>" % self.gid self.gid = self.gid + 1 - lines = string.split(source, "\n") + lines = source.split("\n") linecache.cache[filename] = len(source)+1, 0, lines, filename return filename @@ -582,7 +582,7 @@ class PyShell(OutputWindow): # If we're in the current input and there's only whitespace # beyond the cursor, erase that whitespace first s = self.text.get("insert", "end-1c") - if s and not string.strip(s): + if s and not s.strip(): self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point diff --git a/Tools/idle/ReplaceDialog.py b/Tools/idle/ReplaceDialog.py index 3d71703..cc8b1a6 100644 --- a/Tools/idle/ReplaceDialog.py +++ b/Tools/idle/ReplaceDialog.py @@ -1,4 +1,3 @@ -import string import os import re import fnmatch diff --git a/Tools/idle/SearchDialogBase.py b/Tools/idle/SearchDialogBase.py index faf5269..d5f13db 100644 --- a/Tools/idle/SearchDialogBase.py +++ b/Tools/idle/SearchDialogBase.py @@ -1,4 +1,3 @@ -import string from Tkinter import * class SearchDialogBase: diff --git a/Tools/idle/SearchEngine.py b/Tools/idle/SearchEngine.py index e379751..cc40a00 100644 --- a/Tools/idle/SearchEngine.py +++ b/Tools/idle/SearchEngine.py @@ -1,4 +1,3 @@ -import string import re from Tkinter import * import tkMessageBox @@ -175,7 +174,7 @@ class SearchEngine: wrapped = 1 wrap = 0 pos = text.index("end-1c") - line, col = map(int, string.split(pos, ".")) + line, col = map(int, pos.split(".")) chars = text.get("%d.0" % line, "%d.0" % (line+1)) col = len(chars) - 1 return None @@ -217,5 +216,5 @@ def get_selection(text): # Helper to parse a text index into a (line, col) tuple. def get_line_col(index): - line, col = map(int, string.split(index, ".")) # Fails on invalid index + line, col = map(int, index.split(".")) # Fails on invalid index return line, col diff --git a/Tools/idle/StackViewer.py b/Tools/idle/StackViewer.py index d70658b..7f57c0d 100644 --- a/Tools/idle/StackViewer.py +++ b/Tools/idle/StackViewer.py @@ -1,6 +1,5 @@ import os import sys -import string import linecache from TreeWidget import TreeNode, TreeItem, ScrolledCanvas @@ -50,7 +49,7 @@ class FrameTreeItem(TreeItem): filename = code.co_filename funcname = code.co_name sourceline = linecache.getline(filename, lineno) - sourceline = string.strip(sourceline) + sourceline = sourceline.strip() if funcname in ("?", "", None): item = "%s, line %d: %s" % (modname, lineno, sourceline) else: diff --git a/Tools/idle/TreeWidget.py b/Tools/idle/TreeWidget.py index 37bc58f..d713264 100644 --- a/Tools/idle/TreeWidget.py +++ b/Tools/idle/TreeWidget.py @@ -16,7 +16,6 @@ import os import sys -import string from Tkinter import * import imp diff --git a/Tools/idle/UndoDelegator.py b/Tools/idle/UndoDelegator.py index 3ef14c3..54b0851 100644 --- a/Tools/idle/UndoDelegator.py +++ b/Tools/idle/UndoDelegator.py @@ -311,7 +311,7 @@ class CommandSequence(Command): strs = [] for cmd in self.cmds: strs.append(" " + `cmd`) - return s + "(\n" + string.join(strs, ",\n") + "\n)" + return s + "(\n" + ",\n".join(strs) + "\n)" def __len__(self): return len(self.cmds) diff --git a/Tools/idle/eventparse.py b/Tools/idle/eventparse.py index cb2028d..784dc90 100644 --- a/Tools/idle/eventparse.py +++ b/Tools/idle/eventparse.py @@ -5,7 +5,6 @@ import re import sys import os -import string import getopt import glob import fileinput @@ -25,7 +24,7 @@ def main(): if not sublist: sublist.append('file %s' % fileinput.filename()) sublist.append('line %d' % fileinput.lineno()) - sublist.append(string.strip(line[2:-1])) + sublist.append(line[2:-1].strip()) else: if sublist: hits.append(sublist) @@ -37,7 +36,7 @@ def main(): for sublist in hits: d = {} for line in sublist: - words = string.split(line, None, 1) + words = line.split(None, 1) if len(words) != 2: continue tag = words[0] |