This file is indexed.

/usr/share/doc/pyro/examples/agent2/agent/ShoppingAgent.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
# this module contains the ShoppingAgent code

class ShoppingAgent(object):
	def __init__(self, name):
		self.name=name
		self.productsToBuy=[]
		self.productsBought={}
		self.boughtObjects=[]
		self.cash=0
		self.shopsVisited=0
	def shoppingList(self, products):
		self.productsToBuy=products
	def cashLimit(self,cash):
		self.cash=cash
	def visitShop(self, shop):
		print self.name,'is visiting',shop.name
		self.shopsVisited+=1
		goods = shop.getStock()
		for p in self.productsToBuy[:]:
			if goods.has_key(p):
				price = goods[p]
				if price<=self.cash:
					self.cash-=price
					# buy an object from the shop
					object=shop.buy(self,p)
					# The object is "the real thing"; an instance.
					# store it in our pockets. We will return with
					# this to the client.
					self.boughtObjects.append(object)
					self.productsBought[p]=shop.name
					self.productsToBuy.remove(p)
	def result(self):
		print 'My name is',self.name
		print '  I have bought:'
		for p in self.productsBought.keys():
			print '\t',p,'('+self.productsBought[p]+')'
		print '  I couldn\'t buy:',
		for p in self.productsToBuy:
			print p,
		print '\n  Cash left:',self.cash,
		print 'after visiting',self.shopsVisited,'shops'
	def describeObjects(self):
		print "Now describing the objects I've bought:"
		for obj in self.boughtObjects:
			# notice that these use the actual objects
			# transferred from the server to the client!
			print ' ',obj.getName(),'-',obj.getDescription()
		if not self.boughtObjects:
			print "I've got nothing..."
	def __str__(self):
		return self.name