summaryrefslogtreecommitdiff
path: root/Demo
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2004-02-12 17:35:32 +0000
committerWalter Dörwald <walter@livinglogic.de>2004-02-12 17:35:32 +0000
commit582176023213a5bdaf76a19977f7bb6d508694e9 (patch)
treea5f480092a35a71571f1d24bcd10255e1b93e904 /Demo
parentcdef0ac4f0dc828ee205ffa2999592f5fa6f70d3 (diff)
downloadcpython-582176023213a5bdaf76a19977f7bb6d508694e9.tar.gz
Replace backticks with repr() or "%r"
From SF patch #852334.
Diffstat (limited to 'Demo')
-rwxr-xr-xDemo/classes/Complex.py8
-rwxr-xr-xDemo/classes/Dates.py15
-rwxr-xr-xDemo/classes/Dbm.py10
-rwxr-xr-xDemo/classes/Range.py4
-rwxr-xr-xDemo/classes/bitvec.py34
-rw-r--r--Demo/metaclasses/Enum.py6
-rw-r--r--Demo/metaclasses/Meta.py2
-rw-r--r--Demo/metaclasses/Trace.py2
-rw-r--r--Demo/newmetaclasses/Enum.py4
-rwxr-xr-xDemo/pdist/RCSProxy.py2
-rwxr-xr-xDemo/pdist/client.py2
-rwxr-xr-xDemo/pdist/cmdfw.py6
-rwxr-xr-xDemo/pdist/cmptree.py10
-rwxr-xr-xDemo/pdist/cvslock.py2
-rwxr-xr-xDemo/pdist/rcslib.py4
-rwxr-xr-xDemo/pdist/server.py4
-rw-r--r--Demo/rpc/T.py2
-rw-r--r--Demo/rpc/rnusersclient.py2
-rw-r--r--Demo/rpc/rpc.py30
-rw-r--r--Demo/rpc/xdr.py3
-rwxr-xr-xDemo/scripts/eqfix.py19
-rwxr-xr-xDemo/scripts/from.py2
-rwxr-xr-xDemo/scripts/ftpstats.py2
-rwxr-xr-xDemo/scripts/lpwatch.py16
-rwxr-xr-xDemo/scripts/markov.py4
-rwxr-xr-xDemo/scripts/mboxconvert.py4
-rwxr-xr-xDemo/scripts/mkrcs.py20
-rwxr-xr-xDemo/scripts/mpzpi.py2
-rwxr-xr-xDemo/scripts/newslist.py2
-rwxr-xr-xDemo/scripts/pp.py2
-rwxr-xr-xDemo/sockets/broadcast.py2
-rwxr-xr-xDemo/sockets/ftp.py2
-rwxr-xr-xDemo/sockets/gopher.py24
-rwxr-xr-xDemo/sockets/mcast.py4
-rwxr-xr-xDemo/sockets/radio.py2
-rwxr-xr-xDemo/sockets/telnet.py2
-rwxr-xr-xDemo/sockets/udpecho.py4
-rw-r--r--Demo/sockets/unicast.py2
-rw-r--r--Demo/sockets/unixclient.py2
-rw-r--r--Demo/threads/Coroutine.py7
-rw-r--r--Demo/threads/find.py6
-rw-r--r--Demo/threads/sync.py4
-rw-r--r--Demo/threads/telnet.py8
-rwxr-xr-xDemo/tix/samples/DirList.py2
-rwxr-xr-xDemo/tkinter/guido/mbox.py2
-rwxr-xr-xDemo/tkinter/guido/solitaire.py2
-rw-r--r--Demo/tkinter/matt/animation-w-velocity-ctrl.py2
-rw-r--r--Demo/tkinter/matt/pong-demo-1.py2
48 files changed, 151 insertions, 153 deletions
diff --git a/Demo/classes/Complex.py b/Demo/classes/Complex.py
index 4585f62f44..a9f5c2e00b 100755
--- a/Demo/classes/Complex.py
+++ b/Demo/classes/Complex.py
@@ -117,15 +117,15 @@ class Complex:
def __repr__(self):
if not self.im:
- return 'Complex(%s)' % `self.re`
+ return 'Complex(%r)' % (self.re,)
else:
- return 'Complex(%s, %s)' % (`self.re`, `self.im`)
+ return 'Complex(%r, %r)' % (self.re, self.im)
def __str__(self):
if not self.im:
- return `self.re`
+ return repr(self.re)
else:
- return 'Complex(%s, %s)' % (`self.re`, `self.im`)
+ return 'Complex(%r, %r)' % (self.re, self.im)
def __neg__(self):
return Complex(-self.re, -self.im)
diff --git a/Demo/classes/Dates.py b/Demo/classes/Dates.py
index 06ffa36fa9..f8f0634758 100755
--- a/Demo/classes/Dates.py
+++ b/Demo/classes/Dates.py
@@ -86,7 +86,7 @@ _DI400Y = _days_before_year( 400 ) # number of days in 400 years
def _num2date( n ): # return date with ordinal n
if type(n) not in _INT_TYPES:
- raise TypeError, 'argument must be integer: ' + `type(n)`
+ raise TypeError, 'argument must be integer: %r' % type(n)
ans = Date(1,1,1) # arguments irrelevant; just getting a Date obj
del ans.ord, ans.month, ans.day, ans.year # un-initialize it
@@ -120,10 +120,10 @@ def _num2day( n ): # return weekday name of day with ordinal n
class Date:
def __init__( self, month, day, year ):
if not 1 <= month <= 12:
- raise ValueError, 'month must be in 1..12: ' + `month`
+ raise ValueError, 'month must be in 1..12: %r' % (month,)
dim = _days_in_month( month, year )
if not 1 <= day <= dim:
- raise ValueError, 'day must be in 1..' + `dim` + ': ' + `day`
+ raise ValueError, 'day must be in 1..%r: %r' % (dim, day)
self.month, self.day, self.year = month, day, year
self.ord = _date2num( self )
@@ -142,15 +142,16 @@ class Date:
# print as, e.g., Mon 16 Aug 1993
def __repr__( self ):
- return '%.3s %2d %.3s ' % (
+ return '%.3s %2d %.3s %r' % (
self.weekday(),
self.day,
- _MONTH_NAMES[self.month-1] ) + `self.year`
+ _MONTH_NAMES[self.month-1],
+ self.year)
# Python 1.1 coerces neither int+date nor date+int
def __add__( self, n ):
if type(n) not in _INT_TYPES:
- raise TypeError, 'can\'t add ' + `type(n)` + ' to date'
+ raise TypeError, 'can\'t add %r to date' % type(n)
return _num2date( self.ord + n )
__radd__ = __add__ # handle int+date
@@ -177,7 +178,7 @@ DateTestError = 'DateTestError'
def test( firstyear, lastyear ):
a = Date(9,30,1913)
b = Date(9,30,1914)
- if `a` != 'Tue 30 Sep 1913':
+ if repr(a) != 'Tue 30 Sep 1913':
raise DateTestError, '__repr__ failure'
if (not a < b) or a == b or a > b or b != b:
raise DateTestError, '__cmp__ failure'
diff --git a/Demo/classes/Dbm.py b/Demo/classes/Dbm.py
index 5566f999ad..482806a4ee 100755
--- a/Demo/classes/Dbm.py
+++ b/Demo/classes/Dbm.py
@@ -13,7 +13,7 @@ class Dbm:
def __repr__(self):
s = ''
for key in self.keys():
- t = `key` + ': ' + `self[key]`
+ t = repr(key) + ': ' + repr(self[key])
if s: t = ', ' + t
s = s + t
return '{' + s + '}'
@@ -22,13 +22,13 @@ class Dbm:
return len(self.db)
def __getitem__(self, key):
- return eval(self.db[`key`])
+ return eval(self.db[repr(key)])
def __setitem__(self, key, value):
- self.db[`key`] = `value`
+ self.db[repr(key)] = repr(value)
def __delitem__(self, key):
- del self.db[`key`]
+ del self.db[repr(key)]
def keys(self):
res = []
@@ -37,7 +37,7 @@ class Dbm:
return res
def has_key(self, key):
- return self.db.has_key(`key`)
+ return self.db.has_key(repr(key))
def test():
diff --git a/Demo/classes/Range.py b/Demo/classes/Range.py
index ebd18177b2..68f3c61263 100755
--- a/Demo/classes/Range.py
+++ b/Demo/classes/Range.py
@@ -34,9 +34,9 @@ class Range:
self.step = step
self.len = max(0, int((self.stop - self.start) / self.step))
- # implement `x` and is also used by print x
+ # implement repr(x) and is also used by print x
def __repr__(self):
- return 'range' + `self.start, self.stop, self.step`
+ return 'range(%r, %r, %r)' % (self.start, self.stop, self.step)
# implement len(x)
def __len__(self):
diff --git a/Demo/classes/bitvec.py b/Demo/classes/bitvec.py
index ed89d67666..2894a56ae7 100755
--- a/Demo/classes/bitvec.py
+++ b/Demo/classes/bitvec.py
@@ -20,7 +20,7 @@ def _compute_len(param):
mant, l = math.frexp(float(param))
bitmask = 1L << l
if bitmask <= param:
- raise 'FATAL', '(param, l) = ' + `param, l`
+ raise 'FATAL', '(param, l) = %r' % ((param, l),)
while l:
bitmask = bitmask >> 1
if param & bitmask:
@@ -167,10 +167,10 @@ class BitVec:
def __repr__(self):
##rprt('<bitvec class instance object>.' + '__repr__()\n')
- return 'bitvec' + `self._data, self._len`
+ return 'bitvec(%r, %r)' % (self._data, self._len)
def __cmp__(self, other, *rest):
- #rprt(`self`+'.__cmp__'+`(other, ) + rest`+'\n')
+ #rprt('%r.__cmp__%r\n' % (self, (other,) + rest))
if type(other) != type(self):
other = apply(bitvec, (other, ) + rest)
#expensive solution... recursive binary, with slicing
@@ -193,16 +193,16 @@ class BitVec:
def __len__(self):
- #rprt(`self`+'.__len__()\n')
+ #rprt('%r.__len__()\n' % (self,))
return self._len
def __getitem__(self, key):
- #rprt(`self`+'.__getitem__('+`key`+')\n')
+ #rprt('%r.__getitem__(%r)\n' % (self, key))
key = _check_key(self._len, key)
return self._data & (1L << key) != 0
def __setitem__(self, key, value):
- #rprt(`self`+'.__setitem__'+`key, value`+'\n')
+ #rprt('%r.__setitem__(%r, %r)\n' % (self, key, value))
key = _check_key(self._len, key)
#_check_value(value)
if value:
@@ -211,14 +211,14 @@ class BitVec:
self._data = self._data & ~(1L << key)
def __delitem__(self, key):
- #rprt(`self`+'.__delitem__('+`key`+')\n')
+ #rprt('%r.__delitem__(%r)\n' % (self, key))
key = _check_key(self._len, key)
#el cheapo solution...
self._data = self[:key]._data | self[key+1:]._data >> key
self._len = self._len - 1
def __getslice__(self, i, j):
- #rprt(`self`+'.__getslice__'+`i, j`+'\n')
+ #rprt('%r.__getslice__(%r, %r)\n' % (self, i, j))
i, j = _check_slice(self._len, i, j)
if i >= j:
return BitVec(0L, 0)
@@ -234,7 +234,7 @@ class BitVec:
return BitVec(ndata, nlength)
def __setslice__(self, i, j, sequence, *rest):
- #rprt(`self`+'.__setslice__'+`(i, j, sequence) + rest`+'\n')
+ #rprt('%s.__setslice__%r\n' % (self, (i, j, sequence) + rest))
i, j = _check_slice(self._len, i, j)
if type(sequence) != type(self):
sequence = apply(bitvec, (sequence, ) + rest)
@@ -247,7 +247,7 @@ class BitVec:
self._len = self._len - j + i + sequence._len
def __delslice__(self, i, j):
- #rprt(`self`+'.__delslice__'+`i, j`+'\n')
+ #rprt('%r.__delslice__(%r, %r)\n' % (self, i, j))
i, j = _check_slice(self._len, i, j)
if i == 0 and j == self._len:
self._data, self._len = 0L, 0
@@ -256,13 +256,13 @@ class BitVec:
self._len = self._len - j + i
def __add__(self, other):
- #rprt(`self`+'.__add__('+`other`+')\n')
+ #rprt('%r.__add__(%r)\n' % (self, other))
retval = self.copy()
retval[self._len:self._len] = other
return retval
def __mul__(self, multiplier):
- #rprt(`self`+'.__mul__('+`multiplier`+')\n')
+ #rprt('%r.__mul__(%r)\n' % (self, multiplier))
if type(multiplier) != type(0):
raise TypeError, 'sequence subscript not int'
if multiplier <= 0:
@@ -281,7 +281,7 @@ class BitVec:
return retval
def __and__(self, otherseq, *rest):
- #rprt(`self`+'.__and__'+`(otherseq, ) + rest`+'\n')
+ #rprt('%r.__and__%r\n' % (self, (otherseq,) + rest))
if type(otherseq) != type(self):
otherseq = apply(bitvec, (otherseq, ) + rest)
#sequence is now of our own type
@@ -290,7 +290,7 @@ class BitVec:
def __xor__(self, otherseq, *rest):
- #rprt(`self`+'.__xor__'+`(otherseq, ) + rest`+'\n')
+ #rprt('%r.__xor__%r\n' % (self, (otherseq,) + rest))
if type(otherseq) != type(self):
otherseq = apply(bitvec, (otherseq, ) + rest)
#sequence is now of our own type
@@ -299,7 +299,7 @@ class BitVec:
def __or__(self, otherseq, *rest):
- #rprt(`self`+'.__or__'+`(otherseq, ) + rest`+'\n')
+ #rprt('%r.__or__%r\n' % (self, (otherseq,) + rest))
if type(otherseq) != type(self):
otherseq = apply(bitvec, (otherseq, ) + rest)
#sequence is now of our own type
@@ -308,13 +308,13 @@ class BitVec:
def __invert__(self):
- #rprt(`self`+'.__invert__()\n')
+ #rprt('%r.__invert__()\n' % (self,))
return BitVec(~self._data & ((1L << self._len) - 1), \
self._len)
def __coerce__(self, otherseq, *rest):
#needed for *some* of the arithmetic operations
- #rprt(`self`+'.__coerce__'+`(otherseq, ) + rest`+'\n')
+ #rprt('%r.__coerce__%r\n' % (self, (otherseq,) + rest))
if type(otherseq) != type(self):
otherseq = apply(bitvec, (otherseq, ) + rest)
return self, otherseq
diff --git a/Demo/metaclasses/Enum.py b/Demo/metaclasses/Enum.py
index 13a3ed7d6d..df1d8143e6 100644
--- a/Demo/metaclasses/Enum.py
+++ b/Demo/metaclasses/Enum.py
@@ -107,9 +107,9 @@ class EnumInstance:
return self.__value
def __repr__(self):
- return "EnumInstance(%s, %s, %s)" % (`self.__classname`,
- `self.__enumname`,
- `self.__value`)
+ return "EnumInstance(%r, %r, %r)" % (self.__classname,
+ self.__enumname,
+ self.__value)
def __str__(self):
return "%s.%s" % (self.__classname, self.__enumname)
diff --git a/Demo/metaclasses/Meta.py b/Demo/metaclasses/Meta.py
index 39cbef6266..55340749af 100644
--- a/Demo/metaclasses/Meta.py
+++ b/Demo/metaclasses/Meta.py
@@ -98,7 +98,7 @@ def _test():
def __init__(self, *args):
print "__init__, args =", args
def m1(self, x):
- print "m1(x=%s)" %`x`
+ print "m1(x=%r)" % (x,)
print C
x = C()
print x
diff --git a/Demo/metaclasses/Trace.py b/Demo/metaclasses/Trace.py
index 86e199d602..ea12cd9deb 100644
--- a/Demo/metaclasses/Trace.py
+++ b/Demo/metaclasses/Trace.py
@@ -117,7 +117,7 @@ def _test():
def m2(self, y): return self.x + y
__trace_output__ = sys.stdout
class D(C):
- def m2(self, y): print "D.m2(%s)" % `y`; return C.m2(self, y)
+ def m2(self, y): print "D.m2(%r)" % (y,); return C.m2(self, y)
__trace_output__ = None
x = C(4321)
print x
diff --git a/Demo/newmetaclasses/Enum.py b/Demo/newmetaclasses/Enum.py
index 8a00b59f21..5d490a9fc0 100644
--- a/Demo/newmetaclasses/Enum.py
+++ b/Demo/newmetaclasses/Enum.py
@@ -97,7 +97,7 @@ def _test():
print Color.red
- print `Color.red`
+ print repr(Color.red)
print Color.red == Color.red
print Color.red == Color.blue
print Color.red == 1
@@ -139,7 +139,7 @@ def _test2():
print Color.red
- print `Color.red`
+ print repr(Color.red)
print Color.red == Color.red
print Color.red == Color.blue
print Color.red == 1
diff --git a/Demo/pdist/RCSProxy.py b/Demo/pdist/RCSProxy.py
index 7212ca6224..87c65ccf0e 100755
--- a/Demo/pdist/RCSProxy.py
+++ b/Demo/pdist/RCSProxy.py
@@ -188,7 +188,7 @@ def test():
if callable(attr):
print apply(attr, tuple(sys.argv[2:]))
else:
- print `attr`
+ print repr(attr)
else:
print "%s: no such attribute" % what
sys.exit(2)
diff --git a/Demo/pdist/client.py b/Demo/pdist/client.py
index 3e93f1ce8e..a00f005bbc 100755
--- a/Demo/pdist/client.py
+++ b/Demo/pdist/client.py
@@ -139,7 +139,7 @@ class SecureClient(Client, Security):
line = self._rf.readline()
challenge = string.atoi(string.strip(line))
response = self._encode_challenge(challenge)
- line = `long(response)`
+ line = repr(long(response))
if line[-1] in 'Ll': line = line[:-1]
self._wf.write(line + '\n')
self._wf.flush()
diff --git a/Demo/pdist/cmdfw.py b/Demo/pdist/cmdfw.py
index a0c6f5d8ec..25584b78f8 100755
--- a/Demo/pdist/cmdfw.py
+++ b/Demo/pdist/cmdfw.py
@@ -55,7 +55,7 @@ class CommandFrameWork:
try:
method = getattr(self, mname)
except AttributeError:
- return self.usage("command %s unknown" % `cmd`)
+ return self.usage("command %r unknown" % (cmd,))
try:
flags = getattr(self, fname)
except AttributeError:
@@ -75,7 +75,7 @@ class CommandFrameWork:
print "-"*40
print "Options:"
for o, a in opts:
- print 'option', o, 'value', `a`
+ print 'option', o, 'value', repr(a)
print "-"*40
def ready(self):
@@ -137,7 +137,7 @@ def test():
for t in tests:
print '-'*10, t, '-'*10
sts = x.run(t)
- print "Exit status:", `sts`
+ print "Exit status:", repr(sts)
if __name__ == '__main__':
diff --git a/Demo/pdist/cmptree.py b/Demo/pdist/cmptree.py
index 7eaa6c3697..8a34f3f681 100755
--- a/Demo/pdist/cmptree.py
+++ b/Demo/pdist/cmptree.py
@@ -49,7 +49,7 @@ def askint(prompt, default):
def compare(local, remote, mode):
print
- print "PWD =", `os.getcwd()`
+ print "PWD =", repr(os.getcwd())
sums_id = remote._send('sumlist')
subdirs_id = remote._send('listsubdirs')
remote._flush()
@@ -64,13 +64,13 @@ def compare(local, remote, mode):
for name, rsum in sums:
rsumdict[name] = rsum
if not lsumdict.has_key(name):
- print `name`, "only remote"
+ print repr(name), "only remote"
if 'r' in mode and 'c' in mode:
recvfile(local, remote, name)
else:
lsum = lsumdict[name]
if lsum != rsum:
- print `name`,
+ print repr(name),
rmtime = remote.mtime(name)
lmtime = local.mtime(name)
if rmtime > lmtime:
@@ -86,7 +86,7 @@ def compare(local, remote, mode):
print
for name in lsumdict.keys():
if not rsumdict.keys():
- print `name`, "only locally",
+ print repr(name), "only locally",
fl()
if 'w' in mode and 'c' in mode:
sendfile(local, remote, name)
@@ -160,7 +160,7 @@ def recvfile(local, remote, name):
return rv
finally:
if not ok:
- print "*** recvfile of %s failed, deleting" % `name`
+ print "*** recvfile of %r failed, deleting" % (name,)
local.delete(name)
def recvfile_real(local, remote, name):
diff --git a/Demo/pdist/cvslock.py b/Demo/pdist/cvslock.py
index a421e1a943..75f866ee35 100755
--- a/Demo/pdist/cvslock.py
+++ b/Demo/pdist/cvslock.py
@@ -114,7 +114,7 @@ class Lock:
self.delay = delay
self.lockdir = None
self.lockfile = None
- pid = `os.getpid()`
+ pid = repr(os.getpid())
self.cvslck = self.join(CVSLCK)
self.cvsrfl = self.join(CVSRFL + pid)
self.cvswfl = self.join(CVSWFL + pid)
diff --git a/Demo/pdist/rcslib.py b/Demo/pdist/rcslib.py
index 4e72766d24..78de111b14 100755
--- a/Demo/pdist/rcslib.py
+++ b/Demo/pdist/rcslib.py
@@ -232,7 +232,7 @@ class RCS:
"""
name, rev = self._unmangle(name_rev)
if not self.isvalid(name):
- raise os.error, 'not an rcs file %s' % `name`
+ raise os.error, 'not an rcs file %r' % (name,)
return name, rev
# --- Internal methods ---
@@ -252,7 +252,7 @@ class RCS:
namev = self.rcsname(name)
if rev:
cmd = cmd + ' ' + rflag + rev
- return os.popen("%s %s" % (cmd, `namev`))
+ return os.popen("%s %r" % (cmd, namev))
def _unmangle(self, name_rev):
"""INTERNAL: Normalize NAME_REV argument to (NAME, REV) tuple.
diff --git a/Demo/pdist/server.py b/Demo/pdist/server.py
index 423d583007..4e4ab0d252 100755
--- a/Demo/pdist/server.py
+++ b/Demo/pdist/server.py
@@ -134,11 +134,11 @@ class SecureServer(Server, Security):
response = string.atol(string.strip(response))
except string.atol_error:
if self._verbose > 0:
- print "Invalid response syntax", `response`
+ print "Invalid response syntax", repr(response)
return 0
if not self._compare_challenge_response(challenge, response):
if self._verbose > 0:
- print "Invalid response value", `response`
+ print "Invalid response value", repr(response)
return 0
if self._verbose > 1:
print "Response matches challenge. Go ahead!"
diff --git a/Demo/rpc/T.py b/Demo/rpc/T.py
index abf3a06d05..2adf486607 100644
--- a/Demo/rpc/T.py
+++ b/Demo/rpc/T.py
@@ -18,5 +18,5 @@ def TSTOP(*label):
[u, s, r] = tt
msg = ''
for x in label: msg = msg + (x + ' ')
- msg = msg + `u` + ' user, ' + `s` + ' sys, ' + `r` + ' real\n'
+ msg = msg + '%r user, %r sys, %r real\n' % (u, s, r)
sys.stderr.write(msg)
diff --git a/Demo/rpc/rnusersclient.py b/Demo/rpc/rnusersclient.py
index e9cad620fd..90cbd6dae0 100644
--- a/Demo/rpc/rnusersclient.py
+++ b/Demo/rpc/rnusersclient.py
@@ -77,7 +77,7 @@ def test():
line = strip0(line)
name = strip0(name)
host = strip0(host)
- print `name`, `host`, `line`, time, idle
+ print "%r %r %r %s %s" % (name, host, line, time, idle)
def testbcast():
c = BroadcastRnusersClient('<broadcast>')
diff --git a/Demo/rpc/rpc.py b/Demo/rpc/rpc.py
index f44b3e4426..6b15db423e 100644
--- a/Demo/rpc/rpc.py
+++ b/Demo/rpc/rpc.py
@@ -93,10 +93,10 @@ class Unpacker(xdr.Unpacker):
xid = self.unpack_uint(xid)
temp = self.unpack_enum()
if temp <> CALL:
- raise BadRPCFormat, 'no CALL but ' + `temp`
+ raise BadRPCFormat, 'no CALL but %r' % (temp,)
temp = self.unpack_uint()
if temp <> RPCVERSION:
- raise BadRPCVerspion, 'bad RPC version ' + `temp`
+ raise BadRPCVerspion, 'bad RPC version %r' % (temp,)
prog = self.unpack_uint()
vers = self.unpack_uint()
proc = self.unpack_uint()
@@ -109,7 +109,7 @@ class Unpacker(xdr.Unpacker):
xid = self.unpack_uint()
mtype = self.unpack_enum()
if mtype <> REPLY:
- raise RuntimeError, 'no REPLY but ' + `mtype`
+ raise RuntimeError, 'no REPLY but %r' % (mtype,)
stat = self.unpack_enum()
if stat == MSG_DENIED:
stat = self.unpack_enum()
@@ -117,15 +117,15 @@ class Unpacker(xdr.Unpacker):
low = self.unpack_uint()
high = self.unpack_uint()
raise RuntimeError, \
- 'MSG_DENIED: RPC_MISMATCH: ' + `low, high`
+ 'MSG_DENIED: RPC_MISMATCH: %r' % ((low, high),)
if stat == AUTH_ERROR:
stat = self.unpack_uint()
raise RuntimeError, \
- 'MSG_DENIED: AUTH_ERROR: ' + `stat`
- raise RuntimeError, 'MSG_DENIED: ' + `stat`
+ 'MSG_DENIED: AUTH_ERROR: %r' % (stat,)
+ raise RuntimeError, 'MSG_DENIED: %r' % (stat,)
if stat <> MSG_ACCEPTED:
raise RuntimeError, \
- 'Neither MSG_DENIED nor MSG_ACCEPTED: ' + `stat`
+ 'Neither MSG_DENIED nor MSG_ACCEPTED: %r' % (stat,)
verf = self.unpack_auth()
stat = self.unpack_enum()
if stat == PROG_UNAVAIL:
@@ -134,13 +134,13 @@ class Unpacker(xdr.Unpacker):
low = self.unpack_uint()
high = self.unpack_uint()
raise RuntimeError, \
- 'call failed: PROG_MISMATCH: ' + `low, high`
+ 'call failed: PROG_MISMATCH: %r' % ((low, high),)
if stat == PROC_UNAVAIL:
raise RuntimeError, 'call failed: PROC_UNAVAIL'
if stat == GARBAGE_ARGS:
raise RuntimeError, 'call failed: GARBAGE_ARGS'
if stat <> SUCCESS:
- raise RuntimeError, 'call failed: ' + `stat`
+ raise RuntimeError, 'call failed: %r' % (stat,)
return xid, verf
# Caller must get procedure-specific part of reply
@@ -350,8 +350,8 @@ class RawTCPClient(Client):
xid, verf = u.unpack_replyheader()
if xid <> self.lastxid:
# Can't really happen since this is TCP...
- raise RuntimeError, 'wrong xid in reply ' + `xid` + \
- ' instead of ' + `self.lastxid`
+ raise RuntimeError, 'wrong xid in reply %r instead of %r' % (
+ xid, self.lastxid)
# Client using UDP to a specific port
@@ -701,7 +701,7 @@ class Server:
self.packer.pack_uint(self.vers)
return self.packer.get_buf()
proc = self.unpacker.unpack_uint()
- methname = 'handle_' + `proc`
+ methname = 'handle_' + repr(proc)
try:
meth = getattr(self, methname)
except AttributeError:
@@ -840,7 +840,7 @@ def testbcast():
bcastaddr = '<broadcast>'
def rh(reply, fromaddr):
host, port = fromaddr
- print host + '\t' + `reply`
+ print host + '\t' + repr(reply)
pmap = BroadcastUDPPortMapperClient(bcastaddr)
pmap.set_reply_handler(rh)
pmap.set_timeout(5)
@@ -858,7 +858,7 @@ def testsvr():
def handle_1(self):
arg = self.unpacker.unpack_string()
self.turn_around()
- print 'RPC function 1 called, arg', `arg`
+ print 'RPC function 1 called, arg', repr(arg)
self.packer.pack_string(arg + arg)
#
s = S('', 0x20000000, 1, 0)
@@ -888,4 +888,4 @@ def testclt():
c = C(host, 0x20000000, 1)
print 'making call...'
reply = c.call_1('hello, world, ')
- print 'call returned', `reply`
+ print 'call returned', repr(reply)
diff --git a/Demo/rpc/xdr.py b/Demo/rpc/xdr.py
index 41c970ae91..5338aef629 100644
--- a/Demo/rpc/xdr.py
+++ b/Demo/rpc/xdr.py
@@ -184,8 +184,7 @@ class Unpacker:
x = self.unpack_uint()
if x == 0: break
if x <> 1:
- raise RuntimeError, \
- '0 or 1 expected, got ' + `x`
+ raise RuntimeError, '0 or 1 expected, got %r' % (x, )
item = unpack_item()
list.append(item)
return list
diff --git a/Demo/scripts/eqfix.py b/Demo/scripts/eqfix.py
index 583d54e0e7..2139d2bce6 100755
--- a/Demo/scripts/eqfix.py
+++ b/Demo/scripts/eqfix.py
@@ -58,12 +58,12 @@ def ispython(name):
return ispythonprog.match(name) >= 0
def recursedown(dirname):
- dbg('recursedown(' + `dirname` + ')\n')
+ dbg('recursedown(%r)\n' % (dirname,))
bad = 0
try:
names = os.listdir(dirname)
except os.error, msg:
- err(dirname + ': cannot list directory: ' + `msg` + '\n')
+ err('%s: cannot list directory: %r\n' % (dirname, msg))
return 1
names.sort()
subdirs = []
@@ -80,11 +80,11 @@ def recursedown(dirname):
return bad
def fix(filename):
-## dbg('fix(' + `filename` + ')\n')
+## dbg('fix(%r)\n' % (dirname,))
try:
f = open(filename, 'r')
except IOError, msg:
- err(filename + ': cannot open: ' + `msg` + '\n')
+ err('%s: cannot open: %r\n' % (filename, msg))
return 1
head, tail = os.path.split(filename)
tempname = os.path.join(head, '@' + tail)
@@ -122,14 +122,13 @@ def fix(filename):
g = open(tempname, 'w')
except IOError, msg:
f.close()
- err(tempname+': cannot create: '+\
- `msg`+'\n')
+ err('%s: cannot create: %r\n' % (tempname, msg))
return 1
f.seek(0)
lineno = 0
rep(filename + ':\n')
continue # restart from the beginning
- rep(`lineno` + '\n')
+ rep(repr(lineno) + '\n')
rep('< ' + line)
rep('> ' + newline)
if g is not None:
@@ -146,17 +145,17 @@ def fix(filename):
statbuf = os.stat(filename)
os.chmod(tempname, statbuf[ST_MODE] & 07777)
except os.error, msg:
- err(tempname + ': warning: chmod failed (' + `msg` + ')\n')
+ err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
# Then make a backup of the original file as filename~
try:
os.rename(filename, filename + '~')
except os.error, msg:
- err(filename + ': warning: backup failed (' + `msg` + ')\n')
+ err('%s: warning: backup failed (%r)\n' % (filename, msg))
# Now move the temp file to the original file
try:
os.rename(tempname, filename)
except os.error, msg:
- err(filename + ': rename failed (' + `msg` + ')\n')
+ err('%s: rename failed (%r)\n' % (filename, msg))
return 1
# Return succes
return 0
diff --git a/Demo/scripts/from.py b/Demo/scripts/from.py
index d61afde06e..3c04fcd497 100755
--- a/Demo/scripts/from.py
+++ b/Demo/scripts/from.py
@@ -31,5 +31,5 @@ while 1:
if not line or line == '\n':
break
if line.startswith('Subject: '):
- print `line[9:-1]`,
+ print repr(line[9:-1]),
print
diff --git a/Demo/scripts/ftpstats.py b/Demo/scripts/ftpstats.py
index 28b1d8bdfd..79cbee63a4 100755
--- a/Demo/scripts/ftpstats.py
+++ b/Demo/scripts/ftpstats.py
@@ -60,7 +60,7 @@ def main():
if search and string.find(line, search) < 0:
continue
if prog.match(line) < 0:
- print 'Bad line', lineno, ':', `line`
+ print 'Bad line', lineno, ':', repr(line)
continue
items = prog.group(1, 2, 3, 4, 5, 6)
(logtime, loguser, loghost, logfile, logbytes,
diff --git a/Demo/scripts/lpwatch.py b/Demo/scripts/lpwatch.py
index 9f051ebbf3..00afba9d6b 100755
--- a/Demo/scripts/lpwatch.py
+++ b/Demo/scripts/lpwatch.py
@@ -83,24 +83,24 @@ def makestatus(name, thisuser):
lines.append(line)
#
if totaljobs:
- line = `(totalbytes+1023)/1024` + ' K'
+ line = '%d K' % ((totalbytes+1023)/1024)
if totaljobs <> len(users):
- line = line + ' (' + `totaljobs` + ' jobs)'
+ line = line + ' (%d jobs)' % totaljobs
if len(users) == 1:
- line = line + ' for ' + users.keys()[0]
+ line = line + ' for %s' % (users.keys()[0],)
else:
- line = line + ' for ' + `len(users)` + ' users'
+ line = line + ' for %d users' % len(users)
if userseen:
if aheadjobs == 0:
- line = line + ' (' + thisuser + ' first)'
+ line = line + ' (%s first)' % thisuser
else:
- line = line + ' (' + `(aheadbytes+1023)/1024`
- line = line + ' K before ' + thisuser + ')'
+ line = line + ' (%d K before %s)' % (
+ (aheadbytes+1023)/1024, thisuser)
lines.append(line)
#
sts = pipe.close()
if sts:
- lines.append('lpq exit status ' + `sts`)
+ lines.append('lpq exit status %r' % (sts,))
return string.joinfields(lines, ': ')
try:
diff --git a/Demo/scripts/markov.py b/Demo/scripts/markov.py
index e1649f1e9d..b0583d1a5a 100755
--- a/Demo/scripts/markov.py
+++ b/Demo/scripts/markov.py
@@ -89,8 +89,8 @@ def test():
if debug > 1:
for key in m.trans.keys():
if key is None or len(key) < histsize:
- print `key`, m.trans[key]
- if histsize == 0: print `''`, m.trans['']
+ print repr(key), m.trans[key]
+ if histsize == 0: print repr(''), m.trans['']
print
while 1:
data = m.get()
diff --git a/Demo/scripts/mboxconvert.py b/Demo/scripts/mboxconvert.py
index 08e0d0cbe5..996537d392 100755
--- a/Demo/scripts/mboxconvert.py
+++ b/Demo/scripts/mboxconvert.py
@@ -73,7 +73,7 @@ def mmdf(f):
sts = message(f, line) or sts
else:
sys.stderr.write(
- 'Bad line in MMFD mailbox: %s\n' % `line`)
+ 'Bad line in MMFD mailbox: %r\n' % (line,))
return sts
counter = 0 # for generating unique Message-ID headers
@@ -89,7 +89,7 @@ def message(f, delimiter = ''):
t = time.mktime(tt)
else:
sys.stderr.write(
- 'Unparseable date: %s\n' % `m.getheader('Date')`)
+ 'Unparseable date: %r\n' % (m.getheader('Date'),))
t = os.fstat(f.fileno())[stat.ST_MTIME]
print 'From', email, time.ctime(t)
# Copy RFC822 header
diff --git a/Demo/scripts/mkrcs.py b/Demo/scripts/mkrcs.py
index 36a35eace2..917b4fe2cb 100755
--- a/Demo/scripts/mkrcs.py
+++ b/Demo/scripts/mkrcs.py
@@ -12,13 +12,13 @@ def main():
rcstree = 'RCStree'
rcs = 'RCS'
if os.path.islink(rcs):
- print `rcs`, 'is a symlink to', `os.readlink(rcs)`
+ print '%r is a symlink to %r' % (rcs, os.readlink(rcs))
return
if os.path.isdir(rcs):
- print `rcs`, 'is an ordinary directory'
+ print '%r is an ordinary directory' % (rcs,)
return
if os.path.exists(rcs):
- print `rcs`, 'is a file?!?!'
+ print '%r is a file?!?!' % (rcs,)
return
#
p = os.getcwd()
@@ -29,26 +29,26 @@ def main():
# (2) up is the same directory as p
# Ergo:
# (3) join(up, down) is the current directory
- #print 'p =', `p`
+ #print 'p =', repr(p)
while not os.path.isdir(os.path.join(p, rcstree)):
head, tail = os.path.split(p)
- #print 'head =', `head`, '; tail =', `tail`
+ #print 'head = %r; tail = %r' % (head, tail)
if not tail:
- print 'Sorry, no ancestor dir contains', `rcstree`
+ print 'Sorry, no ancestor dir contains %r' % (rcstree,)
return
p = head
up = os.path.join(os.pardir, up)
down = os.path.join(tail, down)
- #print 'p =', `p`, '; up =', `up`, '; down =', `down`
+ #print 'p = %r; up = %r; down = %r' % (p, up, down)
there = os.path.join(up, rcstree)
there = os.path.join(there, down)
there = os.path.join(there, rcs)
if os.path.isdir(there):
- print `there`, 'already exists'
+ print '%r already exists' % (there, )
else:
- print 'making', `there`
+ print 'making %r' % (there,)
makedirs(there)
- print 'making symlink', `rcs`, '->', `there`
+ print 'making symlink %r -> %r' % (rcs, there)
os.symlink(there, rcs)
def makedirs(p):
diff --git a/Demo/scripts/mpzpi.py b/Demo/scripts/mpzpi.py
index 93c74aa398..ccf591d79d 100755
--- a/Demo/scripts/mpzpi.py
+++ b/Demo/scripts/mpzpi.py
@@ -27,7 +27,7 @@ def main():
def output(d):
# Use write() to avoid spaces between the digits
# Use int(d) to avoid a trailing L after each digit
- sys.stdout.write(`int(d)`)
+ sys.stdout.write(repr(int(d)))
# Flush so the output is seen immediately
sys.stdout.flush()
diff --git a/Demo/scripts/newslist.py b/Demo/scripts/newslist.py
index f78ca30271..b06b452e36 100755
--- a/Demo/scripts/newslist.py
+++ b/Demo/scripts/newslist.py
@@ -304,7 +304,7 @@ def getallgroups(server):
def getnewgroups(server, treedate):
print 'Getting list of new groups since start of '+treedate+'...',
info = server.newgroups(treedate,'000001')[1]
- print 'got '+`len(info)`+'.'
+ print 'got %d.' % len(info)
print 'Processing...',
groups = []
for i in info:
diff --git a/Demo/scripts/pp.py b/Demo/scripts/pp.py
index 64e57ee15f..92a1104b0b 100755
--- a/Demo/scripts/pp.py
+++ b/Demo/scripts/pp.py
@@ -125,6 +125,6 @@ fp.write(program)
fp.flush()
if DFLAG:
import pdb
- pdb.run('execfile(' + `tfn` + ')')
+ pdb.run('execfile(%r)' % (tfn,))
else:
execfile(tfn)
diff --git a/Demo/sockets/broadcast.py b/Demo/sockets/broadcast.py
index a02b081a2e..010162c05d 100755
--- a/Demo/sockets/broadcast.py
+++ b/Demo/sockets/broadcast.py
@@ -10,7 +10,7 @@ s.bind(('', 0))
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
while 1:
- data = `time.time()` + '\n'
+ data = repr(time.time()) + '\n'
s.sendto(data, ('<broadcast>', MYPORT))
time.sleep(2)
diff --git a/Demo/sockets/ftp.py b/Demo/sockets/ftp.py
index 8260c52f9c..9e1d5a14f8 100755
--- a/Demo/sockets/ftp.py
+++ b/Demo/sockets/ftp.py
@@ -91,7 +91,7 @@ def sendportcmd(s, f, port):
hostname = gethostname()
hostaddr = gethostbyname(hostname)
hbytes = string.splitfields(hostaddr, '.')
- pbytes = [`port/256`, `port%256`]
+ pbytes = [repr(port/256), repr(port%256)]
bytes = hbytes + pbytes
cmd = 'PORT ' + string.joinfields(bytes, ',')
s.send(cmd + '\r\n')
diff --git a/Demo/sockets/gopher.py b/Demo/sockets/gopher.py
index a2ab3a2f6c..4e1cb30c2e 100755
--- a/Demo/sockets/gopher.py
+++ b/Demo/sockets/gopher.py
@@ -75,10 +75,10 @@ def get_menu(selector, host, port):
typechar = line[0]
parts = string.splitfields(line[1:], TAB)
if len(parts) < 4:
- print '(Bad line from server:', `line`, ')'
+ print '(Bad line from server: %r)' % (line,)
continue
if len(parts) > 4:
- print '(Extra info from server:', parts[4:], ')'
+ print '(Extra info from server: %r)' % (parts[4:],)
parts.insert(0, typechar)
list.append(parts)
f.close()
@@ -154,17 +154,17 @@ def browse_menu(selector, host, port):
list = get_menu(selector, host, port)
while 1:
print '----- MENU -----'
- print 'Selector:', `selector`
+ print 'Selector:', repr(selector)
print 'Host:', host, ' Port:', port
print
for i in range(len(list)):
item = list[i]
typechar, description = item[0], item[1]
- print string.rjust(`i+1`, 3) + ':', description,
+ print string.rjust(repr(i+1), 3) + ':', description,
if typename.has_key(typechar):
print typename[typechar]
else:
- print '<TYPE=' + `typechar` + '>'
+ print '<TYPE=' + repr(typechar) + '>'
print
while 1:
try:
@@ -221,7 +221,7 @@ def browse_textfile(selector, host, port):
def browse_search(selector, host, port):
while 1:
print '----- SEARCH -----'
- print 'Selector:', `selector`
+ print 'Selector:', repr(selector)
print 'Host:', host, ' Port:', port
print
try:
@@ -240,9 +240,9 @@ def browse_search(selector, host, port):
# "Browse" telnet-based information, i.e. open a telnet session
def browse_telnet(selector, host, port):
if selector:
- print 'Log in as', `selector`
+ print 'Log in as', repr(selector)
if type(port) <> type(''):
- port = `port`
+ port = repr(port)
sts = os.system('set -x; exec telnet ' + host + ' ' + port)
if sts:
print 'Exit status:', sts
@@ -307,18 +307,18 @@ def open_savefile():
try:
p = os.popen(cmd, 'w')
except IOError, msg:
- print `cmd`, ':', msg
+ print repr(cmd), ':', msg
return None
- print 'Piping through', `cmd`, '...'
+ print 'Piping through', repr(cmd), '...'
return p
if savefile[0] == '~':
savefile = os.path.expanduser(savefile)
try:
f = open(savefile, 'w')
except IOError, msg:
- print `savefile`, ':', msg
+ print repr(savefile), ':', msg
return None
- print 'Saving to', `savefile`, '...'
+ print 'Saving to', repr(savefile), '...'
return f
# Test program
diff --git a/Demo/sockets/mcast.py b/Demo/sockets/mcast.py
index cc7a7e07d4..71bcc755aa 100755
--- a/Demo/sockets/mcast.py
+++ b/Demo/sockets/mcast.py
@@ -38,7 +38,7 @@ def sender(flag):
ttl = struct.pack('b', 1) # Time-to-live
s.setsockopt(IPPROTO_IP, IP_MULTICAST_TTL, ttl)
while 1:
- data = `time.time()`
+ data = repr(time.time())
## data = data + (1400 - len(data)) * '\0'
s.sendto(data, (mygroup, MYPORT))
time.sleep(1)
@@ -53,7 +53,7 @@ def receiver():
while 1:
data, sender = s.recvfrom(1500)
while data[-1:] == '\0': data = data[:-1] # Strip trailing \0's
- print sender, ':', `data`
+ print sender, ':', repr(data)
# Open a UDP socket, bind it to a port and select a multicast group
diff --git a/Demo/sockets/radio.py b/Demo/sockets/radio.py
index 6131d40053..b68a4ecd1e 100755
--- a/Demo/sockets/radio.py
+++ b/Demo/sockets/radio.py
@@ -10,5 +10,5 @@ s.bind(('', MYPORT))
while 1:
data, wherefrom = s.recvfrom(1500, 0)
- sys.stderr.write(`wherefrom` + '\n')
+ sys.stderr.write(repr(wherefrom) + '\n')
sys.stdout.write(data)
diff --git a/Demo/sockets/telnet.py b/Demo/sockets/telnet.py
index ee7c43b874..d86cbeb695 100755
--- a/Demo/sockets/telnet.py
+++ b/Demo/sockets/telnet.py
@@ -53,7 +53,7 @@ def main():
try:
s.connect((host, port))
except error, msg:
- sys.stderr.write('connect failed: ' + `msg` + '\n')
+ sys.stderr.write('connect failed: ' + repr(msg) + '\n')
sys.exit(1)
#
pid = posix.fork()
diff --git a/Demo/sockets/udpecho.py b/Demo/sockets/udpecho.py
index 4410165e3a..720cfe113f 100755
--- a/Demo/sockets/udpecho.py
+++ b/Demo/sockets/udpecho.py
@@ -37,7 +37,7 @@ def server():
print 'udp echo server ready'
while 1:
data, addr = s.recvfrom(BUFSIZE)
- print 'server received', `data`, 'from', `addr`
+ print 'server received %r from %r' % (data, addr)
s.sendto(data, addr)
def client():
@@ -58,6 +58,6 @@ def client():
break
s.sendto(line, addr)
data, fromaddr = s.recvfrom(BUFSIZE)
- print 'client received', `data`, 'from', `fromaddr`
+ print 'client received %r from %r' % (data, fromaddr)
main()
diff --git a/Demo/sockets/unicast.py b/Demo/sockets/unicast.py
index 1e9caebd2a..0a30f3560f 100644
--- a/Demo/sockets/unicast.py
+++ b/Demo/sockets/unicast.py
@@ -9,7 +9,7 @@ s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 0))
while 1:
- data = `time.time()` + '\n'
+ data = repr(time.time()) + '\n'
s.sendto(data, ('', MYPORT))
time.sleep(2)
diff --git a/Demo/sockets/unixclient.py b/Demo/sockets/unixclient.py
index a0d80f6083..cccd617e97 100644
--- a/Demo/sockets/unixclient.py
+++ b/Demo/sockets/unixclient.py
@@ -7,4 +7,4 @@ s.connect(FILE)
s.send('Hello, world')
data = s.recv(1024)
s.close()
-print 'Received', `data`
+print 'Received', repr(data)
diff --git a/Demo/threads/Coroutine.py b/Demo/threads/Coroutine.py
index 0cf9255362..4cc65f7bf8 100644
--- a/Demo/threads/Coroutine.py
+++ b/Demo/threads/Coroutine.py
@@ -138,10 +138,9 @@ class Coroutine:
def tran(self, target, data=None):
if not self.invokedby.has_key(target):
- raise TypeError, '.tran target ' + `target` + \
- ' is not an active coroutine'
+ raise TypeError, '.tran target %r is not an active coroutine' % (target,)
if self.killed:
- raise TypeError, '.tran target ' + `target` + ' is killed'
+ raise TypeError, '.tran target %r is killed' % (target,)
self.value = data
me = self.active
self.invokedby[target] = me
@@ -153,7 +152,7 @@ class Coroutine:
if self.main is not me:
raise Killed
if self.terminated_by is not None:
- raise EarlyExit, `self.terminated_by` + ' terminated early'
+ raise EarlyExit, '%r terminated early' % (self.terminated_by,)
return self.value
diff --git a/Demo/threads/find.py b/Demo/threads/find.py
index ab581e3473..7d5edc1c50 100644
--- a/Demo/threads/find.py
+++ b/Demo/threads/find.py
@@ -116,7 +116,7 @@ def main():
wq.run(nworkers)
t2 = time.time()
- sys.stderr.write('Total time ' + `t2-t1` + ' sec.\n')
+ sys.stderr.write('Total time %r sec.\n' % (t2-t1))
# The predicate -- defines what files we look for.
@@ -133,7 +133,7 @@ def find(dir, pred, wq):
try:
names = os.listdir(dir)
except os.error, msg:
- print `dir`, ':', msg
+ print repr(dir), ':', msg
return
for name in names:
if name not in (os.curdir, os.pardir):
@@ -141,7 +141,7 @@ def find(dir, pred, wq):
try:
stat = os.lstat(fullname)
except os.error, msg:
- print `fullname`, ':', msg
+ print repr(fullname), ':', msg
continue
if pred(dir, name, fullname, stat):
print fullname
diff --git a/Demo/threads/sync.py b/Demo/threads/sync.py
index a8556c48ef..1688403b7f 100644
--- a/Demo/threads/sync.py
+++ b/Demo/threads/sync.py
@@ -336,7 +336,7 @@ class condition:
def broadcast(self, num = -1):
if num < -1:
- raise ValueError, '.broadcast called with num ' + `num`
+ raise ValueError, '.broadcast called with num %r' % (num,)
if num == 0:
return
self.idlock.acquire()
@@ -418,7 +418,7 @@ class semaphore:
self.nonzero.acquire()
if self.count == self.maxcount:
raise ValueError, '.v() tried to raise semaphore count above ' \
- 'initial value ' + `maxcount`
+ 'initial value %r' % (maxcount,))
self.count = self.count + 1
self.nonzero.signal()
self.nonzero.release()
diff --git a/Demo/threads/telnet.py b/Demo/threads/telnet.py
index 3c70cb0038..707a35386f 100644
--- a/Demo/threads/telnet.py
+++ b/Demo/threads/telnet.py
@@ -57,7 +57,7 @@ def main():
try:
s.connect((host, port))
except error, msg:
- sys.stderr.write('connect failed: ' + `msg` + '\n')
+ sys.stderr.write('connect failed: %r\n' % (msg,))
sys.exit(1)
#
thread.start_new(child, (s,))
@@ -77,7 +77,7 @@ def parent(s):
for c in data:
if opt:
print ord(c)
-## print '(replying: ' + `opt+c` + ')'
+## print '(replying: %r)' % (opt+c,)
s.send(opt + c)
opt = ''
elif iac:
@@ -101,13 +101,13 @@ def parent(s):
cleandata = cleandata + c
sys.stdout.write(cleandata)
sys.stdout.flush()
-## print 'Out:', `cleandata`
+## print 'Out:', repr(cleandata)
def child(s):
# read stdin, write socket
while 1:
line = sys.stdin.readline()
-## print 'Got:', `line`
+## print 'Got:', repr(line)
if not line: break
s.send(line)
diff --git a/Demo/tix/samples/DirList.py b/Demo/tix/samples/DirList.py
index b2aad336fc..8d7536c7bd 100755
--- a/Demo/tix/samples/DirList.py
+++ b/Demo/tix/samples/DirList.py
@@ -75,7 +75,7 @@ class DemoDirList:
top.btn['command'] = lambda dir=top.dir, ent=top.ent, self=self: \
self.copy_name(dir,ent)
- # top.ent.entry.insert(0,'tix'+`self`)
+ # top.ent.entry.insert(0,'tix'+repr(self))
top.ent.entry.bind('<Return>', lambda self=self: self.okcmd () )
top.pack( expand='yes', fill='both', side=TOP)
diff --git a/Demo/tkinter/guido/mbox.py b/Demo/tkinter/guido/mbox.py
index 9aea7ee5b1..6d7a4106cc 100755
--- a/Demo/tkinter/guido/mbox.py
+++ b/Demo/tkinter/guido/mbox.py
@@ -253,7 +253,7 @@ def refile_message(e=None):
def fixfocus(near, itop):
n = scanbox.size()
for i in range(n):
- line = scanbox.get(`i`)
+ line = scanbox.get(repr(i))
if scanparser.match(line) >= 0:
num = string.atoi(scanparser.group(1))
if num >= near:
diff --git a/Demo/tkinter/guido/solitaire.py b/Demo/tkinter/guido/solitaire.py
index bd7328da59..a205afd3ba 100755
--- a/Demo/tkinter/guido/solitaire.py
+++ b/Demo/tkinter/guido/solitaire.py
@@ -183,7 +183,7 @@ class Card:
def __repr__(self):
"""Return a string for debug print statements."""
- return "Card(%s, %s)" % (`self.suit`, `self.value`)
+ return "Card(%r, %r)" % (self.suit, self.value)
def moveto(self, x, y):
"""Move the card to absolute position (x, y)."""
diff --git a/Demo/tkinter/matt/animation-w-velocity-ctrl.py b/Demo/tkinter/matt/animation-w-velocity-ctrl.py
index a45f3f0e8a..f3332f2c48 100644
--- a/Demo/tkinter/matt/animation-w-velocity-ctrl.py
+++ b/Demo/tkinter/matt/animation-w-velocity-ctrl.py
@@ -28,7 +28,7 @@ class Test(Frame):
def moveThing(self, *args):
velocity = self.speed.get()
str = float(velocity) / 1000.0
- str = `str` + "i"
+ str = "%ri" % (str,)
self.draw.move("thing", str, str)
self.after(10, self.moveThing)
diff --git a/Demo/tkinter/matt/pong-demo-1.py b/Demo/tkinter/matt/pong-demo-1.py
index dacaa38272..a27f334f8a 100644
--- a/Demo/tkinter/matt/pong-demo-1.py
+++ b/Demo/tkinter/matt/pong-demo-1.py
@@ -39,7 +39,7 @@ class Pong(Frame):
self.x = self.x + deltax
self.y = self.y + deltay
- self.draw.move(self.ball, `deltax` + "i", `deltay` + "i")
+ self.draw.move(self.ball, "%ri" % deltax, "%ri" % deltay)
self.after(10, self.moveBall)
def __init__(self, master=None):