diff options
Diffstat (limited to 'Lib/plat-mac')
-rw-r--r-- | Lib/plat-mac/EasyDialogs.py | 4 | ||||
-rw-r--r-- | Lib/plat-mac/FrameWork.py | 6 | ||||
-rw-r--r-- | Lib/plat-mac/MiniAEFrame.py | 3 | ||||
-rw-r--r-- | Lib/plat-mac/aetypes.py | 55 | ||||
-rw-r--r-- | Lib/plat-mac/argvemulator.py | 3 | ||||
-rw-r--r-- | Lib/plat-mac/buildtools.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/gensuitemodule.py | 58 | ||||
-rw-r--r-- | Lib/plat-mac/ic.py | 4 |
8 files changed, 66 insertions, 69 deletions
diff --git a/Lib/plat-mac/EasyDialogs.py b/Lib/plat-mac/EasyDialogs.py index 0c54ec3..13df7f3 100644 --- a/Lib/plat-mac/EasyDialogs.py +++ b/Lib/plat-mac/EasyDialogs.py @@ -531,7 +531,7 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo for stringtoadd in stringstoadd: if '"' in stringtoadd or "'" in stringtoadd or " " in stringtoadd: - stringtoadd = `stringtoadd` + stringtoadd = repr(stringtoadd) h = d.GetDialogItemAsControl(ARGV_CMDLINE_DATA) oldstr = GetDialogItemText(h) if oldstr and oldstr[-1] != ' ': @@ -791,7 +791,7 @@ def test(): argv = GetArgv(optionlist=optionlist, commandlist=commandlist, addoldfile=0) Message("Command line: %s"%' '.join(argv)) for i in range(len(argv)): - print 'arg[%d] = %s'%(i, `argv[i]`) + print 'arg[%d] = %r' % (i, argv[i]) ok = AskYesNoCancel("Do you want to proceed?") ok = AskYesNoCancel("Do you want to identify?", yes="Identify", no="No") if ok > 0: diff --git a/Lib/plat-mac/FrameWork.py b/Lib/plat-mac/FrameWork.py index 849ebdf..7242704 100644 --- a/Lib/plat-mac/FrameWork.py +++ b/Lib/plat-mac/FrameWork.py @@ -373,7 +373,7 @@ class Application: # else it wasn't for us, sigh... def do_char(self, c, event): - if DEBUG: print "Character", `c` + if DEBUG: print "Character", repr(c) def do_updateEvt(self, event): (what, message, when, where, modifiers) = event @@ -431,13 +431,13 @@ class Application: def printevent(self, event): (what, message, when, where, modifiers) = event - nicewhat = `what` + nicewhat = repr(what) if eventname.has_key(what): nicewhat = eventname[what] print nicewhat, if what == kHighLevelEvent: h, v = where - print `ostypecode(message)`, hex(when), `ostypecode(h | (v<<16))`, + print repr(ostypecode(message)), hex(when), repr(ostypecode(h | (v<<16))), else: print hex(message), hex(when), where, print hex(modifiers) diff --git a/Lib/plat-mac/MiniAEFrame.py b/Lib/plat-mac/MiniAEFrame.py index d6482c6..3c5ed9a 100644 --- a/Lib/plat-mac/MiniAEFrame.py +++ b/Lib/plat-mac/MiniAEFrame.py @@ -67,8 +67,7 @@ class MiniApplication: what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: - msg = "High Level Event: %s %s" % \ - (`code(message)`, `code(h | (v<<16))`) + msg = "High Level Event: %r %r" % (code(message), code(h | (v<<16))) try: AE.AEProcessAppleEvent(event) except AE.Error, err: diff --git a/Lib/plat-mac/aetypes.py b/Lib/plat-mac/aetypes.py index 538cf14..b9386f3 100644 --- a/Lib/plat-mac/aetypes.py +++ b/Lib/plat-mac/aetypes.py @@ -26,7 +26,7 @@ class Unknown: self.data = data def __repr__(self): - return "Unknown(%s, %s)" % (`self.type`, `self.data`) + return "Unknown(%r, %r)" % (self.type, self.data) def __aepack__(self): return pack(self.data, self.type) @@ -38,7 +38,7 @@ class Enum: self.enum = "%-4.4s" % str(enum) def __repr__(self): - return "Enum(%s)" % `self.enum` + return "Enum(%r)" % (self.enum,) def __str__(self): return string.strip(self.enum) @@ -60,7 +60,7 @@ class InsertionLoc: self.pos = pos def __repr__(self): - return "InsertionLoc(%s, %s)" % (`self.of`, `self.pos`) + return "InsertionLoc(%r, %r)" % (self.of, self.pos) def __aepack__(self): rec = {'kobj': self.of, 'kpos': self.pos} @@ -80,7 +80,7 @@ class Boolean: self.bool = (not not bool) def __repr__(self): - return "Boolean(%s)" % `self.bool` + return "Boolean(%r)" % (self.bool,) def __str__(self): if self.bool: @@ -105,7 +105,7 @@ class Type: self.type = "%-4.4s" % str(type) def __repr__(self): - return "Type(%s)" % `self.type` + return "Type(%r)" % (self.type,) def __str__(self): return string.strip(self.type) @@ -128,7 +128,7 @@ class Keyword: self.keyword = "%-4.4s" % str(keyword) def __repr__(self): - return "Keyword(%s)" % `self.keyword` + return "Keyword(%r)" % `self.keyword` def __str__(self): return string.strip(self.keyword) @@ -147,7 +147,7 @@ class Range: self.stop = stop def __repr__(self): - return "Range(%s, %s)" % (`self.start`, `self.stop`) + return "Range(%r, %r)" % (self.start, self.stop) def __str__(self): return "%s thru %s" % (nice(self.start), nice(self.stop)) @@ -167,7 +167,7 @@ class Comparison: self.obj2 = obj2 def __repr__(self): - return "Comparison(%s, %s, %s)" % (`self.obj1`, `self.relo`, `self.obj2`) + return "Comparison(%r, %r, %r)" % (self.obj1, self.relo, self.obj2) def __str__(self): return "%s %s %s" % (nice(self.obj1), string.strip(self.relo), nice(self.obj2)) @@ -195,7 +195,7 @@ class Ordinal: self.abso = "%-4.4s" % str(abso) def __repr__(self): - return "Ordinal(%s)" % (`self.abso`) + return "Ordinal(%r)" % (self.abso,) def __str__(self): return "%s" % (string.strip(self.abso)) @@ -220,7 +220,7 @@ class Logical: self.term = term def __repr__(self): - return "Logical(%s, %s)" % (`self.logc`, `self.term`) + return "Logical(%r, %r)" % (self.logc, self.term) def __str__(self): if type(self.term) == ListType and len(self.term) == 2: @@ -244,7 +244,7 @@ class StyledText: self.text = text def __repr__(self): - return "StyledText(%s, %s)" % (`self.style`, `self.text`) + return "StyledText(%r, %r)" % (self.style, self.text) def __str__(self): return self.text @@ -264,7 +264,7 @@ class AEText: self.text = text def __repr__(self): - return "AEText(%s, %s, %s)" % (`self.script`, `self.style`, `self.text`) + return "AEText(%r, %r, %r)" % (self.script, self.style, self.text) def __str__(self): return self.text @@ -285,7 +285,7 @@ class IntlText: self.text = text def __repr__(self): - return "IntlText(%s, %s, %s)" % (`self.script`, `self.language`, `self.text`) + return "IntlText(%r, %r, %r)" % (self.script, self.language, self.text) def __str__(self): return self.text @@ -305,7 +305,7 @@ class IntlWritingCode: self.language = language def __repr__(self): - return "IntlWritingCode(%s, %s)" % (`self.script`, `self.language`) + return "IntlWritingCode(%r, %r)" % (self.script, self.language) def __str__(self): return "script system %d, language %d"%(self.script, self.language) @@ -325,7 +325,7 @@ class QDPoint: self.h = h def __repr__(self): - return "QDPoint(%s, %s)" % (`self.v`, `self.h`) + return "QDPoint(%r, %r)" % (self.v, self.h) def __str__(self): return "(%d, %d)"%(self.v, self.h) @@ -347,8 +347,7 @@ class QDRectangle: self.h1 = h1 def __repr__(self): - return "QDRectangle(%s, %s, %s, %s)" % (`self.v0`, `self.h0`, - `self.v1`, `self.h1`) + return "QDRectangle(%r, %r, %r, %r)" % (self.v0, self.h0, self.v1, self.h1) def __str__(self): return "(%d, %d)-(%d, %d)"%(self.v0, self.h0, self.v1, self.h1) @@ -369,7 +368,7 @@ class RGBColor: self.b = b def __repr__(self): - return "RGBColor(%s, %s, %s)" % (`self.r`, `self.g`, `self.b`) + return "RGBColor(%r, %r, %r)" % (self.r, self.g, self.b) def __str__(self): return "0x%x red, 0x%x green, 0x%x blue"% (self.r, self.g, self.b) @@ -413,9 +412,9 @@ class ObjectSpecifier: self.fr = fr def __repr__(self): - s = "ObjectSpecifier(%s, %s, %s" % (`self.want`, `self.form`, `self.seld`) + s = "ObjectSpecifier(%r, %r, %r" % (self.want, self.form, self.seld) if self.fr: - s = s + ", %s)" % `self.fr` + s = s + ", %r)" % (self.fr,) else: s = s + ")" return s @@ -439,9 +438,9 @@ class Property(ObjectSpecifier): def __repr__(self): if self.fr: - return "Property(%s, %s)" % (`self.seld.type`, `self.fr`) + return "Property(%r, %r)" % (self.seld.type, self.fr) else: - return "Property(%s)" % `self.seld.type` + return "Property(%r)" % (self.seld.type,) def __str__(self): if self.fr: @@ -465,11 +464,11 @@ class NProperty(ObjectSpecifier): mktype(self.which), fr) def __repr__(self): - rv = "Property(%s"%`self.seld.type` + rv = "Property(%r" % (self.seld.type,) if self.fr: - rv = rv + ", fr=%s" % `self.fr` + rv = rv + ", fr=%r" % (self.fr,) if self.want != 'prop': - rv = rv + ", want=%s" % `self.want` + rv = rv + ", want=%r" % (self.want,) return rv + ")" def __str__(self): @@ -510,8 +509,8 @@ class ComponentItem(SelectableItem): def __repr__(self): if not self.fr: - return "%s(%s)" % (self.__class__.__name__, `self.seld`) - return "%s(%s, %s)" % (self.__class__.__name__, `self.seld`, `self.fr`) + return "%s(%r)" % (self.__class__.__name__, self.seld) + return "%s(%r, %r)" % (self.__class__.__name__, self.seld, self.fr) def __str__(self): seld = self.seld @@ -549,7 +548,7 @@ class DelayedComponentItem: return self.compclass(which, self.fr) def __repr__(self): - return "%s(???, %s)" % (self.__class__.__name__, `self.fr`) + return "%s(???, %r)" % (self.__class__.__name__, self.fr) def __str__(self): return "selector for element %s of %s"%(self.__class__.__name__, str(self.fr)) diff --git a/Lib/plat-mac/argvemulator.py b/Lib/plat-mac/argvemulator.py index 90bf365..6103a8a 100644 --- a/Lib/plat-mac/argvemulator.py +++ b/Lib/plat-mac/argvemulator.py @@ -52,8 +52,7 @@ class ArgvCollector: try: AE.AEProcessAppleEvent(event) except AE.Error, err: - msg = "High Level Event: %s %s" % \ - (`hex(message)`, `hex(h | (v<<16))`) + msg = "High Level Event: %r %r" % (hex(message), hex(h | (v<<16))) print 'AE error: ', err print 'in', msg traceback.print_exc() diff --git a/Lib/plat-mac/buildtools.py b/Lib/plat-mac/buildtools.py index bebab19..365772a 100644 --- a/Lib/plat-mac/buildtools.py +++ b/Lib/plat-mac/buildtools.py @@ -55,7 +55,7 @@ def findtemplate(template=None): except (Carbon.File.Error, ValueError): continue else: - raise BuildError, "Template %s not found on sys.path" % `template` + raise BuildError, "Template %r not found on sys.path" % (template,) file = file.as_pathname() return file diff --git a/Lib/plat-mac/gensuitemodule.py b/Lib/plat-mac/gensuitemodule.py index d4140af..ab3c070 100644 --- a/Lib/plat-mac/gensuitemodule.py +++ b/Lib/plat-mac/gensuitemodule.py @@ -160,7 +160,7 @@ def processfile_fromresource(fullname, output=None, basepkgname=None, res = Get1IndResource('aeut', 1+i) resources.append(res) if verbose: - print >>verbose, "\nLISTING aete+aeut RESOURCES IN", `fullname` + print >>verbose, "\nLISTING aete+aeut RESOURCES IN", repr(fullname) aetelist = [] for res in resources: if verbose: @@ -187,7 +187,7 @@ def processfile(fullname, output=None, basepkgname=None, if not is_scriptable(fullname) and verbose: print >>verbose, "Warning: app does not seem scriptable: %s" % fullname if verbose: - print >>verbose, "\nASKING FOR aete DICTIONARY IN", `fullname` + print >>verbose, "\nASKING FOR aete DICTIONARY IN", repr(fullname) try: aedescobj, launched = OSATerminology.GetAppTerminology(fullname) except MacOS.Error, arg: @@ -333,7 +333,7 @@ def getalign(f): if f.tell() & 1: c = f.read(1) ##if c <> '\0': - ## print 'align:', `c` + ## print align:', repr(c) def getlist(f, description, getitem): count = getword(f) @@ -344,9 +344,9 @@ def getlist(f, description, getitem): return list def alt_generic(what, f, *args): - print "generic", `what`, args + print "generic", repr(what), args res = vageneric(what, f, args) - print '->', `res` + print '->', repr(res) return res def generic(what, f, *args): @@ -358,7 +358,7 @@ def generic(what, f, *args): item = apply(generic, thing[:1] + (f,) + thing[1:]) record.append((thing[1], item)) return record - return "BAD GENERIC ARGS: %s" % `what` + return "BAD GENERIC ARGS: %r" % (what,) getdata = [ (getostype, "type"), @@ -529,7 +529,7 @@ def compileaete(aete, resinfo, fname, output=None, basepkgname=None, fp.write("_classdeclarations = {\n") for codenamemapper in allprecompinfo: for k, v in codenamemapper.getall('class'): - fp.write(" %s : %s,\n" % (`k`, v)) + fp.write(" %r : %s,\n" % (k, v)) if k == 'capp': application_class = v fp.write("}\n") @@ -540,7 +540,7 @@ def compileaete(aete, resinfo, fname, output=None, basepkgname=None, for code, modname in suitelist[1:]: fp.write(",\n %s_Events"%modname) fp.write(",\n aetools.TalkTo):\n") - fp.write(" _signature = %s\n\n"%`creatorsignature`) + fp.write(" _signature = %r\n\n"%(creatorsignature,)) fp.write(" _moduleName = '%s'\n\n"%packagename) if application_class: fp.write(" _elemdict = %s._elemdict\n" % application_class) @@ -655,7 +655,7 @@ class SuiteCompiler: fp.write('import aetools\n') fp.write('import MacOS\n\n') - fp.write("_code = %s\n\n"% `code`) + fp.write("_code = %r\n\n"% (code,)) if self.basepackage and self.basepackage._code_to_module.has_key(code): # We are an extension of a baseclass (usually an application extending # Standard_Suite or so). Import everything from our base module @@ -715,7 +715,7 @@ class SuiteCompiler: if arguments: fp.write(" _argmap_%s = {\n"%funcname) for a in arguments: - fp.write(" %s : %s,\n"%(`identify(a[0])`, `a[1]`)) + fp.write(" %r : %r,\n"%(identify(a[0]), a[1])) fp.write(" }\n\n") # @@ -752,8 +752,8 @@ class SuiteCompiler: # # Fiddle the args so everything ends up in 'arguments' dictionary # - fp.write(" _code = %s\n"% `code`) - fp.write(" _subcode = %s\n\n"% `subcode`) + fp.write(" _code = %r\n"% (code,)) + fp.write(" _subcode = %r\n\n"% (subcode,)) # # Do keyword name substitution # @@ -780,8 +780,8 @@ class SuiteCompiler: kname = a[1] ename = a[2][0] if ename <> '****': - fp.write(" aetools.enumsubst(_arguments, %s, _Enum_%s)\n" % - (`kname`, identify(ename))) + fp.write(" aetools.enumsubst(_arguments, %r, _Enum_%s)\n" % + (kname, identify(ename))) self.enumsneeded[ename] = 1 fp.write("\n") # @@ -971,7 +971,7 @@ class ObjectCompiler: if self.fp: self.fp.write('\nclass %s(aetools.ComponentItem):\n' % pname) self.fp.write(' """%s - %s """\n' % (ascii(name), ascii(desc))) - self.fp.write(' want = %s\n' % `code`) + self.fp.write(' want = %r\n' % (code,)) self.namemappers[0].addnamecode('class', pname, code) is_application_class = (code == 'capp') properties.sort() @@ -998,8 +998,8 @@ class ObjectCompiler: if self.fp: self.fp.write("class _Prop_%s(aetools.NProperty):\n" % pname) self.fp.write(' """%s - %s """\n' % (ascii(name), ascii(what[1]))) - self.fp.write(" which = %s\n" % `code`) - self.fp.write(" want = %s\n" % `what[0]`) + self.fp.write(" which = %r\n" % (code,)) + self.fp.write(" want = %r\n" % (what[0],)) self.namemappers[0].addnamecode('property', pname, code) if is_application_class and self.fp: self.fp.write("%s = _Prop_%s()\n" % (pname, pname)) @@ -1007,7 +1007,7 @@ class ObjectCompiler: def compileelement(self, elem): [code, keyform] = elem if self.fp: - self.fp.write("# element %s as %s\n" % (`code`, keyform)) + self.fp.write("# element %r as %s\n" % (code, keyform)) def fillclasspropsandelems(self, cls): [name, code, desc, properties, elements] = cls @@ -1018,7 +1018,7 @@ class ObjectCompiler: if self.fp and (elements or len(properties) > 1 or (len(properties) == 1 and properties[0][1] != 'c@#!')): if self.verbose: - print >>self.verbose, '** Skip multiple %s of %s (code %s)' % (cname, self.namemappers[0].findcodename('class', code)[0], `code`) + print >>self.verbose, '** Skip multiple %s of %s (code %r)' % (cname, self.namemappers[0].findcodename('class', code)[0], code) raise RuntimeError, "About to skip non-empty class" return plist = [] @@ -1044,7 +1044,7 @@ class ObjectCompiler: superclassnames.append(superclassname) if self.fp: - self.fp.write("%s._superclassnames = %s\n"%(cname, `superclassnames`)) + self.fp.write("%s._superclassnames = %r\n"%(cname, superclassnames)) for elem in elements: [ecode, keyform] = elem @@ -1053,7 +1053,7 @@ class ObjectCompiler: name, ename, module = self.findcodename('class', ecode) if not name: if self.fp: - self.fp.write("# XXXX %s element %s not found!!\n"%(cname, `ecode`)) + self.fp.write("# XXXX %s element %r not found!!\n"%(cname, ecode)) else: elist.append((name, ename)) @@ -1091,7 +1091,7 @@ class ObjectCompiler: def compileenumerator(self, item): [name, code, desc] = item - self.fp.write(" %s : %s,\t# %s\n" % (`identify(name)`, `code`, ascii(desc))) + self.fp.write(" %r : %r,\t# %s\n" % (identify(name), code, ascii(desc))) def checkforenum(self, enum): """This enum code is used by an event. Make sure it's available""" @@ -1113,33 +1113,33 @@ class ObjectCompiler: classlist = self.namemappers[0].getall('class') classlist.sort() for k, v in classlist: - self.fp.write(" %s : %s,\n" % (`k`, v)) + self.fp.write(" %r : %s,\n" % (k, v)) self.fp.write("}\n") self.fp.write("\n_propdeclarations = {\n") proplist = self.namemappers[0].getall('property') proplist.sort() for k, v in proplist: - self.fp.write(" %s : _Prop_%s,\n" % (`k`, v)) + self.fp.write(" %r : _Prop_%s,\n" % (k, v)) self.fp.write("}\n") self.fp.write("\n_compdeclarations = {\n") complist = self.namemappers[0].getall('comparison') complist.sort() for k, v in complist: - self.fp.write(" %s : %s,\n" % (`k`, v)) + self.fp.write(" %r : %s,\n" % (k, v)) self.fp.write("}\n") self.fp.write("\n_enumdeclarations = {\n") enumlist = self.namemappers[0].getall('enum') enumlist.sort() for k, v in enumlist: - self.fp.write(" %s : %s,\n" % (`k`, v)) + self.fp.write(" %r : %s,\n" % (k, v)) self.fp.write("}\n") def compiledata(data): [type, description, flags] = data - return "%s -- %s %s" % (`type`, `description`, compiledataflags(flags)) + return "%r -- %r %s" % (type, description, compiledataflags(flags)) def is_null(data): return data[0] == 'null' @@ -1158,7 +1158,7 @@ def getdatadoc(data): return 'anything' if type == 'obj ': return 'an AE object reference' - return "undocumented, typecode %s"%`type` + return "undocumented, typecode %r"%(type,) dataflagdict = {15: "optional", 14: "list", 13: "enum", 12: "mutable"} def compiledataflags(flags): @@ -1168,7 +1168,7 @@ def compiledataflags(flags): if i in dataflagdict.keys(): bits.append(dataflagdict[i]) else: - bits.append(`i`) + bits.append(repr(i)) return '[%s]' % string.join(bits) def ascii(str): diff --git a/Lib/plat-mac/ic.py b/Lib/plat-mac/ic.py index b90aa75..3236805 100644 --- a/Lib/plat-mac/ic.py +++ b/Lib/plat-mac/ic.py @@ -35,7 +35,7 @@ class ICOpaqueData: self.data = data def __repr__(self): - return "ICOpaqueData(%s)"%`self.data` + return "ICOpaqueData(%r)"%(self.data,) _ICOpaqueDataType=type(ICOpaqueData('')) @@ -94,7 +94,7 @@ def _code_fontrecord(data, key): chr(0) + _code_default(name) def _code_boolean(data, key): - print 'XXXX boolean:', `data` + print 'XXXX boolean:', repr(data) return chr(data) def _code_text(data, key): |