From 582176023213a5bdaf76a19977f7bb6d508694e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20D=C3=B6rwald?= Date: Thu, 12 Feb 2004 17:35:32 +0000 Subject: Replace backticks with repr() or "%r" From SF patch #852334. --- Doc/lib/caseless.py | 8 ++++---- Doc/tools/cvsinfo.py | 2 +- Doc/tools/refcounts.py | 2 +- Doc/tools/sgmlconv/esistools.py | 6 +++--- Doc/tools/sgmlconv/latex2esis.py | 18 +++++++++--------- 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'Doc') diff --git a/Doc/lib/caseless.py b/Doc/lib/caseless.py index 107fed68e3..b128219337 100755 --- a/Doc/lib/caseless.py +++ b/Doc/lib/caseless.py @@ -47,10 +47,10 @@ if __name__ == "__main__": print "not ok: no conflict between -h and -H" parser.add_option("-f", "--file", dest="file") - #print `parser.get_option("-f")` - #print `parser.get_option("-F")` - #print `parser.get_option("--file")` - #print `parser.get_option("--fIlE")` + #print repr(parser.get_option("-f")) + #print repr(parser.get_option("-F")) + #print repr(parser.get_option("--file")) + #print repr(parser.get_option("--fIlE")) (options, args) = parser.parse_args(["--FiLe", "foo"]) assert options.file == "foo", options.file print "ok: case insensitive long options work" diff --git a/Doc/tools/cvsinfo.py b/Doc/tools/cvsinfo.py index 58a32c2538..cc90fe5e2a 100644 --- a/Doc/tools/cvsinfo.py +++ b/Doc/tools/cvsinfo.py @@ -78,4 +78,4 @@ class RepositoryInfo: return fn[len(self.cvsroot_path)+1:] def __repr__(self): - return "" % `self.get_cvsroot()` + return "" % self.get_cvsroot() diff --git a/Doc/tools/refcounts.py b/Doc/tools/refcounts.py index d82def7a7d..ccfc8c609e 100644 --- a/Doc/tools/refcounts.py +++ b/Doc/tools/refcounts.py @@ -32,7 +32,7 @@ def loadfile(fp): continue parts = line.split(":", 4) if len(parts) != 5: - raise ValueError("Not enough fields in " + `line`) + raise ValueError("Not enough fields in %r" % line) function, type, arg, refcount, comment = parts if refcount == "null": refcount = None diff --git a/Doc/tools/sgmlconv/esistools.py b/Doc/tools/sgmlconv/esistools.py index b9c029b08d..833fea171c 100644 --- a/Doc/tools/sgmlconv/esistools.py +++ b/Doc/tools/sgmlconv/esistools.py @@ -29,7 +29,7 @@ def decode(s): n, s = s.split(";", 1) r = r + unichr(int(n)) else: - raise ValueError, "can't handle " + `s` + raise ValueError, "can't handle %r" % s return r @@ -220,8 +220,8 @@ class ESISReader(xml.sax.xmlreader.XMLReader): return self._decl_handler else: - raise xml.sax.SAXNotRecognizedException("unknown property %s" - % `property`) + raise xml.sax.SAXNotRecognizedException("unknown property %r" + % (property, )) def setProperty(self, property, value): if property == xml.sax.handler.property_lexical_handler: diff --git a/Doc/tools/sgmlconv/latex2esis.py b/Doc/tools/sgmlconv/latex2esis.py index 47739a6610..b30aaa5631 100755 --- a/Doc/tools/sgmlconv/latex2esis.py +++ b/Doc/tools/sgmlconv/latex2esis.py @@ -73,8 +73,8 @@ def popping(name, point, depth): class _Stack(list): def append(self, entry): if not isinstance(entry, str): - raise LaTeXFormatError("cannot push non-string on stack: " - + `entry`) + raise LaTeXFormatError("cannot push non-string on stack: %r" + % (entry, )) #dbgmsg("%s<%s>" % (" "*len(self.data), entry)) list.append(self, entry) @@ -208,8 +208,8 @@ class Conversion: m = _parameter_rx.match(line) if not m: raise LaTeXFormatError( - "could not extract parameter %s for %s: %s" - % (pentry.name, macroname, `line[:100]`)) + "could not extract parameter %s for %s: %r" + % (pentry.name, macroname, line[:100])) if entry.outputname: self.dump_attr(pentry, m.group(1)) line = line[m.end():] @@ -259,7 +259,7 @@ class Conversion: opened = 1 stack.append(entry.name) self.write("(%s\n" % entry.outputname) - #dbgmsg("--- text: %s" % `pentry.text`) + #dbgmsg("--- text: %r" % pentry.text) self.write("-%s\n" % encode(pentry.text)) elif pentry.type == "entityref": self.write("&%s\n" % pentry.name) @@ -326,8 +326,8 @@ class Conversion: extra = "" if len(line) > 100: extra = "..." - raise LaTeXFormatError("could not identify markup: %s%s" - % (`line[:100]`, extra)) + raise LaTeXFormatError("could not identify markup: %r%s" + % (line[:100], extra)) while stack: entry = self.get_entry(stack[-1]) if entry.closes: @@ -361,7 +361,7 @@ class Conversion: def get_entry(self, name): entry = self.table.get(name) if entry is None: - dbgmsg("get_entry(%s) failing; building default entry!" % `name`) + dbgmsg("get_entry(%r) failing; building default entry!" % (name, )) # not defined; build a default entry: entry = TableEntry(name) entry.has_content = 1 @@ -486,7 +486,7 @@ class TableHandler(xml.sax.handler.ContentHandler): def end_macro(self): name = self.__current.name if self.__table.has_key(name): - raise ValueError("name %s already in use" % `name`) + raise ValueError("name %r already in use" % (name,)) self.__table[name] = self.__current self.__current = None -- cgit v1.2.1