summaryrefslogtreecommitdiffstats
path: root/Demo/rpc
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2004-02-12 17:35:32 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2004-02-12 17:35:32 (GMT)
commit70a6b49821a3226f55e9716f32d802d06640cb89 (patch)
tree3c8ca10c1fa09e025bd266cf855a00d7d96c55aa /Demo/rpc
parentecfeb7f095dfd9c1c8929bf3df858ee35e0d9e9e (diff)
downloadcpython-70a6b49821a3226f55e9716f32d802d06640cb89.zip
cpython-70a6b49821a3226f55e9716f32d802d06640cb89.tar.gz
cpython-70a6b49821a3226f55e9716f32d802d06640cb89.tar.bz2
Replace backticks with repr() or "%r"
From SF patch #852334.
Diffstat (limited to 'Demo/rpc')
-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
4 files changed, 18 insertions, 19 deletions
diff --git a/Demo/rpc/T.py b/Demo/rpc/T.py
index abf3a06..2adf486 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 e9cad62..90cbd6d 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 f44b3e4..6b15db4 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 41c970a..5338aef 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