[Python-checkins] python/dist/src/Demo/rpc T.py, 1.3, 1.4 rnusersclient.py, 1.3, 1.4 rpc.py, 1.11, 1.12 xdr.py, 1.10, 1.11

doerwalter at users.sourceforge.net doerwalter at users.sourceforge.net
Thu Feb 12 12:35:35 EST 2004


Update of /cvsroot/python/python/dist/src/Demo/rpc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21620/Demo/rpc

Modified Files:
	T.py rnusersclient.py rpc.py xdr.py 
Log Message:
Replace backticks with repr() or "%r"

>From SF patch #852334.


Index: T.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/rpc/T.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** T.py	17 Feb 1994 12:34:54 -0000	1.3
--- T.py	12 Feb 2004 17:35:02 -0000	1.4
***************
*** 19,22 ****
  	msg = ''
  	for x in label: msg = msg + (x + ' ')
! 	msg = msg + `u` + ' user, ' + `s` + ' sys, ' + `r` + ' real\n'
  	sys.stderr.write(msg)
--- 19,22 ----
  	msg = ''
  	for x in label: msg = msg + (x + ' ')
! 	msg = msg + '%r user, %r sys, %r real\n' % (u, s, r)
  	sys.stderr.write(msg)

Index: rnusersclient.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/rpc/rnusersclient.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** rnusersclient.py	17 Dec 1993 14:32:26 -0000	1.3
--- rnusersclient.py	12 Feb 2004 17:35:02 -0000	1.4
***************
*** 78,82 ****
  		name = strip0(name)
  		host = strip0(host)
! 		print `name`, `host`, `line`, time, idle
  
  def testbcast():
--- 78,82 ----
  		name = strip0(name)
  		host = strip0(host)
! 		print "%r %r %r %s %s" % (name, host, line, time, idle)
  
  def testbcast():

Index: rpc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/rpc/rpc.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** rpc.py	21 Jul 1996 02:09:54 -0000	1.11
--- rpc.py	12 Feb 2004 17:35:02 -0000	1.12
***************
*** 94,101 ****
  		temp = self.unpack_enum()
  		if temp <> CALL:
! 			raise BadRPCFormat, 'no CALL but ' + `temp`
  		temp = self.unpack_uint()
  		if temp <> RPCVERSION:
! 			raise BadRPCVerspion, 'bad RPC version ' + `temp`
  		prog = self.unpack_uint()
  		vers = self.unpack_uint()
--- 94,101 ----
  		temp = self.unpack_enum()
  		if temp <> CALL:
! 			raise BadRPCFormat, 'no CALL but %r' % (temp,)
  		temp = self.unpack_uint()
  		if temp <> RPCVERSION:
! 			raise BadRPCVerspion, 'bad RPC version %r' % (temp,)
  		prog = self.unpack_uint()
  		vers = self.unpack_uint()
***************
*** 110,114 ****
  		mtype = self.unpack_enum()
  		if mtype <> REPLY:
! 			raise RuntimeError, 'no REPLY but ' + `mtype`
  		stat = self.unpack_enum()
  		if stat == MSG_DENIED:
--- 110,114 ----
  		mtype = self.unpack_enum()
  		if mtype <> REPLY:
! 			raise RuntimeError, 'no REPLY but %r' % (mtype,)
  		stat = self.unpack_enum()
  		if stat == MSG_DENIED:
***************
*** 118,130 ****
  				high = self.unpack_uint()
  				raise RuntimeError, \
! 				  'MSG_DENIED: RPC_MISMATCH: ' + `low, high`
  			if stat == AUTH_ERROR:
  				stat = self.unpack_uint()
  				raise RuntimeError, \
! 					'MSG_DENIED: AUTH_ERROR: ' + `stat`
! 			raise RuntimeError, 'MSG_DENIED: ' + `stat`
  		if stat <> MSG_ACCEPTED:
  			raise RuntimeError, \
! 			  'Neither MSG_DENIED nor MSG_ACCEPTED: ' + `stat`
  		verf = self.unpack_auth()
  		stat = self.unpack_enum()
--- 118,130 ----
  				high = self.unpack_uint()
  				raise RuntimeError, \
! 				  'MSG_DENIED: RPC_MISMATCH: %r' % ((low, high),)
  			if stat == AUTH_ERROR:
  				stat = self.unpack_uint()
  				raise RuntimeError, \
