Skip to content

Combo signal: Remove wildcard imports and fix some linting #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"state",
"msa",
"hrr",
]
]
19 changes: 9 additions & 10 deletions combo_cases_and_deaths/delphi_combo_cases_and_deaths/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
is only used for visualization. It sources Puerto Rico from jhu-csse and
everything else from usa-facts.
"""
from datetime import date, timedelta, datetime
from itertools import product
import re
import sys
from datetime import date, timedelta, datetime
from itertools import product

import covidcast
import pandas as pd
from delphi_utils import read_params

from delphi_utils import read_params, create_export_csv
from .constants import *
from .handle_wip_signal import *
from .constants import METRICS, SMOOTH_TYPES, SENSORS, GEO_RESOLUTIONS
from .handle_wip_signal import add_prefix


def check_not_none(data_frame, label, date_range):
Expand Down Expand Up @@ -119,12 +119,12 @@ def run_module():
"Invalid date_range parameter. Please choose from (new, all, yyyymmdd-yyyymmdd).")
try:
date1 = datetime.strptime(params['date_range'][:8], '%Y%m%d').date()
except ValueError:
raise ValueError("Invalid date_range parameter. Please check the first date.")
except ValueError as exc:
raise ValueError("Invalid date_range parameter. Please check the first date.") from exc
try:
date2 = datetime.strptime(params['date_range'][-8:], '%Y%m%d').date()
except ValueError:
raise ValueError("Invalid date_range parameter. Please check the second date.")
except ValueError as exc:
raise ValueError("Invalid date_range parameter. Please check the second date.") from exc

#The the valid start date
if date1 < params['export_start_date']:
Expand All @@ -149,4 +149,3 @@ def run_module():
df[df["timestamp"] == date_][["geo_id", "val", "se", "sample_size", ]].to_csv(
f"{export_dir}/{export_fn}", index=False, na_rep="NA"
)

8 changes: 3 additions & 5 deletions combo_cases_and_deaths/tests/test_run.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import unittest
from datetime import date
from itertools import product
import pytest
import unittest

from delphi_combo_cases_and_deaths.run import extend_raw_date_range, sensor_signal
from delphi_combo_cases_and_deaths.constants import METRICS, SENSORS, SMOOTH_TYPES
from delphi_combo_cases_and_deaths.handle_wip_signal import add_prefix
from delphi_utils import read_params
from delphi_combo_cases_and_deaths.constants import *
from delphi_combo_cases_and_deaths.run import extend_raw_date_range, sensor_signal


def test_issue_dates():
Expand Down