@@ -52,6 +52,12 @@ def parse_arguments():
5252 help = "Enable git actions such as fetch, merge, add, commit, and push"
5353 " (default: False)" ,
5454 )
55+ parser .add_argument (
56+ "--force" ,
57+ action = "store_true" ,
58+ help = "Regenerate data even if processed files already exist" ,
59+ )
60+
5561 args = parser .parse_args ()
5662 if not args .enable_save and args .enable_git :
5763 parser .error ("--enable-git requires --enable-save" )
@@ -63,9 +69,9 @@ def parse_arguments():
6369 return args
6470
6571
66- def check_for_data_files (file_paths ):
72+ def check_for_data_files (args , file_paths ):
6773 for path in file_paths :
68- if os .path .exists (path ):
74+ if os .path .exists (path ) and not args . force :
6975 raise shared .QuantifyingException (
7076 f"Processed data already exists for { QUARTER } " , 0
7177 )
@@ -144,7 +150,7 @@ def main():
144150 args = parse_arguments ()
145151 shared .paths_log (LOGGER , PATHS )
146152 shared .git_fetch_and_merge (args , PATHS ["repo" ])
147- check_for_data_files (FILE_PATHS )
153+ check_for_data_files (args , FILE_PATHS )
148154 file_count = shared .path_join (PATHS ["data_1-fetch" ], "github_1_count.csv" )
149155 count_data = shared .open_data_file (
150156 LOGGER , file_count , usecols = ["TOOL_IDENTIFIER" , "COUNT" ]
0 commit comments