Skip to content

Commit c0bd71c

Browse files
remove unnecessary str conversions
1 parent 32526c3 commit c0bd71c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def jsonify(weeks: Dict[int, Week], directory: str, canteen: Canteen, combine_di
4343
year = week.year
4444

4545
# create dir: <year>/
46-
json_dir = f"{str(directory)}/{str(year)}"
46+
json_dir = f"{directory}/{year}"
4747
if not os.path.exists(json_dir):
4848
os.makedirs(json_dir)
4949

@@ -52,7 +52,7 @@ def jsonify(weeks: Dict[int, Week], directory: str, canteen: Canteen, combine_di
5252
if week_json is not None:
5353
week_json["version"] = JSON_VERSION
5454
# write JSON to file: <year>/<calendar_week>.json
55-
with open(f"{str(json_dir)}/{str(calendar_week).zfill(2)}.json", "w", encoding="utf-8") as outfile:
55+
with open(f"{json_dir}/{str(calendar_week).zfill(2)}.json", "w", encoding="utf-8") as outfile:
5656
json.dump(week_json, outfile, separators=(",", ":"), ensure_ascii=False)
5757

5858
# check if combine parameter got set
@@ -62,9 +62,9 @@ def jsonify(weeks: Dict[int, Week], directory: str, canteen: Canteen, combine_di
6262
combined_df_name = "combined"
6363

6464
# create directory for combined output
65-
json_dir = f"{str(directory)}/{combined_df_name}"
65+
json_dir = f"{directory}/{combined_df_name}"
6666
if not os.path.exists(json_dir):
67-
os.makedirs(f"{str(directory)}/{combined_df_name}")
67+
os.makedirs(json_dir)
6868

6969
# convert all weeks to one JSON object
7070
weeks_json_all = json.dumps(
@@ -78,7 +78,7 @@ def jsonify(weeks: Dict[int, Week], directory: str, canteen: Canteen, combine_di
7878
)
7979

8080
# write JSON object to file
81-
with open(f"{str(json_dir)}/{combined_df_name}.json", "w", encoding="utf-8") as outfile:
81+
with open(f"{json_dir}/{combined_df_name}.json", "w", encoding="utf-8") as outfile:
8282
json.dump(json.loads(weeks_json_all), outfile, separators=(",", ":"), ensure_ascii=False)
8383

8484

0 commit comments

Comments
 (0)