diff options
Diffstat (limited to 'Mac')
28 files changed, 66 insertions, 68 deletions
diff --git a/Mac/Demo/PICTbrowse/ICONbrowse.py b/Mac/Demo/PICTbrowse/ICONbrowse.py index 42ae96d..1194b7e 100644 --- a/Mac/Demo/PICTbrowse/ICONbrowse.py +++ b/Mac/Demo/PICTbrowse/ICONbrowse.py @@ -52,7 +52,7 @@ class ICONbrowse(FrameWork.Application): def showICON(self, resid): w = ICONwindow(self) w.open(resid) - #EasyDialogs.Message('Show ICON '+`resid`) + #EasyDialogs.Message('Show ICON %r' % (resid,)) def findICONresources(self): num = Res.CountResources('ICON') @@ -70,7 +70,7 @@ class ICONbrowse(FrameWork.Application): class ICONwindow(FrameWork.Window): def open(self, (resid, resname)): if not resname: - resname = '#'+`resid` + resname = '#%r' % (resid,) self.resid = resid self.picture = Icn.GetIcon(self.resid) l, t, r, b = 0, 0, 32, 32 @@ -127,7 +127,7 @@ class MyDialog(FrameWork.DialogWindow): if self.contents: self.list.LAddRow(len(self.contents), 0) for i in range(len(self.contents)): - v = `self.contents[i][0]` + v = repr(self.contents[i][0]) if self.contents[i][1]: v = v + '"' + self.contents[i][1] + '"' self.list.LSetCell(v, (0, i)) diff --git a/Mac/Demo/PICTbrowse/PICTbrowse.py b/Mac/Demo/PICTbrowse/PICTbrowse.py index 41ffa5c..eace869 100644 --- a/Mac/Demo/PICTbrowse/PICTbrowse.py +++ b/Mac/Demo/PICTbrowse/PICTbrowse.py @@ -47,7 +47,7 @@ class PICTbrowse(FrameWork.Application): def showPICT(self, resid): w = PICTwindow(self) w.open(resid) - #EasyDialogs.Message('Show PICT '+`resid`) + #EasyDialogs.Message('Show PICT %r' % (resid,)) def findPICTresources(self): num = Res.CountResources('PICT') @@ -65,11 +65,11 @@ class PICTbrowse(FrameWork.Application): class PICTwindow(FrameWork.Window): def open(self, (resid, resname)): if not resname: - resname = '#'+`resid` + resname = '#%r' % (resid,) self.resid = resid picture = Qd.GetPicture(self.resid) # Get rect for picture - print `picture.data[:16]` + print repr(picture.data[:16]) sz, t, l, b, r = struct.unpack('hhhhh', picture.data[:10]) print 'pict:', t, l, b, r width = r-l @@ -105,7 +105,7 @@ class MyDialog(FrameWork.DialogWindow): if self.contents: self.list.LAddRow(len(self.contents), 0) for i in range(len(self.contents)): - v = `self.contents[i][0]` + v = repr(self.contents[i][0]) if self.contents[i][1]: v = v + '"' + self.contents[i][1] + '"' self.list.LSetCell(v, (0, i)) diff --git a/Mac/Demo/PICTbrowse/PICTbrowse2.py b/Mac/Demo/PICTbrowse/PICTbrowse2.py index da389c0..875c99b 100644 --- a/Mac/Demo/PICTbrowse/PICTbrowse2.py +++ b/Mac/Demo/PICTbrowse/PICTbrowse2.py @@ -51,7 +51,7 @@ class PICTbrowse(FrameWork.Application): def showPICT(self, resid): w = PICTwindow(self) w.open(resid) - #EasyDialogs.Message('Show PICT '+`resid`) + #EasyDialogs.Message('Show PICT %r' % (resid,)) def findPICTresources(self): num = Res.CountResources('PICT') @@ -69,7 +69,7 @@ class PICTbrowse(FrameWork.Application): class PICTwindow(FrameWork.Window): def open(self, (resid, resname)): if not resname: - resname = '#'+`resid` + resname = '#%r' % (resid,) self.resid = resid self.picture = Qd.GetPicture(self.resid) # Get rect for picture @@ -127,7 +127,7 @@ class MyDialog(FrameWork.DialogWindow): if self.contents: self.list.LAddRow(len(self.contents), 0) for i in range(len(self.contents)): - v = `self.contents[i][0]` + v = repr(self.contents[i][0]) if self.contents[i][1]: v = v + '"' + self.contents[i][1] + '"' self.list.LSetCell(v, (0, i)) diff --git a/Mac/Demo/PICTbrowse/cicnbrowse.py b/Mac/Demo/PICTbrowse/cicnbrowse.py index b90143e..e3d7972 100644 --- a/Mac/Demo/PICTbrowse/cicnbrowse.py +++ b/Mac/Demo/PICTbrowse/cicnbrowse.py @@ -52,7 +52,7 @@ class CIconbrowse(FrameWork.Application): def showCIcon(self, resid): w = CIconwindow(self) w.open(resid) - #EasyDialogs.Message('Show cicn '+`resid`) + #EasyDialogs.Message('Show cicn %r' % (resid,)) def findcicnresources(self): num = Res.CountResources('cicn') @@ -70,7 +70,7 @@ class CIconbrowse(FrameWork.Application): class CIconwindow(FrameWork.Window): def open(self, (resid, resname)): if not resname: - resname = '#'+`resid` + resname = '#%r' % (resid,) self.resid = resid self.picture = Icn.GetCIcon(self.resid) l, t, r, b = 0, 0, 32, 32 @@ -127,7 +127,7 @@ class MyDialog(FrameWork.DialogWindow): if self.contents: self.list.LAddRow(len(self.contents), 0) for i in range(len(self.contents)): - v = `self.contents[i][0]` + v = repr(self.contents[i][0]) if self.contents[i][1]: v = v + '"' + self.contents[i][1] + '"' self.list.LSetCell(v, (0, i)) diff --git a/Mac/Demo/PICTbrowse/oldPICTbrowse.py b/Mac/Demo/PICTbrowse/oldPICTbrowse.py index dc1f5b4..5f5893c 100644 --- a/Mac/Demo/PICTbrowse/oldPICTbrowse.py +++ b/Mac/Demo/PICTbrowse/oldPICTbrowse.py @@ -46,7 +46,7 @@ class PICTbrowse(FrameWork.Application): def showPICT(self, resid): w = PICTwindow(self) w.open(resid) - #EasyDialogs.Message('Show PICT '+`resid`) + #EasyDialogs.Message('Show PICT %r' % (resid,)) def findPICTresources(self): num = Res.CountResources('PICT') @@ -64,11 +64,11 @@ class PICTbrowse(FrameWork.Application): class PICTwindow(FrameWork.Window): def open(self, (resid, resname)): if not resname: - resname = '#'+`resid` + resname = '#%r' % (resid,) self.resid = resid picture = Qd.GetPicture(self.resid) # Get rect for picture - print `picture.data[:16]` + print repr(picture.data[:16]) sz, t, l, b, r = struct.unpack('hhhhh', picture.data[:10]) print 'pict:', t, l, b, r width = r-l @@ -104,7 +104,7 @@ class MyDialog(FrameWork.DialogWindow): if self.contents: self.list.LAddRow(len(self.contents), 0) for i in range(len(self.contents)): - v = `self.contents[i][0]` + v = repr(self.contents[i][0]) if self.contents[i][1]: v = v + '"' + self.contents[i][1] + '"' self.list.LSetCell(v, (0, i)) diff --git a/Mac/Demo/calldll/testcalldll.py b/Mac/Demo/calldll/testcalldll.py index cdb24c3..d4a4853 100644 --- a/Mac/Demo/calldll/testcalldll.py +++ b/Mac/Demo/calldll/testcalldll.py @@ -99,7 +99,7 @@ rv = cdll_N_pp('pascal string') if rv == 'Was: pascal string': print 'ok.' else: - print 'Failed, returned', `rv` + print 'Failed, returned', repr(rv) print 'Test cdll_N_bb' rv = cdll_N_bb(-100) @@ -128,5 +128,5 @@ rv = cdll_N_sH('new data', h) if rv == None and h.data == 'new data': print 'ok.' else: - print 'Failed, rv is', rv, 'and handle data is', `rv.data` + print 'Failed, rv is', rv, 'and handle data is', repr(rv.data) sys.exit(1) diff --git a/Mac/Demo/imgbrowse/imgbrowse.py b/Mac/Demo/imgbrowse/imgbrowse.py index d8164ea..262c650 100644 --- a/Mac/Demo/imgbrowse/imgbrowse.py +++ b/Mac/Demo/imgbrowse/imgbrowse.py @@ -53,7 +53,7 @@ class imgbrowse(FrameWork.Application): try: rdr = img.reader(imgformat.macrgb16, pathname) except img.error, arg: - EasyDialogs.Message(`arg`) + EasyDialogs.Message(repr(arg)) return w, h = rdr.width, rdr.height bar.set(10) diff --git a/Mac/Demo/mlte/mlted.py b/Mac/Demo/mlte/mlted.py index 53f9f5d..381345a 100644 --- a/Mac/Demo/mlte/mlted.py +++ b/Mac/Demo/mlte/mlted.py @@ -276,7 +276,7 @@ class Mlted(Application): data = fp.read() fp.close() except IOError, arg: - EasyDialogs.Message("IOERROR: "+`arg`) + EasyDialogs.Message("IOERROR: %r" % (arg,)) return else: path = None diff --git a/Mac/Demo/resources/listres.py b/Mac/Demo/resources/listres.py index 7575db8..eacf2b7 100644 --- a/Mac/Demo/resources/listres.py +++ b/Mac/Demo/resources/listres.py @@ -7,7 +7,7 @@ def list1resources(): ntypes = Res.Count1Types() for itype in range(1, 1+ntypes): type = Res.Get1IndType(itype) - print "Type:", `type` + print "Type:", repr(type) nresources = Res.Count1Resources(type) for i in range(1, 1 + nresources): Res.SetResLoad(0) @@ -19,7 +19,7 @@ def listresources(): ntypes = Res.CountTypes() for itype in range(1, 1+ntypes): type = Res.GetIndType(itype) - print "Type:", `type` + print "Type:", repr(type) nresources = Res.CountResources(type) for i in range(1, 1 + nresources): Res.SetResLoad(0) diff --git a/Mac/Demo/textedit/ped.py b/Mac/Demo/textedit/ped.py index 80cf7e5..eee848b 100644 --- a/Mac/Demo/textedit/ped.py +++ b/Mac/Demo/textedit/ped.py @@ -274,7 +274,7 @@ class Ped(Application): data = fp.read() fp.close() except IOError, arg: - EasyDialogs.Message("IOERROR: "+`arg`) + EasyDialogs.Message("IOERROR: %r" % (arg,)) return else: path = None diff --git a/Mac/Demo/waste/htmled.py b/Mac/Demo/waste/htmled.py index d415de1..8710766 100644 --- a/Mac/Demo/waste/htmled.py +++ b/Mac/Demo/waste/htmled.py @@ -516,7 +516,7 @@ class Wed(Application): self.sizemenu = Menu(self.menubar, "Size") self.sizeitems = [] for n in SIZES: - m = MenuItem(self.sizemenu, `n`, "", self.selsize) + m = MenuItem(self.sizemenu, repr(n), "", self.selsize) self.sizeitems.append(m) self.sizemenu.addseparator() self.sizeitem_bigger = MenuItem(self.sizemenu, "Bigger", "+", @@ -670,7 +670,7 @@ class Wed(Application): data = fp.read() fp.close() except IOError, arg: - EasyDialogs.Message("IOERROR: "+`arg`) + EasyDialogs.Message("IOERROR: %r" % (arg,)) return else: path = None @@ -688,7 +688,7 @@ class Wed(Application): try: fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line except IOError, arg: - EasyDialogs.Message("IOERROR: "+`arg`) + EasyDialogs.Message("IOERROR: %r" % (args,)) return self.active.menu_insert(fp) else: @@ -702,7 +702,7 @@ class Wed(Application): try: fp = open(path, 'r') except IOError, arg: - EasyDialogs.Message("IOERROR: "+`arg`) + EasyDialogs.Message("IOERROR: %r" % (arg,)) return self.active.menu_insert_html(fp) else: diff --git a/Mac/Demo/waste/swed.py b/Mac/Demo/waste/swed.py index c85cb21..ca77293 100644 --- a/Mac/Demo/waste/swed.py +++ b/Mac/Demo/waste/swed.py @@ -375,7 +375,7 @@ class Wed(Application): self.sizemenu = Menu(self.menubar, "Size") self.sizeitems = [] for n in SIZES: - m = MenuItem(self.sizemenu, `n`, "", self.selsize) + m = MenuItem(self.sizemenu, repr(n), "", self.selsize) self.sizeitems.append(m) self.sizemenu.addseparator() self.sizeitem_bigger = MenuItem(self.sizemenu, "Bigger", "+", @@ -529,7 +529,7 @@ class Wed(Application): data = fp.read() fp.close() except IOError, arg: - EasyDialogs.Message("IOERROR: "+`arg`) + EasyDialogs.Message("IOERROR: %r" % (arg,)) return else: path = None diff --git a/Mac/Demo/waste/wed.py b/Mac/Demo/waste/wed.py index 7161ae5..5d84b40 100644 --- a/Mac/Demo/waste/wed.py +++ b/Mac/Demo/waste/wed.py @@ -338,7 +338,7 @@ class Wed(Application): data = fp.read() fp.close() except IOError, arg: - EasyDialogs.Message("IOERROR: "+`arg`) + EasyDialogs.Message("IOERROR: %r" % (arg,)) return else: path = None diff --git a/Mac/IDE scripts/Widget demos/KeyTester.py b/Mac/IDE scripts/Widget demos/KeyTester.py index ec66966..a9f3140 100644 --- a/Mac/IDE scripts/Widget demos/KeyTester.py +++ b/Mac/IDE scripts/Widget demos/KeyTester.py @@ -4,7 +4,7 @@ import W # key callback function def tester(char, event): - text = `char` + "\r" + `ord(char)` + "\r" + hex(ord(char)) + "\r" + oct(ord(char)) + text = "%r\r%d\r%s\r%s" % (char, ord(char), hex(ord(chart)), oct(ord(char))) window.keys.set(text) # close callback diff --git a/Mac/IDE scripts/Widget demos/WidgetTest.py b/Mac/IDE scripts/Widget demos/WidgetTest.py index f88b059..424e70d 100644 --- a/Mac/IDE scripts/Widget demos/WidgetTest.py +++ b/Mac/IDE scripts/Widget demos/WidgetTest.py @@ -79,7 +79,7 @@ window.open() if 0: import time for i in range(20): - window.et2.set(`i`) + window.et2.set(repr(i)) #window.et2.SetPort() #window.et2.draw() time.sleep(0.1) diff --git a/Mac/Tools/IDE/FontSettings.py b/Mac/Tools/IDE/FontSettings.py index a41fcbd..af2bd80 100644 --- a/Mac/Tools/IDE/FontSettings.py +++ b/Mac/Tools/IDE/FontSettings.py @@ -51,7 +51,7 @@ class _FontDialog: self.lasttab, self.tabmode = tabsettings self.w.tabsizetitle = W.TextBox((10, -26, leftmargin2, 14), "Tabsize:", TextEdit.teJustRight) self.w.tabsizeedit = W.EditText((leftmargin, -29, 40, 20), "", self.checktab) - self.w.tabsizeedit.set(`self.lasttab`) + self.w.tabsizeedit.set(repr(self.lasttab)) radiobuttons = [] self.w.tabsizechars = W.RadioButton((leftmargin + 48, -26, 55, 14), "Spaces", radiobuttons, self.toggletabmode) @@ -97,7 +97,7 @@ class _FontDialog: else: # convert spaces to pixels self.lasttab = spacewidth * tabsize - self.w.tabsizeedit.set(`self.lasttab`) + self.w.tabsizeedit.set(repr(self.lasttab)) self.tabmode = tabmode self.doit() @@ -139,7 +139,7 @@ class _FontDialog: for i in range(1, len(_stylenames)): if self.w[i].get(): style = style | 2 ** (i - 1) - #self.w.sample.set(`style`) + #self.w.sample.set(repr(style)) fontsettings, tabsettings = self.get() self.w.sample.setfontsettings(fontsettings) self.w.sample.settabsettings(tabsettings) @@ -161,7 +161,7 @@ class _FontDialog: self.doit() else: SysBeep(0) - self.w.tabsizeedit.set(`self.lasttab`) + self.w.tabsizeedit.set(repr(self.lasttab)) self.w.tabsizeedit.selectall() def checksize(self): @@ -181,7 +181,7 @@ class _FontDialog: self.doit() else: SysBeep(0) - self.w.sizeedit.set(`self.lastsize`) + self.w.sizeedit.set(repr(self.lastsize)) self.w.sizeedit.selectall() def doplain(self): diff --git a/Mac/Tools/IDE/PyDebugger.py b/Mac/Tools/IDE/PyDebugger.py index 18a089e..51ba753 100644 --- a/Mac/Tools/IDE/PyDebugger.py +++ b/Mac/Tools/IDE/PyDebugger.py @@ -511,7 +511,7 @@ class Debugger(bdb.Bdb): return self.dispatch_return(frame, arg) if event == 'exception': return self.dispatch_exception(frame, arg) - print 'bdb.Bdb.dispatch: unknown debugging event:', `event` + print 'bdb.Bdb.dispatch: unknown debugging event:', repr(event) return self.trace_dispatch finally: if hasattr(MacOS, 'EnableAppswitch'): diff --git a/Mac/Tools/IDE/PyDocSearch.py b/Mac/Tools/IDE/PyDocSearch.py index f9d2cb5..1abd4cd 100644 --- a/Mac/Tools/IDE/PyDocSearch.py +++ b/Mac/Tools/IDE/PyDocSearch.py @@ -75,7 +75,7 @@ class Status: def set(self, path, hits): self.w.searching.set(path) - self.w.hits.set('Hits: ' + `hits`) + self.w.hits.set('Hits: %r' % (hits,)) app.breathe() def close(self): diff --git a/Mac/Tools/IDE/PyEdit.py b/Mac/Tools/IDE/PyEdit.py index 0ad7a8a..6826c65 100644 --- a/Mac/Tools/IDE/PyEdit.py +++ b/Mac/Tools/IDE/PyEdit.py @@ -43,7 +43,7 @@ class Editor(W.Window): if title: self.title = title else: - self.title = "Untitled Script " + `_scriptuntitledcounter` + self.title = "Untitled Script %r" % (_scriptuntitledcounter,) _scriptuntitledcounter = _scriptuntitledcounter + 1 text = "" self._creator = W._signature @@ -444,7 +444,7 @@ class Editor(W.Window): try: code = compile(pytext, filename, "exec") except (SyntaxError, EOFError): - raise buildtools.BuildError, "Syntax error in script %s" % `filename` + raise buildtools.BuildError, "Syntax error in script %r" % (filename,) import tempfile tmpdir = tempfile.mkdtemp() @@ -1262,8 +1262,8 @@ class _EditorDefaultSettings: self.w.picksizebutton = W.Button((8, 50, 80, 16), "Front window", self.picksize) self.w.xsizelabel = W.TextBox((98, 32, 40, 14), "Width:") self.w.ysizelabel = W.TextBox((148, 32, 40, 14), "Height:") - self.w.xsize = W.EditText((98, 48, 40, 20), `self.windowsize[0]`) - self.w.ysize = W.EditText((148, 48, 40, 20), `self.windowsize[1]`) + self.w.xsize = W.EditText((98, 48, 40, 20), repr(self.windowsize[0])) + self.w.ysize = W.EditText((148, 48, 40, 20), repr(self.windowsize[1])) self.w.cancelbutton = W.Button((-180, -26, 80, 16), "Cancel", self.cancel) self.w.okbutton = W.Button((-90, -26, 80, 16), "Done", self.ok) @@ -1276,8 +1276,8 @@ class _EditorDefaultSettings: editor = findeditor(self) if editor is not None: width, height = editor._parentwindow._bounds[2:] - self.w.xsize.set(`width`) - self.w.ysize.set(`height`) + self.w.xsize.set(repr(width)) + self.w.ysize.set(repr(height)) else: raise W.AlertError, "No edit window found" diff --git a/Mac/Tools/IDE/PyFontify.py b/Mac/Tools/IDE/PyFontify.py index 5680aa8..eb37ad3 100644 --- a/Mac/Tools/IDE/PyFontify.py +++ b/Mac/Tools/IDE/PyFontify.py @@ -152,4 +152,4 @@ def test(path): f.close() tags = fontify(text) for tag, start, end, sublist in tags: - print tag, `text[start:end]` + print tag, repr(text[start:end]) diff --git a/Mac/Tools/IDE/PythonIDEMain.py b/Mac/Tools/IDE/PythonIDEMain.py index 29e9bef..111a0b0 100644 --- a/Mac/Tools/IDE/PythonIDEMain.py +++ b/Mac/Tools/IDE/PythonIDEMain.py @@ -394,7 +394,7 @@ class PythonIDE(Wapplication.Application): if arg[0] == -50: W.Message("Developer documentation not installed") else: - W.Message("AppleHelp Error: %s" % `arg`) + W.Message("AppleHelp Error: %r" % (arg,)) def domenu_lookuppython(self, *args): from Carbon import AH @@ -404,7 +404,7 @@ class PythonIDE(Wapplication.Application): try: AH.AHSearch("Python Documentation", searchstring) except AH.Error, arg: - W.Message("AppleHelp Error: %s" % `arg`) + W.Message("AppleHelp Error: %r" % (arg,)) def domenu_lookupcarbon(self, *args): from Carbon import AH @@ -414,7 +414,7 @@ class PythonIDE(Wapplication.Application): try: AH.AHSearch("Carbon", searchstring) except AH.Error, arg: - W.Message("AppleHelp Error: %s" % `arg`) + W.Message("AppleHelp Error: %r" % (arg,)) def _getsearchstring(self): # First we get the frontmost window diff --git a/Mac/Tools/IDE/Wapplication.py b/Mac/Tools/IDE/Wapplication.py index ada4419..a63be2a 100644 --- a/Mac/Tools/IDE/Wapplication.py +++ b/Mac/Tools/IDE/Wapplication.py @@ -118,7 +118,7 @@ class Application(FrameWork.Application): func() except: import sys - sys.stderr.write("exception in idle function %s; killed:\n" % `func`) + sys.stderr.write("exception in idle function %r; killed:\n" % (func,)) traceback.print_exc() self._idlefuncs.remove(func) break @@ -175,7 +175,7 @@ class Application(FrameWork.Application): self.do_rawmenu(id, item, None, event) return # here! we had a menukey! #else: - # print "XXX Command-" +`ch` + # print "XXX Command-%r" % ch # See whether the front window wants it if wid and self._windows.has_key(wid): window = self._windows[wid] diff --git a/Mac/Tools/IDE/Wbase.py b/Mac/Tools/IDE/Wbase.py index 4c78b88..a5d556b 100644 --- a/Mac/Tools/IDE/Wbase.py +++ b/Mac/Tools/IDE/Wbase.py @@ -229,7 +229,7 @@ class Widget: def _removewidget(self, key): if not self._widgetsdict.has_key(key): - raise KeyError, "no widget with key " + `key` + raise KeyError, "no widget with key %r" % (key,) widget = self._widgetsdict[key] for k in widget._widgetsdict.keys(): widget._removewidget(k) @@ -502,8 +502,8 @@ class HorizontalPanes(Widget): self._panebounds = [] for i in range(len(self._panesizes)): panestart, paneend = self._panesizes[i] - boundsstring = self.boundstemplate % (`panestart`, panestart and halfgutter, - `paneend`, (paneend <> 1.0) and -halfgutter) + boundsstring = self.boundstemplate % (repr(panestart), panestart and halfgutter, + repr(paneend), (paneend <> 1.0) and -halfgutter) self._panebounds.append(eval(boundsstring)) def installbounds(self): @@ -684,9 +684,9 @@ def CallbackCall(callback, mustfit, *args): return callback() else: if mustfit: - raise TypeError, "callback accepts wrong number of arguments: " + `len(args)` + raise TypeError, "callback accepts wrong number of arguments: %r" % len(args) else: - raise TypeError, "callback accepts wrong number of arguments: 0 or " + `len(args)` + raise TypeError, "callback accepts wrong number of arguments: 0 or %r" % len(args) def HasBaseClass(obj, class_): diff --git a/Mac/Tools/IDE/Wsocket.py b/Mac/Tools/IDE/Wsocket.py index e0077b2..913797c 100644 --- a/Mac/Tools/IDE/Wsocket.py +++ b/Mac/Tools/IDE/Wsocket.py @@ -129,14 +129,14 @@ class Connection(asyncore.dispatcher): data = asyncore.dispatcher.recv(self, BUFSIZE) if data: if VERBOSE > 2: - print "incoming ->", "%x" % id(self), `data` + print "incoming -> %x %r" % (id(self), data) self.handle_incoming_data(data) def handle_write(self): if self._out_buffer: sent = self.socket.send(self._out_buffer[:BUFSIZE]) if VERBOSE > 2: - print "outgoing ->", "%x" % id(self), `self._out_buffer[:sent]` + print "outgoing -> %x %r" % (id(self), self._out_buffer[:sent]) self._out_buffer = self._out_buffer[sent:] def close(self): @@ -144,7 +144,7 @@ class Connection(asyncore.dispatcher): self.readfunc(self._in_buffer) self._in_buffer = "" #elif VERBOSE > 1 and self._in_buffer: - # print "--- there is unread data:", `self._in_buffer` + # print "--- there is unread data: %r", (self._in_buffer,) asyncore.dispatcher.close(self) def handle_close(self): @@ -290,7 +290,7 @@ class PyConnection(Connection): self.currentmessage = PyMessage() def handle_object(self, object): - print 'unhandled object:', `object` + print 'unhandled object:', repr(object) def send(self, object): import cPickle, zlib, struct @@ -356,7 +356,7 @@ class HTTPProxy(Proxy): def connectproxy(self, data): if VERBOSE: - print "--- proxy request", `data` + print "--- proxy request", repr(data) addr, data = de_proxify(data) other = Proxy(addr) self.other = other diff --git a/Mac/Tools/IDE/Wtraceback.py b/Mac/Tools/IDE/Wtraceback.py index 51b54f3..90a25fe 100644 --- a/Mac/Tools/IDE/Wtraceback.py +++ b/Mac/Tools/IDE/Wtraceback.py @@ -147,9 +147,7 @@ class TraceBack: tbline = "" if os.path.exists(filename): filename = os.path.split(filename)[1] - tbline = 'File "' + filename + '", line ' + `lineno` + ', in ' + func - else: - tbline = 'File "' + filename + '", line ' + `lineno` + ', in ' + func + tbline = 'File "%s", line %r, in %r' % (filename, lineno, func) if line: tbline = tbline + '\r ' + line self.textlist.append(tbline[:255]) diff --git a/Mac/Tools/macfreeze/macfreezegui.py b/Mac/Tools/macfreeze/macfreezegui.py index 7921a29..5dd3435 100644 --- a/Mac/Tools/macfreeze/macfreezegui.py +++ b/Mac/Tools/macfreeze/macfreezegui.py @@ -113,7 +113,7 @@ def dialog(script=None): try: debug = string.atoi(string.strip(debug)) except ValueError: - EasyDialogs.Message("Illegal debug value %s, set to zero."%`debug`) + EasyDialogs.Message("Illegal debug value %r, set to zero."%(debug,)) debug = 0 if gentype == ITEM_GENSOURCE: return 'source', script, dirname, debug diff --git a/Mac/Tools/macfreeze/macgen_info.py b/Mac/Tools/macfreeze/macgen_info.py index 9ec6aa0..2d984c1 100644 --- a/Mac/Tools/macfreeze/macgen_info.py +++ b/Mac/Tools/macfreeze/macgen_info.py @@ -4,5 +4,5 @@ def generate(output, module_dict): for name in module_dict.keys(): print 'Include %-20s\t'%name, module = module_dict[name] - print module.gettype(), '\t', `module` + print module.gettype(), '\t', repr(module) return 0 diff --git a/Mac/Tools/macfreeze/macgenerate.py b/Mac/Tools/macfreeze/macgenerate.py index 6c60605..dfa2047 100644 --- a/Mac/Tools/macfreeze/macgenerate.py +++ b/Mac/Tools/macfreeze/macgenerate.py @@ -4,5 +4,5 @@ def generate(program, module_dict): for name in module_dict.keys(): print 'Include %-20s\t'%name, module = module_dict[name] - print module.gettype(), '\t', `module` + print module.gettype(), '\t', repr(module) return 0 |