-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.py
More file actions
43 lines (33 loc) · 896 Bytes
/
data.py
File metadata and controls
43 lines (33 loc) · 896 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
31
32
33
34
35
36
37
38
39
40
41
42
43
# data.py contains dataclasses and functions to instantiate them.
import uuid
from dataclasses import dataclass
from datetime import datetime
from typing import Optional
@dataclass
class Player:
discord_id: int
challonge_id: str
key_id: uuid.UUID
def new_player(discord_id: int, challonge_id: str) -> Player:
return Player(discord_id, challonge_id, uuid.uuid4())
@dataclass
class Match:
p1: Player
p2: Player
call_message_id: Optional[int]
call_time: Optional[datetime]
warn_time: Optional[datetime]
dq_time: Optional[datetime]
challonge_id: str
key_id: uuid.UUID
def new_match(p1: Player, p2: Player, external_id: str):
return Match(
p1=p1,
p2=p2,
challonge_id=external_id,
call_message_id=None,
call_time=None,
warn_time=None,
dq_time=None,
key_id=uuid.uuid4(),
)