-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
30 lines (21 loc) · 748 Bytes
/
schemas.py
File metadata and controls
30 lines (21 loc) · 748 Bytes
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
import enum
from datetime import datetime
from typing import Any
from pydantic import BaseModel
class ServiceStatus(str, enum.Enum):
OK = "OK"
WARNING = "WARNING"
ERROR = "ERROR"
class User(BaseModel):
""" User class """
tg_id: str
update_delay_min: int = 10
last_update_time: datetime = datetime.now()
class ServiceInfo(BaseModel):
""" Information about specific service """
service_name: str
service_status: ServiceStatus
def __init__(self, service_name: str, service_status: ServiceStatus):
super().__init__(service_name=service_name, service_status=service_status)
if __name__ == '__main__':
print(ServiceInfo("l", ServiceStatus.ERROR) in [ ServiceInfo("l", ServiceStatus.OK), ])