-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtransform.py
More file actions
45 lines (39 loc) · 1.71 KB
/
Copy pathtransform.py
File metadata and controls
45 lines (39 loc) · 1.71 KB
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
import sys
from src.config import Config
from src.utils.parse import Parse
from src.utils.timing_relationships import TimingRelationships
from src.utils.transform import Transform
from src.utils.utils import Utils
if __name__ == "__main__":
print(f"Parsing the data from {Config.raw_path}...")
pretalx_submissions = Parse.publishable_submissions(
Config.raw_path / "submissions_latest.json"
)
pretalx_speakers = Parse.publishable_speakers(
Config.raw_path / "speakers_latest.json", pretalx_submissions.keys()
)
pretalx_schedule = Parse.schedule(Config.raw_path / "schedule_latest.json")
print("Computing timing relationships...")
TimingRelationships.compute(pretalx_submissions.values())
print("Transforming the data...")
ep_sessions = Transform.pretalx_submissions_to_europython_sessions(
pretalx_submissions
)
ep_speakers = Transform.pretalx_speakers_to_europython_speakers(pretalx_speakers)
ep_schedule = Transform.pretalx_schedule_to_europython_schedule(
pretalx_schedule.breaks, ep_sessions, ep_speakers
)
# Warn about duplicates if the flag is set
if len(sys.argv) > 1 and sys.argv[1] == "--warn-dupes":
Utils.warn_duplicates(
session_attributes_to_check=["title"],
speaker_attributes_to_check=["name"],
sessions_to_check=ep_sessions,
speakers_to_check=ep_speakers,
)
print(f"Writing the data to {Config.public_path}...")
Utils.write_to_file(Config.public_path / "sessions.json", ep_sessions)
Utils.write_to_file(Config.public_path / "speakers.json", ep_speakers)
Utils.write_to_file(
Config.public_path / "schedule.json", ep_schedule, direct_dump=True
)