Skip to content

Commit f2a80eb

Browse files
committed
Artur's suggestions
1 parent d0a756c commit f2a80eb

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ deps/install:
1111
install: deps/install
1212

1313
download:
14-
cd src && python download.py
14+
python -m src.download
1515

1616
transform:
17-
cd src && python transform.py
17+
python -m src.transform
1818

1919

2020
all: download transform

src/download.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import json
2-
from pathlib import Path
32

43
import requests
54

6-
try:
7-
from config import Config
8-
except ImportError:
9-
from src.config import Config
10-
5+
from src.config import Config
116

127
headers = {
138
"Accept": "application/json, text/javascript",
@@ -44,7 +39,7 @@
4439

4540
filename = resource.split("?")[0] # To get rid of "?questions"
4641
filename = f"{filename}_latest.json"
47-
filepath = Path.joinpath(Config.raw_path, filename)
42+
filepath = Config.raw_path / filename
4843

4944
with open(filepath, "w") as fd:
5045
json.dump(res0, fd)

src/transform.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import json
22
from datetime import datetime
3-
from pathlib import Path
43

54
from pydantic import BaseModel, Field
65
from pydantic.class_validators import root_validator
76
from slugify import slugify
87

9-
try:
10-
from config import Config
11-
except ImportError:
12-
from src.config import Config
8+
from src.config import Config
139

1410

1511
class SpeakerQuestion:
@@ -175,7 +171,7 @@ def parse_submissions() -> list[PretalxSubmission]:
175171
"""
176172
Returns only confirmed talks
177173
"""
178-
with open(Path.joinpath(Config.raw_path, "submissions_latest.json")) as fd:
174+
with open(Config.raw_path / "submissions_latest.json") as fd:
179175
js = json.load(fd)
180176
subs = []
181177
for item in js:
@@ -189,7 +185,7 @@ def parse_speakers() -> list[PretalxSpeaker]:
189185
"""
190186
Returns only speakers with confirmed talks
191187
"""
192-
with open(Path.joinpath(Config.raw_path, "speakers_latest.json")) as fd:
188+
with open(Config.raw_path / "speakers_latest.json") as fd:
193189
js = json.load(fd)
194190
speakers = []
195191
for item in js:
@@ -217,7 +213,7 @@ def publishable_speakers(accepted_proposals: set[str]) -> dict[str, PretalxSpeak
217213

218214

219215
def save_publishable_sessions():
220-
path = Path.joinpath(Config.public_path, "sessions.json")
216+
path = Config.public_path / "sessions.json"
221217

222218
publishable = publishable_submissions()
223219

@@ -227,7 +223,7 @@ def save_publishable_sessions():
227223

228224

229225
def save_publishable_speakers():
230-
path = Path.joinpath(Config.public_path, "speakers.json")
226+
path = Config.public_path / "speakers.json"
231227

232228
publishable = publishable_submissions()
233229
speakers = publishable_speakers(publishable.keys())

0 commit comments

Comments
 (0)