Skip to content
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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.18
current_version = 0.2.19
commit = True
message = chore: bump covidcast-indicators to {new_version}
tag = False
2 changes: 1 addition & 1 deletion .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
pip install pylint pytest pydocstyle wheel
- name: Install
run: |
make install
make install-ci
- name: Lint
run: |
make lint
Expand Down
2 changes: 1 addition & 1 deletion _delphi_utils_python/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.7
current_version = 0.2.8
commit = True
message = chore: bump delphi_utils to {new_version}
tag = False
Expand Down
5 changes: 5 additions & 0 deletions _delphi_utils_python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ install: venv
pip install wheel ; \
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install .

lint:
. env/bin/activate; pylint delphi_utils
. env/bin/activate; pydocstyle delphi_utils
Expand Down
2 changes: 1 addition & 1 deletion _delphi_utils_python/delphi_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
from .nancodes import Nans
from .weekday import Weekday

__version__ = "0.2.7"
__version__ = "0.2.8"
2 changes: 1 addition & 1 deletion _delphi_utils_python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

setup(
name="delphi_utils",
version="0.2.7",
version="0.2.8",
description="Shared Utility Functions for Indicators",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
9 changes: 7 additions & 2 deletions _template_python/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions cdc_covidnet/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions changehc/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
2 changes: 2 additions & 0 deletions changehc/delphi_changehc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
NA = "NA"
HRR = "hrr"
FIPS = "fips"

EXPECTED_FILES_PER_DROP = 7
5 changes: 3 additions & 2 deletions changehc/delphi_changehc/download_ftp_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# third party
import paramiko

from .constants import EXPECTED_FILES_PER_DROP

def print_callback(filename, bytes_so_far, bytes_total):
"""Log file transfer progress."""
Expand All @@ -32,8 +33,8 @@ def get_files_from_dir(sftp, filedate, out_path):
not path.exists(path.join(out_path, filename)):
filepaths_to_download[filename] = path.join(out_path, filename)

# make sure we don't download more than 6 files per day
assert len(filepaths_to_download) <= 6, "more files dropped than expected"
# make sure we don't download too many files per day
assert len(filepaths_to_download) <= EXPECTED_FILES_PER_DROP, "more files dropped than expected"

# download!
for infile, outfile in filepaths_to_download.items():
Expand Down
21 changes: 9 additions & 12 deletions changehc/tests/test_download_ftp_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# first party
from delphi_changehc.download_ftp_files import *
from delphi_changehc.constants import EXPECTED_FILES_PER_DROP

class TestDownloadFTPFiles:

Expand Down Expand Up @@ -51,22 +52,18 @@ def test_get_files(self, mock_path):
get_files_from_dir(one_new_one_old, "00005566", "")
assert one_new_one_old.num_gets == 1

# When seven new files are present, AssertionError
new_file1 = self.FileAttr(dt.timestamp(dt.now()), "00001122_foo1")
new_file2 = self.FileAttr(dt.timestamp(dt.now()), "00001122_foo2")
new_file3 = self.FileAttr(dt.timestamp(dt.now()), "00001122_foo3")
new_file4 = self.FileAttr(dt.timestamp(dt.now()), "00001122_foo4")
new_file5 = self.FileAttr(dt.timestamp(dt.now()), "00001122_foo5")
new_file6 = self.FileAttr(dt.timestamp(dt.now()), "00001122_foo6")
new_file7 = self.FileAttr(dt.timestamp(dt.now()), "00001122_foo7")
seven_new = self.MockSFTP([new_file1, new_file2, new_file3, new_file4,
new_file5, new_file6, new_file7])
# When too many new files are present, AssertionError
file_batch = [
self.FileAttr(dt.timestamp(dt.now()), f"00001122_foo{i}")
for i in range(EXPECTED_FILES_PER_DROP + 1)
]
too_many_new = self.MockSFTP(file_batch)
with pytest.raises(AssertionError):
get_files_from_dir(seven_new, "00001122", "")
get_files_from_dir(too_many_new, "00001122", "")

# When the file already exists, no files are downloaded
mock_path.exists.return_value = True
one_exists = self.MockSFTP([new_file1])
one_exists = self.MockSFTP([file_batch[0]])
get_files_from_dir(one_new, "00001122", "")
assert one_exists.num_gets == 0

9 changes: 7 additions & 2 deletions claims_hosp/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions combo_cases_and_deaths/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions covid_act_now/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions doctor_visits/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions google_symptoms/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions hhs_facilities/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions hhs_hosp/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions jhu/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
9 changes: 7 additions & 2 deletions nchs_mortality/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY = venv, lint, test, clean

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*')

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env

Expand All @@ -11,6 +10,12 @@ install: venv
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

lint:
. env/bin/activate; pylint $(dir)
. env/bin/activate; pydocstyle $(dir)
Expand Down
6 changes: 3 additions & 3 deletions nowcast/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ disable=logging-format-interpolation,
[BASIC]

# Allow arbitrarily short-named variables.
variable-rgx=[a-z_][a-z0-9_]*
argument-rgx=[a-z_][a-z0-9_]*
attr-rgx=[a-z_][a-z0-9_]*
variable-rgx=[A-Za-z_][a-z0-9_]*
argument-rgx=[A-Za-z_][a-z0-9_]*
attr-rgx=[A-Za-z_][a-z0-9_]*

[DESIGN]

Expand Down
Loading