-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathchart.py
27 lines (21 loc) · 797 Bytes
/
chart.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
from judge_line import JudgeLine
class Chart:
version: int
offset: float
notes_count: int
judge_lines: list[JudgeLine]
def __init__(self, version: int, offset: float, notes_count: int, judge_lines: list[JudgeLine]):
self.version = version
self.offset = offset
self.notes_count = notes_count
self.judge_lines = judge_lines
@classmethod
def from_dict(cls, d: dict):
version = d['formatVersion']
if version == 1:
return cls(version, d['offset'], d['numOfNotes'],
[*map(JudgeLine.from_dict_v1, d['judgeLineList'])])
else:
return cls(version, d['offset'], d['numOfNotes'],
[*map(JudgeLine.from_dict, d['judgeLineList'])])
__all__ = ['Chart']