This file is indexed.

/usr/share/doc/pyro/examples/BankExample/client.py is in pyro-examples 1:3.14-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env python

#
#	Bank client.
#
#	The client searches the two banks and performs a set of operations.
#	(the banks are searched simply by listing the :banks namespace!)
#

import sys
import Pyro.naming, Pyro.core

from banks import BankError

group = ':banks1'  # the default namespace group

# A bank client.
class client(object):
	def __init__(self,name):
		self.name=name
	def doBusiness(self, bank):
		print
		print '***',self.name,'is doing business with',bank.name(),':'

		print 'Creating account'
		try:
			bank.createAccount(self.name)
		except BankError,x:
			print 'Failed:',x
			print 'Removing account and trying again'
			bank.deleteAccount(self.name)
			bank.createAccount(self.name)

		print 'Deposit money'
		bank.deposit(self.name, 200.00)
		print 'Deposit money'
		bank.deposit(self.name, 500.75)
		print 'Balance=', bank.balance(self.name)
		print 'Withdraw money'
		bank.withdraw(self.name, 400.00)
		print 'Withdraw money (red)'
		try:
			bank.withdraw(self.name, 400.00)
		except BankError,x:
			print 'Failed:',x
		print 'End balance=', bank.balance(self.name)

		print 'Withdraw money from non-existing account'
		try:
			bank.withdraw('GOD',2222.22)
			print '!!! Succeeded?!? That is an error'
		except BankError,x:
			print 'Failed, as expected:',x

		print 'Deleting non-existing account'
		try:
			bank.deleteAccount('GOD')
			print '!!! Succeeded?!? That is an error'
		except BankError,x:
			print 'Failed, as expected:',x



# initialize the client and set the default namespace group
Pyro.core.initClient()
Pyro.config.PYRO_NS_DEFAULTGROUP=group

# locate the NS
locator = Pyro.naming.NameServerLocator()
print 'Searching Naming Service...',
ns = locator.getNS()

print 'Naming Service found at',ns.URI.address,'('+(Pyro.protocol.getHostname(ns.URI.address) or '??')+') port',ns.URI.port

# List the banks.
# This is done by simply looking in the :banks namespace, to see what
# banks have registered. The filter is for removing any groups that could
# be in the namespace (the type of real names is 1).
banknames = filter(lambda x: x[1]==1, ns.list(group))
banknames = map(lambda (x,y): x, banknames) # keep only the object name
if not banknames:
	raise RuntimeError('There are no banks to do business with!')

banks=[]	# list of banks (proxies)
print
for name in banknames:
	print 'Found a bank: ',name
	try:
		URI=ns.resolve(name)
	except Pyro.core.PyroError,x:
		print 'Bank can\'t be found:',x
		raise SystemExit

	# create a proxy for the bank object
	bank = Pyro.core.getProxyForURI(URI)
	banks.append(bank)

# Different clients
irmen = client('Irmen')
suzy = client('Suzy')

# Try the different banks
for bank in banks:
	irmen.doBusiness(bank)
	suzy.doBusiness(bank)

# List all accounts
print
for bank in banks:
	print 'The accounts in the',bank.name(),':'
	accounts = bank.allAccounts()
	for name in accounts.keys():
		print '  ',name,':',accounts[name]

# Pedantic cleanup
del irmen
del suzy
del banks
del ns