Skip to content

Commit

Permalink
Updated person.py in warehouse example
Browse files Browse the repository at this point in the history
Updated person.py  in all three phases of warehouse example to match
formatting of other code in the example.
  • Loading branch information
d3spis3d committed Oct 31, 2013
1 parent 15ced54 commit ecc2c89
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/warehouse/Readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This example is the code from the Pyro tutorial where we build a simple
ware house that stores items.
warehouse that stores items.

The idea is that there is one big warehouse that everyone can store items
in, and retrieve other items from (if they're in the warehouse).
Expand Down
3 changes: 3 additions & 0 deletions examples/warehouse/phase1/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
class Person(object):
def __init__(self, name):
self.name = name

def visit(self, warehouse):
print("This is {0}.".format(self.name))
self.deposit(warehouse)
self.retrieve(warehouse)
print("Thank you, come again!")

def deposit(self, warehouse):
print("The warehouse contains:", warehouse.list_contents())
item = input("Type a thing you want to store (or empty): ").strip()
if item:
warehouse.store(self.name, item)

def retrieve(self, warehouse):
print("The warehouse contains:", warehouse.list_contents())
item = input("Type something you want to take (or empty): ").strip()
Expand Down
3 changes: 3 additions & 0 deletions examples/warehouse/phase2/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
class Person(object):
def __init__(self, name):
self.name = name

def visit(self, warehouse):
print("This is {0}.".format(self.name))
self.deposit(warehouse)
self.retrieve(warehouse)
print("Thank you, come again!")

def deposit(self, warehouse):
print("The warehouse contains:", warehouse.list_contents())
item = input("Type a thing you want to store (or empty): ").strip()
if item:
warehouse.store(self.name, item)

def retrieve(self, warehouse):
print("The warehouse contains:", warehouse.list_contents())
item = input("Type something you want to take (or empty): ").strip()
Expand Down
3 changes: 3 additions & 0 deletions examples/warehouse/phase3/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
class Person(object):
def __init__(self, name):
self.name = name

def visit(self, warehouse):
print("This is {0}.".format(self.name))
self.deposit(warehouse)
self.retrieve(warehouse)
print("Thank you, come again!")

def deposit(self, warehouse):
print("The warehouse contains:", warehouse.list_contents())
item = input("Type a thing you want to store (or empty): ").strip()
if item:
warehouse.store(self.name, item)

def retrieve(self, warehouse):
print("The warehouse contains:", warehouse.list_contents())
item = input("Type something you want to take (or empty): ").strip()
Expand Down

0 comments on commit ecc2c89

Please sign in to comment.