@@ -43,7 +43,7 @@ def jsonify(weeks: Dict[int, Week], directory: str, canteen: Canteen, combine_di
43
43
year = week .year
44
44
45
45
# create dir: <year>/
46
- json_dir = f"{ str ( directory ) } /{ str ( year ) } "
46
+ json_dir = f"{ directory } /{ year } "
47
47
if not os .path .exists (json_dir ):
48
48
os .makedirs (json_dir )
49
49
@@ -52,7 +52,7 @@ def jsonify(weeks: Dict[int, Week], directory: str, canteen: Canteen, combine_di
52
52
if week_json is not None :
53
53
week_json ["version" ] = JSON_VERSION
54
54
# 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 :
56
56
json .dump (week_json , outfile , separators = ("," , ":" ), ensure_ascii = False )
57
57
58
58
# check if combine parameter got set
@@ -62,9 +62,9 @@ def jsonify(weeks: Dict[int, Week], directory: str, canteen: Canteen, combine_di
62
62
combined_df_name = "combined"
63
63
64
64
# create directory for combined output
65
- json_dir = f"{ str ( directory ) } /{ combined_df_name } "
65
+ json_dir = f"{ directory } /{ combined_df_name } "
66
66
if not os .path .exists (json_dir ):
67
- os .makedirs (f" { str ( directory ) } / { combined_df_name } " )
67
+ os .makedirs (json_dir )
68
68
69
69
# convert all weeks to one JSON object
70
70
weeks_json_all = json .dumps (
@@ -78,7 +78,7 @@ def jsonify(weeks: Dict[int, Week], directory: str, canteen: Canteen, combine_di
78
78
)
79
79
80
80
# 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 :
82
82
json .dump (json .loads (weeks_json_all ), outfile , separators = ("," , ":" ), ensure_ascii = False )
83
83
84
84
0 commit comments