! 					'MSG_DENIED: AUTH_ERROR: %r' % (stat,)
! 			raise RuntimeError, 'MSG_DENIED: %r' % (stat,)
  		if stat <> MSG_ACCEPTED:
  			raise RuntimeError, \
! 			  'Neither MSG_DENIED nor MSG_ACCEPTED: %r' % (stat,)
  		verf = self.unpack_auth()
  		stat = self.unpack_enum()
***************
*** 135,139 ****
  			high = self.unpack_uint()
  			raise RuntimeError, \
! 				'call failed: PROG_MISMATCH: ' + `low, high`
  		if stat == PROC_UNAVAIL:
  			raise RuntimeError, 'call failed: PROC_UNAVAIL'
--- 135,139 ----
  			high = self.unpack_uint()
  			raise RuntimeError, \
! 				'call failed: PROG_MISMATCH: %r' % ((low, high),)
  		if stat == PROC_UNAVAIL:
  			raise RuntimeError, 'call failed: PROC_UNAVAIL'
***************
*** 141,145 ****
  			raise RuntimeError, 'call failed: GARBAGE_ARGS'
  		if stat <> SUCCESS:
! 			raise RuntimeError, 'call failed: ' + `stat`
  		return xid, verf
  		# Caller must get procedure-specific part of reply
--- 141,145 ----
  			raise RuntimeError, 'call failed: GARBAGE_ARGS'
  		if stat <> SUCCESS:
! 			raise RuntimeError, 'call failed: %r' % (stat,)
  		return xid, verf
  		# Caller must get procedure-specific part of reply
***************
*** 351,356 ****
  		if xid <> self.lastxid:
  			# Can't really happen since this is TCP...
! 			raise RuntimeError, 'wrong xid in reply ' + `xid` + \
! 				' instead of ' + `self.lastxid`
  
  
--- 351,356 ----
  		if xid <> self.lastxid:
  			# Can't really happen since this is TCP...
! 			raise RuntimeError, 'wrong xid in reply %r instead of %r' % (
! 			                     xid, self.lastxid)
  
  
***************
*** 702,706 ****
  			return self.packer.get_buf()
  		proc = self.unpacker.unpack_uint()
! 		methname = 'handle_' + `proc`
  		try:
  			meth = getattr(self, methname)
--- 702,706 ----
  			return self.packer.get_buf()
  		proc = self.unpacker.unpack_uint()
! 		methname = 'handle_' + repr(proc)
  		try:
  			meth = getattr(self, methname)
***************
*** 841,845 ****
  	def rh(reply, fromaddr):
  		host, port = fromaddr
! 		print host + '\t' + `reply`
  	pmap = BroadcastUDPPortMapperClient(bcastaddr)
  	pmap.set_reply_handler(rh)
--- 841,845 ----
  	def rh(reply, fromaddr):
  		host, port = fromaddr
! 		print host + '\t' + repr(reply)
  	pmap = BroadcastUDPPortMapperClient(bcastaddr)
  	pmap.set_reply_handler(rh)
***************
*** 859,863 ****
  			arg = self.unpacker.unpack_string()
  			self.turn_around()
! 			print 'RPC function 1 called, arg', `arg`
  			self.packer.pack_string(arg + arg)
  	#
--- 859,863 ----
  			arg = self.unpacker.unpack_string()
  			self.turn_around()
! 			print 'RPC function 1 called, arg', repr(arg)
  			self.packer.pack_string(arg + arg)
  	#
***************
*** 889,891 ****
  	print 'making call...'
  	reply = c.call_1('hello, world, ')
! 	print 'call returned', `reply`
--- 889,891 ----
  	print 'making call...'
  	reply = c.call_1('hello, world, ')
! 	print 'call returned', repr(reply)

Index: xdr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/rpc/xdr.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** xdr.py	28 Jan 1998 14:59:48 -0000	1.10
--- xdr.py	12 Feb 2004 17:35:02 -0000	1.11
***************
*** 185,190 ****
  			if x == 0: break
  			if x <> 1:
! 				raise RuntimeError, \
! 					'0 or 1 expected, got ' + `x`
  			item = unpack_item()
  			list.append(item)
--- 185,189 ----
  			if x == 0: break
  			if x <> 1:
! 				raise RuntimeError, '0 or 1 expected, got %r' % (x, )
  			item = unpack_item()
  			list.append(item)




More information about the Python-checkins mailing list