Skip to content

Commit df57017

Browse files
authored
Merge pull request #563 from cmu-delphi/quidelpylint
Get quidel to pass pylint and enable CI
2 parents a34dd22 + fb3c175 commit df57017

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
make install
3636
- name: Lint
37-
if: ${{ matrix.packages != 'claims_hosp' && matrix.packages != 'quidel'}}
37+
if: ${{ matrix.packages != 'claims_hosp' }}
3838
run: |
3939
make lint
4040
- name: Test

quidel/delphi_quidel/generate_sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def generate_sensor_for_other_geores(state_groups, data, res_key, smooth,
9393
res_group = res_group.merge(parent_group, how="left",
9494
on="timestamp", suffixes=('', '_parent'))
9595
res_group = res_group.drop(columns=[res_key, "state_id", "state_id" + '_parent'])
96-
except:
96+
except KeyError:
9797
has_parent = False
9898
res_group = res_group.drop(columns=[res_key, "state_id"])
9999
res_group.set_index("timestamp", inplace=True)

quidel/delphi_quidel/geo_maps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Contains geographic mapping tools."""
22
def geo_map(geo_res, data, map_df):
3+
"""Call appropriate mapping function based on desired geo resolution."""
34
if geo_res == "county":
45
return zip_to_county(data, map_df)
56
if geo_res == "msa":

quidel/delphi_quidel/pull.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4140
def 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

372371
def 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

405404
def 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(

quidel/delphi_quidel/run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
GEO_RESOLUTIONS, SENSORS)
2222

2323
def run_module():
24+
"""Run Quidel flu test module."""
2425
params = read_params()
2526
cache_dir = params["cache_dir"]
2627
export_dir = params["export_dir"]

0 commit comments

Comments
 (0)