@@ -33,10 +33,9 @@ def compare_dates(date1, date2, flag):
3333 if flag == "l" :
3434 return date1
3535 return date2
36- else :
37- if flag == "l" :
38- return date2
39- return date1
36+ if flag == "l" :
37+ return date2
38+ return date1
4039
4140def check_whether_date_in_range (search_date , start_date , end_date ):
4241 """
@@ -130,9 +129,9 @@ def get_from_email(column_names, start_dates, end_dates, mail_server,
130129 continue
131130
132131 # Check whether we pull the data from a valid time range
133- WhetherInRange = check_whether_date_in_range (
132+ whether_in_range = check_whether_date_in_range (
134133 search_date , start_dates [test ], end_dates [test ])
135- if not WhetherInRange :
134+ if not whether_in_range :
136135 continue
137136
138137 print (f"Pulling { test } data received on %s" % search_date .date ())
@@ -370,7 +369,7 @@ def pull_quidel_data(params):
370369 return dfs , _end_date
371370
372371def check_export_end_date (input_export_end_dates , _end_date ,
373- END_FROM_TODAY_MINUS ):
372+ end_from_today_minus ):
374373 """
375374 Update the export_end_date according to the data received
376375 By default, set the export end date to be the last pulling date - 5 days
@@ -393,7 +392,7 @@ def check_export_end_date(input_export_end_dates, _end_date,
393392 export_end_dates = {}
394393 for test_type in TEST_TYPES :
395394 export_end_dates [test_type ] = _end_date \
396- - timedelta (days = END_FROM_TODAY_MINUS )
395+ - timedelta (days = end_from_today_minus )
397396 if input_export_end_dates [test_type ] != "" :
398397 input_export_end_dates [test_type ] = datetime .strptime (
399398 input_export_end_dates [test_type ], '%Y-%m-%d' )
@@ -403,7 +402,7 @@ def check_export_end_date(input_export_end_dates, _end_date,
403402 return export_end_dates
404403
405404def check_export_start_date (export_start_dates , export_end_dates ,
406- EXPORT_DAY_RANGE ):
405+ export_day_range ):
407406 """
408407 Update the export_start_date according to the export_end_date so that it
409408 could be export_end_date - EXPORT_DAY_RANGE
@@ -414,7 +413,7 @@ def check_export_start_date(export_start_dates, export_end_dates,
414413 export_end_date: dict
415414 Calculated according to the data received.
416415 The type of values are datetime.datetime
417- EXPORT_DAY_RANGE : int
416+ export_day_range : int
418417 Number of days to report
419418
420419 Returns:
@@ -430,7 +429,7 @@ def check_export_start_date(export_start_dates, export_end_dates,
430429 export_start_dates [test_type ], '%Y-%m-%d' )
431430 # Only export data from -45 days to -5 days
432431 export_start_dates [test_type ] = compare_dates (
433- export_end_dates [test_type ] - timedelta (days = EXPORT_DAY_RANGE ),
432+ export_end_dates [test_type ] - timedelta (days = export_day_range ),
434433 export_start_dates [test_type ], "l" )
435434 if test_type == "covid_ag" :
436435 export_start_dates [test_type ] = compare_dates (
0 commit comments