-
-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathtable_factory.py
More file actions
23 lines (20 loc) · 651 Bytes
/
Copy pathtable_factory.py
File metadata and controls
23 lines (20 loc) · 651 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"The Factory Class"
from small_table import SmallTable
from medium_table import MediumTable
from big_table import BigTable
class TableFactory: # pylint: disable=too-few-public-methods
"The Factory Class"
@staticmethod
def get_table(table):
"A static method to get a table"
try:
if table == 'BigTable':
return BigTable()
if table == 'MediumTable':
return MediumTable()
if table == 'SmallTable':
return SmallTable()
raise Exception('Table Not Found')
except Exception as _e:
print(_e)
return None