Skip to content

Commit 76cbb78

Browse files
committed
added saving files to the transforma.py
1 parent 66819e4 commit 76cbb78

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

data/public/2024/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# In this folder we have public data
2+
# This may in the future actually end up in this repository
3+
# But for now it's a bit too much noise
4+
*.json

src/transform.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ def extract(cls, values):
148148
if answer.question_text == SubmissionQuestion.level:
149149
values["level"] = answer.answer_text.lower()
150150

151-
152151
slug = slugify(values["title"])
153152
values["slug"] = slug
154153
values["website_url"] = f"https://ep2024.europython.eu/session/{slug}"
@@ -213,26 +212,31 @@ def publishable_speakers(accepted_proposals: set[str]) -> dict[str, PretalxSpeak
213212
return output
214213

215214

216-
# print(len(parse_submissions()))
217-
# print(len(accepted := publishable_submissions()))
215+
def save_publishable_sessions():
216+
path = "../data/public/2024/sessions.json"
217+
218+
publishable = publishable_submissions()
219+
220+
data = {k: v.dict() for k, v in publishable.items()}
221+
with open(path, "w") as fd:
222+
json.dump(data, fd, indent=2)
223+
224+
225+
def save_publishable_speakers():
226+
path = "../data/public/2024/speakers.json"
218227

219-
# print(len(parse_speakers()))
220-
# print(len(publishable_speakers(accepted.keys())))
228+
publishable = publishable_submissions()
229+
speakers = publishable_speakers(publishable.keys())
221230

222-
# # print(
223-
# # json.dumps(
224-
# # [p.dict() for p in publishable_speakers(accepted.keys()).values()],
225-
# # indent=2
226-
# # )
227-
# # )
228-
# print(
229-
# json.dumps([a.dict() for a in accepted.values()], indent=2)
230-
# )
231+
data = {k: v.dict() for k, v in speakers.items()}
232+
with open(path, "w") as fd:
233+
json.dump(data, fd, indent=2)
231234

232235

233-
# # from pprint import pprint
236+
assert len(set(s.slug for s in publishable_submissions().values())) == len(
237+
publishable_submissions()
238+
)
234239

235-
# # pprint(accepted)
236240

237-
# # Check if all the slugs are unique
238-
# assert len(set(s.slug for s in accepted.values())) == len(accepted)
241+
save_publishable_sessions()
242+
save_publishable_speakers()

0 commit comments

Comments
 (0)