Skip to content

Commit be8f565

Browse files
committed
Merge pull request faif#81 from LiVincent-Zhang/master
modified the proxy.py.
2 parents 54e2674 + 58b3150 commit be8f565

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

proxy.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
class SalesManager:
8-
98
def work(self):
109
print("Sales Manager working...")
1110

@@ -14,7 +13,6 @@ def talk(self):
1413

1514

1615
class Proxy:
17-
1816
def __init__(self):
1917
self.busy = 'No'
2018
self.sales = None
@@ -30,14 +28,32 @@ def work(self):
3028
print("Sales Manager is busy")
3129

3230

31+
class NoTalkProxy(Proxy):
32+
def __init__(self):
33+
Proxy.__init__(self)
34+
35+
def work(self):
36+
print("Proxy checking for Sales Manager availability")
37+
time.sleep(2)
38+
print("This Sales Manager will not talk to you whether he/she is busy or not")
39+
40+
3341
if __name__ == '__main__':
3442
p = Proxy()
3543
p.work()
3644
p.busy = 'Yes'
3745
p.work()
46+
p = NoTalkProxy()
47+
p.work()
48+
p.busy = 'Yes'
49+
p.work()
3850

3951
### OUTPUT ###
4052
# Proxy checking for Sales Manager availability
4153
# Sales Manager ready to talk
4254
# Proxy checking for Sales Manager availability
4355
# Sales Manager is busy
56+
# Proxy checking for Sales Manager availability
57+
# This Sales Manager will not talk to you whether he/she is busy or not
58+
# Proxy checking for Sales Manager availability
59+
# This Sales Manager will not talk to you whether he/she is busy or not

0 commit comments

Comments
 (0)