diff options
author | Collin Winter <collinw@gmail.com> | 2007-07-17 20:59:35 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-07-17 20:59:35 (GMT) |
commit | 6f2df4d5e193d54244b0c2de91ef0ab1604b9243 (patch) | |
tree | 5e172400da7561eb4bb8fafc62c8cab511d74dad /Demo/tkinter/guido | |
parent | a8c360ee76fb76902a2e2140fbb38d4b06b2d9fb (diff) | |
download | cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.zip cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.gz cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.bz2 |
Run 2to3 over the Demo/ directory to shut up parse errors from 2to3 about lingering print statements.
Diffstat (limited to 'Demo/tkinter/guido')
-rwxr-xr-x | Demo/tkinter/guido/AttrDialog.py | 22 | ||||
-rwxr-xr-x | Demo/tkinter/guido/ManPage.py | 4 | ||||
-rwxr-xr-x | Demo/tkinter/guido/ShellWindow.py | 2 | ||||
-rwxr-xr-x | Demo/tkinter/guido/dialog.py | 4 | ||||
-rwxr-xr-x | Demo/tkinter/guido/mbox.py | 6 | ||||
-rwxr-xr-x | Demo/tkinter/guido/rmt.py | 2 | ||||
-rwxr-xr-x | Demo/tkinter/guido/solitaire.py | 4 | ||||
-rw-r--r-- | Demo/tkinter/guido/sortvisu.py | 2 | ||||
-rw-r--r-- | Demo/tkinter/guido/ss1.py | 28 | ||||
-rwxr-xr-x | Demo/tkinter/guido/svkill.py | 2 | ||||
-rwxr-xr-x | Demo/tkinter/guido/tkman.py | 8 | ||||
-rwxr-xr-x | Demo/tkinter/guido/wish.py | 4 |
12 files changed, 43 insertions, 45 deletions
diff --git a/Demo/tkinter/guido/AttrDialog.py b/Demo/tkinter/guido/AttrDialog.py index d8b2571..98bdd14 100755 --- a/Demo/tkinter/guido/AttrDialog.py +++ b/Demo/tkinter/guido/AttrDialog.py @@ -112,7 +112,7 @@ class Dialog: def addchoices(self): self.choices = {} list = [] - for k, dc in self.options.items(): + for k, dc in list(self.options.items()): list.append((k, dc)) list.sort() for k, (d, c) in list: @@ -157,7 +157,7 @@ class PackDialog(Dialog): try: self.dialog.widget.pack(**{self.option: self.current}) except TclError as msg: - print msg + print(msg) self.refresh() class booleanoption(packoption, BooleanOption): pass @@ -213,7 +213,7 @@ class RemotePackDialog(PackDialog): 'info', self.widget)) except TclError as msg: - print msg + print(msg) return dict = {} for i in range(0, len(words), 2): @@ -240,7 +240,7 @@ class RemotePackDialog(PackDialog): self.dialog.master.tk.merge( self.current)) except TclError as msg: - print msg + print(msg) self.refresh() class booleanoption(remotepackoption, BooleanOption): pass @@ -256,11 +256,11 @@ class WidgetDialog(Dialog): Dialog.__init__(self, widget) def fixclasses(self): - if self.addclasses.has_key(self.klass): + if self.klass in self.addclasses: classes = {} for c in (self.classes, self.addclasses[self.klass]): - for k in c.keys(): + for k in list(c.keys()): classes[k] = c[k] self.classes = classes @@ -273,7 +273,7 @@ class WidgetDialog(Dialog): def update(self): self.current = {} self.options = {} - for k, v in self.configuration.items(): + for k, v in list(self.configuration.items()): if len(v) > 4: self.current[k] = v[4] self.options[k] = v[3], v[2] # default, klass @@ -286,7 +286,7 @@ class WidgetDialog(Dialog): try: self.dialog.widget[self.option] = self.current except TclError as msg: - print msg + print(msg) self.refresh() class booleanoption(widgetoption, BooleanOption): pass @@ -375,7 +375,7 @@ class RemoteWidgetDialog(WidgetDialog): self.widget, 'config')) except TclError as msg: - print msg + print(msg) return dict = {} for item in items: @@ -399,7 +399,7 @@ class RemoteWidgetDialog(WidgetDialog): '-'+self.option, self.current) except TclError as msg: - print msg + print(msg) self.refresh() class booleanoption(remotewidgetoption, BooleanOption): pass @@ -446,6 +446,6 @@ def opendialogs(e): try: RemotePackDialog(list, list.app, widget) except TclError as msg: - print msg + print(msg) test() diff --git a/Demo/tkinter/guido/ManPage.py b/Demo/tkinter/guido/ManPage.py index b189b64..1266f1c 100755 --- a/Demo/tkinter/guido/ManPage.py +++ b/Demo/tkinter/guido/ManPage.py @@ -75,7 +75,7 @@ class EditableManPage(ScrolledText): # Initialize parsing from a particular file -- must not be busy def _startparser(self, fp): if self.busy(): - raise RuntimeError, 'startparser: still busy' + raise RuntimeError('startparser: still busy') fp.fileno() # Test for file-ness self.fp = fp self.lineno = 0 @@ -90,7 +90,7 @@ class EditableManPage(ScrolledText): # End parsing -- must be busy, need not be at EOF def _endparser(self): if not self.busy(): - raise RuntimeError, 'endparser: not busy' + raise RuntimeError('endparser: not busy') if self.buffer: self._parseline('') try: diff --git a/Demo/tkinter/guido/ShellWindow.py b/Demo/tkinter/guido/ShellWindow.py index 104e06d..d7e0a0e 100755 --- a/Demo/tkinter/guido/ShellWindow.py +++ b/Demo/tkinter/guido/ShellWindow.py @@ -37,7 +37,7 @@ class ShellWindow(ScrolledText): if not data: self.tk.deletefilehandler(file) pid, sts = os.waitpid(self.pid, 0) - print 'pid', pid, 'status', sts + print('pid', pid, 'status', sts) self.pid = None detail = sts>>8 cause = sts & 0xff diff --git a/Demo/tkinter/guido/dialog.py b/Demo/tkinter/guido/dialog.py index 50d84b9..426eca4 100755 --- a/Demo/tkinter/guido/dialog.py +++ b/Demo/tkinter/guido/dialog.py @@ -81,7 +81,7 @@ def go(): '', -1, 'OK') - print 'pressed button', i + print('pressed button', i) i = dialog(mainWidget, 'File Modified', 'File "tcl.h" has been modified since ' @@ -92,7 +92,7 @@ def go(): 'Save File', 'Discard Changes', 'Return To Editor') - print 'pressed button', i + print('pressed button', i) def test(): import sys diff --git a/Demo/tkinter/guido/mbox.py b/Demo/tkinter/guido/mbox.py index 47c38b9..88b0b89 100755 --- a/Demo/tkinter/guido/mbox.py +++ b/Demo/tkinter/guido/mbox.py @@ -28,7 +28,7 @@ def main(): try: opts, args = getopt.getopt(sys.argv[1:], '') except getopt.error as msg: - print msg + print(msg) sys.exit(2) for arg in args: if arg[:1] == '+': @@ -278,8 +278,6 @@ def rescan(): scanbox.insert('end', line) def scanfolder(folder = 'inbox', sequence = 'all'): - return map( - lambda line: line[:-1], - os.popen('scan +%s %s' % (folder, sequence), 'r').readlines()) + return [line[:-1] for line in os.popen('scan +%s %s' % (folder, sequence), 'r').readlines()] main() diff --git a/Demo/tkinter/guido/rmt.py b/Demo/tkinter/guido/rmt.py index 440650c..c177c72 100755 --- a/Demo/tkinter/guido/rmt.py +++ b/Demo/tkinter/guido/rmt.py @@ -134,7 +134,7 @@ def fillAppsMenu(): file_m_apps.add('command') file_m_apps.delete(0, 'last') names = root.winfo_interps() - names = map(None, names) # convert tuple to list + names = list(names) # convert tuple to list names.sort() for name in names: try: diff --git a/Demo/tkinter/guido/solitaire.py b/Demo/tkinter/guido/solitaire.py index 50a8b26..68dc284 100755 --- a/Demo/tkinter/guido/solitaire.py +++ b/Demo/tkinter/guido/solitaire.py @@ -80,7 +80,7 @@ for s in (HEARTS, DIAMONDS): for s in (CLUBS, SPADES): COLOR[s] = BLACK -ALLSUITS = COLOR.keys() +ALLSUITS = list(COLOR.keys()) NSUITS = len(ALLSUITS) @@ -99,7 +99,7 @@ NVALUES = len(ALLVALUES) # dummy element at index 0 so it can be indexed directly with the card # value. -VALNAMES = ["", "A"] + map(str, range(2, 11)) + ["J", "Q", "K"] +VALNAMES = ["", "A"] + list(map(str, range(2, 11))) + ["J", "Q", "K"] # Solitaire constants. The only one I can think of is the number of diff --git a/Demo/tkinter/guido/sortvisu.py b/Demo/tkinter/guido/sortvisu.py index 3e4454f..c538a2c 100644 --- a/Demo/tkinter/guido/sortvisu.py +++ b/Demo/tkinter/guido/sortvisu.py @@ -344,7 +344,7 @@ def steps(here, there): def interpolate(oldpts, newpts, n): if len(oldpts) != len(newpts): - raise ValueError, "can't interpolate arrays of different length" + raise ValueError("can't interpolate arrays of different length") pts = [0]*len(oldpts) res = [tuple(oldpts)] for i in range(1, n): diff --git a/Demo/tkinter/guido/ss1.py b/Demo/tkinter/guido/ss1.py index 8935475..d957907 100644 --- a/Demo/tkinter/guido/ss1.py +++ b/Demo/tkinter/guido/ss1.py @@ -136,13 +136,13 @@ class Sheet: return maxx, maxy def reset(self): - for cell in self.cells.itervalues(): + for cell in self.cells.values(): if hasattr(cell, 'reset'): cell.reset() def recalc(self): self.reset() - for cell in self.cells.itervalues(): + for cell in self.cells.values(): if hasattr(cell, 'recalc'): cell.recalc(self.rexec) @@ -160,7 +160,7 @@ class Sheet: full[0, y] = text, alignment = str(y), RIGHT colwidth[0] = max(colwidth[0], len(text)) # Add sheet cells in columns with x>0 and y>0 - for (x, y), cell in self.cells.iteritems(): + for (x, y), cell in self.cells.items(): if x <= 0 or y <= 0: continue if hasattr(cell, 'recalc'): @@ -192,13 +192,13 @@ class Sheet: if line: line += '|' line += text - print line + print(line) if y == 0: - print sep + print(sep) def xml(self): out = ['<spreadsheet>'] - for (x, y), cell in self.cells.iteritems(): + for (x, y), cell in self.cells.items(): if hasattr(cell, 'xml'): cellxml = cell.xml() else: @@ -236,7 +236,7 @@ class SheetParser: def startelement(self, tag, attrs): method = getattr(self, 'start_'+tag, None) if method: - for key, value in attrs.iteritems(): + for key, value in attrs.items(): attrs[key] = str(value) # XXX Convert Unicode to 8-bit method(attrs) self.texts = [] @@ -268,7 +268,7 @@ class SheetParser: def end_long(self, text): try: - self.value = long(text) + self.value = int(text) except: self.value = None @@ -325,7 +325,7 @@ class BaseCell: class NumericCell(BaseCell): def __init__(self, value, fmt="%s", alignment=RIGHT): - assert isinstance(value, (int, long, float, complex)) + assert isinstance(value, (int, int, float, complex)) assert alignment in (LEFT, CENTER, RIGHT) self.value = value self.fmt = fmt @@ -366,7 +366,7 @@ class NumericCell(BaseCell): class StringCell(BaseCell): def __init__(self, text, fmt="%s", alignment=LEFT): - assert isinstance(text, (str, unicode)) + assert isinstance(text, (str, str)) assert alignment in (LEFT, CENTER, RIGHT) self.text = text self.fmt = fmt @@ -699,7 +699,7 @@ class SheetGUI: x1, x2 = x2, x1 if y1 > y2: y1, y2 = y2, y1 - for (x, y), cell in self.gridcells.iteritems(): + for (x, y), cell in self.gridcells.items(): if x1 <= x <= x2 and y1 <= y <= y2: cell['bg'] = 'lightBlue' gridcell = self.gridcells.get(self.currentxy) @@ -735,7 +735,7 @@ class SheetGUI: x1, x2 = x2, x1 if y1 > y2: y1, y2 = y2, y1 - for (x, y), cell in self.gridcells.iteritems(): + for (x, y), cell in self.gridcells.items(): if x1 <= x <= x2 and y1 <= y <= y2: cell['bg'] = 'white' @@ -775,7 +775,7 @@ class SheetGUI: if text.startswith('='): cell = FormulaCell(text[1:]) else: - for cls in int, long, float, complex: + for cls in int, int, float, complex: try: value = cls(text) except: @@ -794,7 +794,7 @@ class SheetGUI: def sync(self): "Fill the GUI cells from the sheet cells." self.sheet.recalc() - for (x, y), gridcell in self.gridcells.iteritems(): + for (x, y), gridcell in self.gridcells.items(): if x == 0 or y == 0: continue cell = self.sheet.getcell(x, y) diff --git a/Demo/tkinter/guido/svkill.py b/Demo/tkinter/guido/svkill.py index 95f61b8..378d58f 100755 --- a/Demo/tkinter/guido/svkill.py +++ b/Demo/tkinter/guido/svkill.py @@ -5,7 +5,7 @@ from Tkinter import * if TkVersion < 4.0: - raise ImportError, "This version of svkill requires Tk 4.0 or later" + raise ImportError("This version of svkill requires Tk 4.0 or later") from string import splitfields from string import split diff --git a/Demo/tkinter/guido/tkman.py b/Demo/tkinter/guido/tkman.py index 810bdf8..c84d889 100755 --- a/Demo/tkinter/guido/tkman.py +++ b/Demo/tkinter/guido/tkman.py @@ -172,8 +172,8 @@ class SelectionBox: def updatelist(self): key = self.entry.get() - ok = filter(lambda name, key=key, n=len(key): name[:n]==key, - self.choices) + ok = list(filter(lambda name, key=key, n=len(key): name[:n]==key, + self.choices)) if not ok: self.frame.bell() self.listbox.delete(0, AtEnd()) @@ -205,7 +205,7 @@ class SelectionBox: def search_string(self, search): if not search: self.frame.bell() - print 'Empty search string' + print('Empty search string') return if not self.casevar.get(): map = re.IGNORECASE @@ -218,7 +218,7 @@ class SelectionBox: prog = re.compile(search) except re.error as msg: self.frame.bell() - print 'Regex error:', msg + print('Regex error:', msg) return here = self.text.index(AtInsert()) lineno = string.atoi(here[:string.find(here, '.')]) diff --git a/Demo/tkinter/guido/wish.py b/Demo/tkinter/guido/wish.py index 2367e25..bebab1e 100755 --- a/Demo/tkinter/guido/wish.py +++ b/Demo/tkinter/guido/wish.py @@ -24,7 +24,7 @@ while 1: try: result = tk.call('eval', cmd) except _tkinter.TclError as msg: - print 'TclError:', msg + print('TclError:', msg) else: - if result: print result + if result: print(result) cmd = '' |