-
Notifications
You must be signed in to change notification settings - Fork 0
/
accounts_serializer.py
40 lines (29 loc) · 1.07 KB
/
accounts_serializer.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
from typing import List
class Account():
def __init__(self, mail, key, banned = False) -> None:
self.mail = mail
self.key = key
self.banned = banned
def __str__(self) -> str:
return f'{self.mail} {self.key} banned:{self.banned}'
def __repr__(self) -> str:
return f'{self.mail} {self.key} banned:{self.banned}'
def get_accounts(account_file) -> List[Account]:
accounts = list()
with open(account_file, "r", encoding="utf-8") as file:
for line in file:
parts = line.strip().split(":")
if len(parts) >= 2:
mail = parts[0].strip()
key = parts[1].strip()
banned = False
if len(parts) >= 3 and parts[2].strip():
banned = True
accounts.append(Account(mail, key, banned))
return accounts
def became_banned():
pass
if __name__ == '__main__':
accounts = get_accounts(account_file='accounts.txt')
for account in accounts:
print(account)