From 0b70cca9f8132b6fe03803abe9e89bd3a00a80ee Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 25 Aug 2006 02:59:59 +0000 Subject: [PATCH] Remove usage of backticks. --- Lib/idlelib/EditorWindow.py | 2 +- Lib/idlelib/HyperParser.py | 2 +- Lib/plat-mac/aetypes.py | 2 +- Lib/test/list_tests.py | 2 +- Lib/test/test_doctest.py | 2 +- Lib/test/test_grammar.py | 4 +--- Lib/test/test_mutants.py | 2 +- Lib/test/test_site.py | 2 +- Lib/test/test_userdict.py | 2 +- Lib/test/test_weakref.py | 4 ++-- Lib/test/tokenize_tests.txt | 2 +- Lib/wsgiref/headers.py | 2 +- Lib/wsgiref/simple_server.py | 2 +- 13 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index dccd3ff9d17..bc61afb4310 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -1138,7 +1138,7 @@ def newline_and_indent_event(self, event): if not self.context_use_ps1: for context in self.num_context_lines: startat = max(lno - context, 1) - startatindex = `startat` + ".0" + startatindex = repr(startat) + ".0" rawtext = text.get(startatindex, "insert") y.set_str(rawtext) bod = y.find_good_parse_start( diff --git a/Lib/idlelib/HyperParser.py b/Lib/idlelib/HyperParser.py index 519de74d158..31f46b16ac8 100644 --- a/Lib/idlelib/HyperParser.py +++ b/Lib/idlelib/HyperParser.py @@ -31,7 +31,7 @@ def index2line(index): if not editwin.context_use_ps1: for context in editwin.num_context_lines: startat = max(lno - context, 1) - startatindex = `startat` + ".0" + startatindex = repr(startat) + ".0" stopatindex = "%d.end" % lno # We add the newline because PyParse requires a newline at end. # We add a space so that index won't be at end of line, so that diff --git a/Lib/plat-mac/aetypes.py b/Lib/plat-mac/aetypes.py index ea014225421..e5781efd3c4 100644 --- a/Lib/plat-mac/aetypes.py +++ b/Lib/plat-mac/aetypes.py @@ -128,7 +128,7 @@ def __init__(self, keyword): self.keyword = "%-4.4s" % str(keyword) def __repr__(self): - return "Keyword(%r)" % `self.keyword` + return "Keyword(%r)" % self.keyword def __str__(self): return string.strip(self.keyword) diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py index 14b54c77352..453c51c8a70 100644 --- a/Lib/test/list_tests.py +++ b/Lib/test/list_tests.py @@ -37,7 +37,7 @@ def test_repr(self): self.assertEqual(str(a0), str(l0)) self.assertEqual(repr(a0), repr(l0)) - self.assertEqual(`a2`, `l2`) + self.assertEqual(repr(a2), repr(l2)) self.assertEqual(str(a2), "[0, 1, 2]") self.assertEqual(repr(a2), "[0, 1, 2]") diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index e8379c5dc4c..12d75dd2043 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -605,7 +605,7 @@ def test_DocTestParser(): r""" ... if isinstance(piece, doctest.Example): ... print 'Example:', (piece.source, piece.want, piece.lineno) ... else: - ... print ' Text:', `piece` + ... print ' Text:', repr(piece) Text: '\n' Example: ('x, y = 2, 3 # no output expected\n', '', 1) Text: '' diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 0ce43dc6f07..331d52762f6 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -685,7 +685,7 @@ def __getitem__(self, i): print 'atoms' -### atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING +### atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | NAME | NUMBER | STRING ### dictmaker: test ':' test (',' test ':' test)* [','] x = (1) @@ -706,8 +706,6 @@ def __getitem__(self, i): x = {'one': 1, 'two': 2,} x = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6} -x = `x` -x = `1 or 2 or 3` x = x x = 'x' x = 123 diff --git a/Lib/test/test_mutants.py b/Lib/test/test_mutants.py index 7fc9ba3a1b7..8afda75f482 100644 --- a/Lib/test/test_mutants.py +++ b/Lib/test/test_mutants.py @@ -209,7 +209,7 @@ def __repr__(self): # Tim sez: "luck of the draw; crashes with or without for me." print >> f - return `"machiavelli"` + return repr("machiavelli") def __hash__(self): return 0 diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index 05a4ac45017..d379ab5c215 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -164,7 +164,7 @@ def test_abs__file__(self): site.abs__file__() for module in (sys, os, __builtin__): try: - self.failUnless(os.path.isabs(module.__file__), `module`) + self.failUnless(os.path.isabs(module.__file__), repr(module)) except AttributeError: continue # We could try everything in sys.modules; however, when regrtest.py diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py index bc45bf3e9bb..447f434db0e 100644 --- a/Lib/test/test_userdict.py +++ b/Lib/test/test_userdict.py @@ -46,7 +46,7 @@ def test_all(self): # Test __repr__ self.assertEqual(str(u0), str(d0)) self.assertEqual(repr(u1), repr(d1)) - self.assertEqual(`u2`, `d2`) + self.assertEqual(repr(u2), repr(d2)) # Test __cmp__ and __len__ all = [d0, d1, d2, u, u0, u1, u2, uu, uu0, uu1, uu2] diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index f5114b26ce0..1165980c65a 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -51,10 +51,10 @@ def test_basic_ref(self): # Live reference: o = C() wr = weakref.ref(o) - `wr` + repr(wr) # Dead reference: del o - `wr` + repr(wr) def test_basic_callback(self): self.check_basic_callback(C) diff --git a/Lib/test/tokenize_tests.txt b/Lib/test/tokenize_tests.txt index 59e51d7c926..1facfc19057 100644 --- a/Lib/test/tokenize_tests.txt +++ b/Lib/test/tokenize_tests.txt @@ -21,7 +21,7 @@ y = [3, 4, 5] z = {'a':5, 'b':6} -x = (len(`y`) + 5*x - a[ +x = (len(repr(y)) + 5*x - a[ 3 ] - x + len({ } diff --git a/Lib/wsgiref/headers.py b/Lib/wsgiref/headers.py index 0908f60b9b9..c364b26b87f 100644 --- a/Lib/wsgiref/headers.py +++ b/Lib/wsgiref/headers.py @@ -140,7 +140,7 @@ def items(self): return self._headers[:] def __repr__(self): - return "Headers(%s)" % `self._headers` + return "Headers(%r)" % self._headers def __str__(self): """str() returns the formatted headers, complete with end line, diff --git a/Lib/wsgiref/simple_server.py b/Lib/wsgiref/simple_server.py index 95996cc2f3e..e6c9f38baee 100644 --- a/Lib/wsgiref/simple_server.py +++ b/Lib/wsgiref/simple_server.py @@ -169,7 +169,7 @@ def demo_app(environ,start_response): print >>stdout h = environ.items(); h.sort() for k,v in h: - print >>stdout, k,'=',`v` + print >>stdout, k,'=',repr(v) start_response("200 OK", [('Content-Type','text/plain')]) return [stdout.getvalue()]