Skip to content

Get jhu to pass pydocstyle #562

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

Merged
merged 3 commits into from
Nov 20, 2020
Merged
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
3 changes: 2 additions & 1 deletion jhu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ install: venv

lint:
. env/bin/activate; \
pylint $(dir)
pylint $(dir); \
pydocstyle $(dir)

test:
. env/bin/activate ;\
Expand Down
3 changes: 1 addition & 2 deletions jhu/delphi_jhu/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

def geo_map(df: pd.DataFrame, geo_res: str):
"""
Maps a DataFrame df, which contains data at the county resolution, and
aggregate it to the geographic resolution geo_res.
Map and aggregate a DataFrame at the county resolution to the geographic resolution geo_res.

Parameters
----------
Expand Down
10 changes: 6 additions & 4 deletions jhu/delphi_jhu/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

def download_data(base_url: str, metric: str) -> pd.DataFrame:
"""
Download and format JHU data.

Downloads the data from the JHU repo, extracts the UID and the date columns, and
enforces the date datatype on the the time column.
"""
Expand All @@ -24,6 +26,8 @@ def download_data(base_url: str, metric: str) -> pd.DataFrame:

def create_diffs_column(df: pd.DataFrame) -> pd.DataFrame:
"""
Compute pairwise differences of cumulative values to get incidence.

Using the cumulative_counts column from the dataframe, partitions the dataframe
into separate time-series based on fips, and then computes pairwise differences
of the cumulative values to get the incidence values. Boundary cases are handled
Expand All @@ -41,9 +45,7 @@ def create_diffs_column(df: pd.DataFrame) -> pd.DataFrame:


def sanity_check_data(df: pd.DataFrame) -> pd.DataFrame:
"""
Perform a final set of sanity checks on the data.
"""
"""Perform a final set of sanity checks on the data."""
days_by_fips = df.groupby("fips").count()["cumulative_counts"].unique()
unique_days = df["timestamp"].unique()

Expand All @@ -62,7 +64,7 @@ def sanity_check_data(df: pd.DataFrame) -> pd.DataFrame:


def pull_jhu_data(base_url: str, metric: str, gmpr: GeoMapper) -> pd.DataFrame:
"""Pulls the latest Johns Hopkins CSSE data, and conforms it into a dataset
"""Pull the latest Johns Hopkins CSSE data, and conform it into a dataset.

The output dataset has:

Expand Down