-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
47 lines (37 loc) · 1.21 KB
/
main.py
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
from cgitb import handler
from sample import create_samples
from advertisement import ApartmentRent, ApartmentSell, HouseRent, HouseSell, StoreRent, StoreSell
class Handler:
ADVERTISEMENT_TYPES = {
1: ApartmentSell,
# 2:ApartmentRent,
# 3: HouseSell, 4:HouseRent,
# 5: StoreSell, 6:StoreRent,
}
SWITCHES = {
'r': 'get_report',
's': 'show_all',
}
def get_report(self):
for adv in self.ADVERTISEMENT_TYPES.values():
print(adv, adv.manager.count())
def show_all(self):
for adv in self.ADVERTISEMENT_TYPES.values():
# print(adv, adv.manager.count())
for obj in adv.object_list:
print(obj.show_description())
def run(self):
print("Hello World")
for key in self.SWITCHES:
print(f"press {key} for {self.SWITCHES[key]}")
user_input = input("Enter your choice:")
switch = self.SWITCHES.get(user_input, None)
if switch is None:
print("Invalid input")
self.run()
choice = getattr(self, switch, None)
choice()
if __name__ == "__main__":
create_samples()
handler = Handler()
handler.run()