-
-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathfurniture_factory.py
More file actions
22 lines (19 loc) · 795 Bytes
/
furniture_factory.py
File metadata and controls
22 lines (19 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# pylint: disable=too-few-public-methods
"Abstract Furniture Factory"
from interface_furniture_factory import IFurnitureFactory
from chair_factory import ChairFactory
from table_factory import TableFactory
class FurnitureFactory(IFurnitureFactory):
"The Abstract Factory Concrete Class"
@staticmethod
def get_furniture(furniture):
"Static get_factory method"
try:
if furniture in ['SmallChair', 'MediumChair', 'BigChair']:
return ChairFactory.get_chair(furniture)
if furniture in ['SmallTable', 'MediumTable', 'BigTable']:
return TableFactory.get_table(furniture)
raise Exception('No Factory Found')
except Exception as _e:
print(_e)
return None