@@ -63,6 +63,13 @@ def parse_arguments():
6363 return args
6464
6565
66+ def check_for_data_file (file_path ):
67+ if os .path .exists (file_path ):
68+ raise shared .QuantifyingException (
69+ f"Processed data already exists for { QUARTER } " , 0
70+ )
71+
72+
6673def data_to_csv (args , data , file_path ):
6774 if not args .enable_save :
6875 return
@@ -91,6 +98,7 @@ def process_highest_language_usage(args, count_data):
9198 file_path = shared .path_join (
9299 PATHS ["data_phase" ], "wikipedia_highest_language_usage.csv"
93100 )
101+ check_for_data_file (file_path )
94102 data_to_csv (args , top_10 , file_path )
95103
96104
@@ -114,6 +122,7 @@ def process_least_language_usage(args, count_data):
114122 file_path = shared .path_join (
115123 PATHS ["data_phase" ], "wikipedia_least_language_usage.csv"
116124 )
125+ check_for_data_file (file_path )
117126 data_to_csv (args , bottom_10 , file_path )
118127
119128
@@ -140,6 +149,7 @@ def process_language_representation(args, count_data):
140149 file_path = shared .path_join (
141150 PATHS ["data_phase" ], "wikipedia_language_representation.csv"
142151 )
152+ check_for_data_file (file_path )
143153 data_to_csv (args , language_counts , file_path )
144154
145155
0 commit comments