diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a31e574..fc28188 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,44 +3,37 @@ name: ci on: push jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8] - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install Dependencies - run: | - python -m venv venv - . venv/bin/activate - python -m pip install --upgrade pip - pip install --use-feature=2020-resolver -r requirements.txt -r requirements-dev.txt - - - name: Check Formatting - run: | - . venv/bin/activate - inv lint-black - - name: Check Linting - run: | - . venv/bin/activate - inv lint-pylint - - name: Check Types - run: | - . venv/bin/activate - inv lint-mypy - - name: Test - run: | - . venv/bin/activate - inv test + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + steps: + - name: Check out code + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + - name: Install Dependencies + run: | + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt -r requirements-dev.txt + - name: Check Formatting + run: | + source venv/bin/activate + inv lint-black + - name: Check Linting + run: | + source venv/bin/activate + inv lint-pylint + - name: Check Types + run: | + source venv/bin/activate + inv lint-mypy + - name: Test + run: | + source venv/bin/activate + inv test diff --git a/.pylintrc b/.pylintrc index 89d6c1c..af9e4e3 100644 --- a/.pylintrc +++ b/.pylintrc @@ -5,7 +5,7 @@ min-public-methods=1 [MESSAGES CONTROL] -disable=R0801, C0330, E1101, E0611, C0114, C0116, C0103, R0913, R0914, W0702, too-many-public-methods, too-many-instance-attributes +disable=R0801, E1101, E0611, C0114, C0116, C0103, R0913, R0914, W0702, too-many-public-methods, too-many-instance-attributes [FORMAT] max-line-length=120 \ No newline at end of file diff --git a/epidatpy/_constants.py b/epidatpy/_constants.py index cf1b857..380e14e 100644 --- a/epidatpy/_constants.py +++ b/epidatpy/_constants.py @@ -1,7 +1,7 @@ from typing import Final -__version__: Final = "1.0.0" +__version__: Final = "0.5.0" HTTP_HEADERS: Final = {"User-Agent": f"epidatpy/{__version__}"} diff --git a/epidatpy/_covidcast.py b/epidatpy/_covidcast.py index fc0508f..e2a63cc 100644 --- a/epidatpy/_covidcast.py +++ b/epidatpy/_covidcast.py @@ -169,17 +169,17 @@ def call( raise InvalidArgumentException("`issues` and `lag` are mutually exclusive") return self._create_call( - dict( - data_source=self.source, - signals=self.signal, - time_type=self.time_type, - time_values=time_values, - geo_type=geo_type, - geo_values=geo_values, - as_of=as_of, - issues=issues, - lag=lag, - ) + { + "data_source": self.source, + "signals": self.signal, + "time_type": self.time_type, + "time_values": time_values, + "geo_type": geo_type, + "geo_values": geo_values, + "as_of": as_of, + "issues": issues, + "lag": lag, + } ) def __call__( diff --git a/epidatpy/_endpoints.py b/epidatpy/_endpoints.py index fe9bbf4..370eaa1 100644 --- a/epidatpy/_endpoints.py +++ b/epidatpy/_endpoints.py @@ -70,7 +70,7 @@ def pvt_afhsb( return self._create_call( "afhsb/", - dict(auth=auth, locations=locations, epiweeks=epiweeks, flu_types=flu_types), + {"auth": auth, "locations": locations, "epiweeks": epiweeks, "flu_types": flu_types}, [ EpidataFieldInfo("location", EpidataFieldType.text), EpidataFieldInfo("flu_type", EpidataFieldType.text), @@ -87,7 +87,7 @@ def pvt_cdc(self, auth: str, epiweeks: EpiRangeParam, locations: StringParam) -> return self._create_call( "cdc/", - dict(auth=auth, epiweeks=epiweeks, locations=locations), + {"auth": auth, "epiweeks": epiweeks, "locations": locations}, [ EpidataFieldInfo("location", EpidataFieldType.text), EpidataFieldInfo("epiweek", EpidataFieldType.epiweek), @@ -119,7 +119,7 @@ def covid_hosp_facility_lookup( return self._create_call( "covid_hosp_facility_lookup/", - dict(state=state, ccn=ccn, city=city, zip=zip, fips_code=fips_code), + {"state": state, "ccn": ccn, "city": city, "zip": zip, "fips_code": fips_code}, [ EpidataFieldInfo("hospital_pk", EpidataFieldType.text), EpidataFieldInfo("state", EpidataFieldType.text), @@ -245,7 +245,11 @@ def covid_hosp_facility( return self._create_call( "covid_hosp_facility/", - dict(hospital_pks=hospital_pks, collection_weeks=collection_weeks, publication_dates=publication_dates), + { + "hospital_pks": hospital_pks, + "collection_weeks": collection_weeks, + "publication_dates": publication_dates, + }, [ *[EpidataFieldInfo(k, EpidataFieldType.text) for k in fields_string], EpidataFieldInfo("publication_date", EpidataFieldType.date), @@ -327,7 +331,7 @@ def covid_hosp_state_timeseries( return self._create_call( "covid_hosp_state_timeseries/", - dict(states=states, dates=dates, issues=issues, as_of=as_of), + {"states": states, "dates": dates, "issues": issues, "as_of": as_of}, [ EpidataFieldInfo("state", EpidataFieldType.text), EpidataFieldInfo("issue", EpidataFieldType.date), @@ -456,18 +460,18 @@ def covidcast_nowcast( return self._create_call( "covidcast_nowcast/", - dict( - data_source=data_source, - signals=signals, - sensor_names=sensor_names, - time_type=time_type, - geo_type=geo_type, - time_values=time_values, - as_of=as_of, - issues=issues, - lag=lag, - geo_values=geo_values, - ), + { + "data_source": data_source, + "signals": signals, + "sensor_names": sensor_names, + "time_type": time_type, + "geo_type": geo_type, + "time_values": time_values, + "as_of": as_of, + "issues": issues, + "lag": lag, + "geo_values": geo_values, + }, [ EpidataFieldInfo("geo_value", EpidataFieldType.text), EpidataFieldInfo("signal", EpidataFieldType.text), @@ -500,17 +504,17 @@ def covidcast( return self._create_call( "covidcast/", - dict( - data_source=data_source, - signals=signals, - time_type=time_type, - geo_type=geo_type, - time_values=time_values, - as_of=as_of, - issues=issues, - lag=lag, - geo_values=geo_values, - ), + { + "data_source": data_source, + "signals": signals, + "time_type": time_type, + "geo_type": geo_type, + "time_values": time_values, + "as_of": as_of, + "issues": issues, + "lag": lag, + "geo_values": geo_values, + }, define_covidcast_fields(), ) @@ -521,7 +525,7 @@ def delphi(self, system: str, epiweek: Union[int, str]) -> CALL_TYPE: raise InvalidArgumentException("`system` and `epiweek` are both required") return self._create_call( "delphi/", - dict(system=system, epiweek=epiweek), + {"system": system, "epiweek": epiweek}, [ EpidataFieldInfo("system", EpidataFieldType.text), EpidataFieldInfo("epiweek", EpidataFieldType.epiweek), @@ -537,7 +541,7 @@ def dengue_nowcast(self, locations: StringParam, epiweeks: EpiRangeParam) -> CAL raise InvalidArgumentException("`locations` and `epiweeks` are both required") return self._create_call( "dengue_nowcast/", - dict(locations=locations, epiweeks=epiweeks), + {"locations": locations, "epiweeks": epiweeks}, [ EpidataFieldInfo("location", EpidataFieldType.text), EpidataFieldInfo("epiweek", EpidataFieldType.epiweek), @@ -556,7 +560,7 @@ def pvt_dengue_sensors( return self._create_call( "dengue_sensors/", - dict(auth=auth, names=names, locations=locations, epiweeks=epiweeks), + {"auth": auth, "names": names, "locations": locations, "epiweeks": epiweeks}, [ EpidataFieldInfo("name", EpidataFieldType.text), EpidataFieldInfo("location", EpidataFieldType.text), @@ -579,7 +583,7 @@ def ecdc_ili( raise InvalidArgumentException("`issues` and `lag` are mutually exclusive") return self._create_call( "ecdc_ili/", - dict(regions=regions, epiweeks=epiweeks, issues=issues, lag=lag), + {"regions": regions, "epiweeks": epiweeks, "issues": issues, "lag": lag}, [ EpidataFieldInfo("region", EpidataFieldType.text), EpidataFieldInfo("release_date", EpidataFieldType.date), @@ -605,7 +609,7 @@ def flusurv( raise InvalidArgumentException("`issues` and `lag` are mutually exclusive") return self._create_call( "flusurv/", - dict(locations=locations, epiweeks=epiweeks, issues=issues, lag=lag), + {"locations": locations, "epiweeks": epiweeks, "issues": issues, "lag": lag}, [ EpidataFieldInfo("release_date", EpidataFieldType.text), EpidataFieldInfo("location", EpidataFieldType.text), @@ -636,7 +640,7 @@ def fluview_clinical( raise InvalidArgumentException("`issues` and `lag` are mutually exclusive") return self._create_call( "fluview_clinical/", - dict(regions=regions, epiweeks=epiweeks, issues=issues, lag=lag), + {"regions": regions, "epiweeks": epiweeks, "issues": issues, "lag": lag}, [ EpidataFieldInfo("release_date", EpidataFieldType.text), EpidataFieldInfo("region", EpidataFieldType.text), @@ -677,7 +681,7 @@ def fluview( raise InvalidArgumentException("`issues` and `lag` are mutually exclusive") return self._create_call( "fluview/", - dict(regions=regions, epiweeks=epiweeks, issues=issues, lag=lag, auth=auth), + {"regions": regions, "epiweeks": epiweeks, "issues": issues, "lag": lag, "auth": auth}, [ EpidataFieldInfo("release_date", EpidataFieldType.text), EpidataFieldInfo("region", EpidataFieldType.text), @@ -703,7 +707,7 @@ def gft(self, locations: StringParam, epiweeks: EpiRangeParam) -> CALL_TYPE: raise InvalidArgumentException("`locations` and `epiweeks` are both required") return self._create_call( "gft/", - dict(locations=locations, epiweeks=epiweeks), + {"locations": locations, "epiweeks": epiweeks}, [ EpidataFieldInfo("location", EpidataFieldType.text), EpidataFieldInfo("epiweek", EpidataFieldType.epiweek), @@ -717,7 +721,7 @@ def pvt_ght(self, auth: str, locations: StringParam, epiweeks: EpiRangeParam, qu raise InvalidArgumentException("`auth`, `locations`, `epiweeks`, and `query` are all required") return self._create_call( "ght/", - dict(auth=auth, locations=locations, epiweeks=epiweeks, query=query), + {"auth": auth, "locations": locations, "epiweeks": epiweeks, "query": query}, [ EpidataFieldInfo("location", EpidataFieldType.text), EpidataFieldInfo("epiweek", EpidataFieldType.epiweek), @@ -739,7 +743,7 @@ def kcdc_ili( raise InvalidArgumentException("`issues` and `lag` are mutually exclusive") return self._create_call( "kcdc_ili/", - dict(regions=regions, epiweeks=epiweeks, issues=issues, lag=lag), + {"regions": regions, "epiweeks": epiweeks, "issues": issues, "lag": lag}, [ EpidataFieldInfo("release_date", EpidataFieldType.text), EpidataFieldInfo("region", EpidataFieldType.text), @@ -758,7 +762,7 @@ def pvt_meta_afhsb(self, auth: str) -> CALL_TYPE: return self._create_call( "meta_afhsb/", - dict(auth=auth), + {"auth": auth}, only_supports_classic=True, ) @@ -769,7 +773,7 @@ def pvt_meta_norostat(self, auth: str) -> CALL_TYPE: raise InvalidArgumentException("`auth` is required") return self._create_call( "meta_norostat/", - dict(auth=auth), + {"auth": auth}, only_supports_classic=True, ) @@ -789,7 +793,7 @@ def nidss_dengue(self, locations: StringParam, epiweeks: EpiRangeParam) -> CALL_ return self._create_call( "nidss_dengue/", - dict(locations=locations, epiweeks=epiweeks), + {"locations": locations, "epiweeks": epiweeks}, [ EpidataFieldInfo("location", EpidataFieldType.text), EpidataFieldInfo("epiweek", EpidataFieldType.epiweek), @@ -813,7 +817,7 @@ def nidss_flu( return self._create_call( "nidss_flu/", - dict(regions=regions, epiweeks=epiweeks, issues=issues, lag=lag), + {"regions": regions, "epiweeks": epiweeks, "issues": issues, "lag": lag}, [ EpidataFieldInfo("release_date", EpidataFieldType.text), EpidataFieldInfo("region", EpidataFieldType.text), @@ -832,7 +836,7 @@ def pvt_norostat(self, auth: str, location: str, epiweeks: EpiRangeParam) -> CAL raise InvalidArgumentException("`auth`, `location`, and `epiweeks` are all required") return self._create_call( "norostat/", - dict(auth=auth, epiweeks=epiweeks, location=location), + {"auth": auth, "epiweeks": epiweeks, "location": location}, [ EpidataFieldInfo("release_date", EpidataFieldType.text), EpidataFieldInfo("epiweek", EpidataFieldType.epiweek), @@ -848,7 +852,7 @@ def nowcast(self, locations: StringParam, epiweeks: EpiRangeParam) -> CALL_TYPE: return self._create_call( "nowcast/", - dict(locations=locations, epiweeks=epiweeks), + {"locations": locations, "epiweeks": epiweeks}, [ EpidataFieldInfo("location", EpidataFieldType.text), EpidataFieldInfo("epiweek", EpidataFieldType.epiweek), @@ -872,7 +876,7 @@ def paho_dengue( raise InvalidArgumentException("`issues` and `lag` are mutually exclusive") return self._create_call( "paho_dengue/", - dict(regions=regions, epiweeks=epiweeks, issues=issues, lag=lag), + {"regions": regions, "epiweeks": epiweeks, "issues": issues, "lag": lag}, [ EpidataFieldInfo("release_date", EpidataFieldType.text), EpidataFieldInfo("region", EpidataFieldType.text), @@ -896,7 +900,7 @@ def pvt_quidel(self, auth: str, epiweeks: EpiRangeParam, locations: StringParam) return self._create_call( "quidel/", - dict(auth=auth, epiweeks=epiweeks, locations=locations), + {"auth": auth, "epiweeks": epiweeks, "locations": locations}, [ EpidataFieldInfo("location", EpidataFieldType.text), EpidataFieldInfo("epiweek", EpidataFieldType.epiweek), @@ -911,7 +915,7 @@ def pvt_sensors(self, auth: str, names: StringParam, locations: StringParam, epi raise InvalidArgumentException("`auth`, `names`, `locations`, and `epiweeks` are all required") return self._create_call( "sensors/", - dict(auth=auth, names=names, locations=locations, epiweeks=epiweeks), + {"auth": auth, "names": names, "locations": locations, "epiweeks": epiweeks}, [ EpidataFieldInfo("name", EpidataFieldType.text), EpidataFieldInfo("location", EpidataFieldType.text), @@ -935,7 +939,7 @@ def pvt_twitter( raise InvalidArgumentException("exactly one of `dates` and `epiweeks` is required") return self._create_call( "twitter/", - dict(auth=auth, locations=locations, dates=dates, epiweeks=epiweeks), + {"auth": auth, "locations": locations, "epiweeks": epiweeks, "dates": dates}, [ EpidataFieldInfo("location", EpidataFieldType.text), EpidataFieldInfo("date", EpidataFieldType.date) @@ -963,7 +967,7 @@ def wiki( raise InvalidArgumentException("exactly one of `dates` and `epiweeks` is required") return self._create_call( "wiki/", - dict(articles=articles, dates=dates, epiweeks=epiweeks, hours=hours, language=language), + {"articles": articles, "dates": dates, "epiweeks": epiweeks, "hours": hours, "language": language}, [ EpidataFieldInfo("article", EpidataFieldType.text), EpidataFieldInfo("date", EpidataFieldType.date) diff --git a/mypy.ini b/mypy.ini index 12f3021..2abe8a7 100644 --- a/mypy.ini +++ b/mypy.ini @@ -9,7 +9,7 @@ disallow_subclassing_any = True disallow_untyped_calls = True disallow_untyped_defs = True allow_untyped_decorators = True -warn_redundant_casts = True +warn_redundant_casts = False warn_unused_ignores = True warn_return_any = True exclude = "(tasks|setup).py" diff --git a/setup.py b/setup.py index 97e0211..d7eee09 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setuptools.setup( name="epidatpy", - version="1.0.0", + version="0.5.0", author="Alex Reinhart", author_email="areinhar@stat.cmu.edu", description="A programmatic interface to Delphi's Epidata API.", @@ -20,7 +20,7 @@ "Natural Language :: English", "Topic :: Scientific/Engineering :: Bio-Informatics", ], - python_requires=">=3.6", + python_requires=">=3.8", install_requires=[f.strip() for f in pathlib.Path("requirements.txt").read_text().split("\n") if f], # package_data={'epidatpy': []} )