-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.py
51 lines (37 loc) · 1.24 KB
/
account.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
48
49
50
51
class Account:
def __init__(self) -> 'Account':
self.ip = ""
self.pwd = ""
self.user = ""
self.db_pwd = ""
self.branch = ""
@staticmethod
def of(fileBody: 'str') -> 'Account':
parsedBody = fileBody.splitlines()
response = Account()
response.user = parsedBody[0]
response.ip = parsedBody[1]
response.pwd = parsedBody[2]
response.db_pwd = parsedBody[3]
response.branch = parsedBody[4]
return response
def __str__(self) -> 'str':
return self.user+"@"+self.ip
class Command:
def __init__(self,command:'str',duration:'float'=1.0) -> 'Command':
self.command = command
self.duration = duration
def __str__(self) -> 'str':
return self.command+"\n"
@staticmethod
def toArray(fileBody: 'str') -> 'list[Command]':
commands = list()
for command in fileBody.splitlines():
props = command.split(':')
commandBody = props[1].split(',')
req = False
if(props[0] == 'M1'):
req = True
response = Command(commandBody[0],req,commandBody[1])
commands.append(response)
return commands