Skip to content

Commit b8464d0

Browse files
authored
Add Panel Factory (#46)
* feature(panels): Add PanelFactory * feature(panels): Add PanelFactory and Panel
1 parent 54a9add commit b8464d0

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

prsmsp/factories/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from prsmsp.factories.auth_factory import AuthFactory
22

3-
43
__all__ = [
54
"AuthFactory",
65
]

prsmsp/panel.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from prsmsp.panels import *
2+
3+
class PanelFactory:
4+
5+
@staticmethod
6+
def get(panel_name: str):
7+
8+
PANELS = {
9+
"kavenegar": Kavenegar,
10+
"smsdotir": SmsDotIr,
11+
"webonesms": WebOneSms,
12+
"melipayamak": MeliPayamak,
13+
"mediana": Mediana,
14+
"ghasedaksms": GhasedakSms,
15+
"farazsms": FarazSms,
16+
"niksms": NikSms,
17+
"smsone": SmsOne,
18+
"sapak": Sapak,
19+
}
20+
21+
p = PANELS.get(panel_name, None)
22+
print(p)
23+
if p:
24+
return p
25+
26+
raise KeyError("Panel Not Found")
27+
28+
29+
class Panel:
30+
31+
staticmethod
32+
def initiate(panel_name: str, **auth):
33+
p = PanelFactory.get(panel_name)
34+
35+
return p(*auth.values())

0 commit comments

Comments
 (0)