@@ -41,11 +41,28 @@ def parse_arguments():
41
41
"--quarter" ,
42
42
"-q" ,
43
43
type = str ,
44
- required = False ,
45
44
default = f"{ quarter } " ,
46
45
help = "Data quarter in format YYYYQx, e.g., 2024Q2" ,
47
46
)
48
- return parser .parse_args ()
47
+ parser .add_argument (
48
+ "--skip-commit" ,
49
+ action = "store_true" ,
50
+ help = "Don't git commit changes (also skips git push changes)" ,
51
+ )
52
+ parser .add_argument (
53
+ "--skip-push" ,
54
+ action = "store_true" ,
55
+ help = "Don't git push changes" ,
56
+ )
57
+ parser .add_argument (
58
+ "--show-plots" ,
59
+ action = "store_true" ,
60
+ help = "Show generated plots (in addition to saving them)" ,
61
+ )
62
+ args = parser .parse_args ()
63
+ if args .skip_commit :
64
+ args .skip_push = True
65
+ return args
49
66
50
67
51
68
def load_data (args ):
@@ -129,7 +146,8 @@ def visualize_by_country(data, args):
129
146
image_path = os .path .join (output_directory , "gcs_country_report.png" )
130
147
plt .savefig (image_path )
131
148
132
- plt .show ()
149
+ if args .show_plots :
150
+ plt .show ()
133
151
134
152
shared .update_readme (
135
153
PATHS ,
@@ -198,7 +216,8 @@ def millions_formatter(x, pos):
198
216
199
217
plt .savefig (image_path )
200
218
201
- plt .show ()
219
+ if args .show_plots :
220
+ plt .show ()
202
221
203
222
shared .update_readme (
204
223
PATHS ,
@@ -274,7 +293,8 @@ def visualize_by_language(data, args):
274
293
image_path = os .path .join (output_directory , "gcs_language_report.png" )
275
294
plt .savefig (image_path )
276
295
277
- plt .show ()
296
+ if args .show_plots :
297
+ plt .show ()
278
298
279
299
shared .update_readme (
280
300
PATHS ,
@@ -307,10 +327,12 @@ def main():
307
327
visualize_by_language (data , args )
308
328
309
329
# Add and commit changes
310
- shared .add_and_commit (PATHS ["repo" ], "Added and committed new reports" )
330
+ if not args .skip_commit :
331
+ shared .add_and_commit (PATHS ["repo" ], "Added and committed new reports" )
311
332
312
333
# Push changes
313
- shared .push_changes (PATHS ["repo" ])
334
+ if not args .skip_push :
335
+ shared .push_changes (PATHS ["repo" ])
314
336
315
337
316
338
if __name__ == "__main__" :
0 commit comments