Skip to content

Commit

Permalink
clean up a source code static typing
Browse files Browse the repository at this point in the history
  • Loading branch information
mccroweyclinton-EPA committed Oct 29, 2024
1 parent b6ccb51 commit b361345
Show file tree
Hide file tree
Showing 15 changed files with 385 additions and 371 deletions.
1 change: 1 addition & 0 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: setuppyaqsapi
channels:
- conda-forge
- defaults
dependencies:
- python>=3.8
- conda-build
Expand Down
27 changes: 26 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,29 @@ exclude = (?x)(
color_output = True
mypy_path = $MYPY_CONFIG_FILE/

#[mypy-pyaqsapi.*]
[mypy-pyaqsapi.*]
ignore_missing_imports=True

[mypy-pyaqsapi.helperfunctions]
ignore_missing_imports=True

[mypy-pyaqsapi.bysite]
ignore_missing_imports=True

[mypy-pyaqsapi.bycbsa]
ignore_missing_imports=True

[mypy-pyaqsapi.byma]
ignore_missing_imports=True

[mypy-pyaqsapi.bystate]
ignore_missing_imports=True

[mypy-pyaqsapi.bycounty]
ignore_missing_imports=True

[mypy-pyaqsapi.bysite]
ignore_missing_imports=True

[mypy-pyaqsapi.listfunctions]
ignore_missing_imports=True
Empty file added py.typed
Empty file.
51 changes: 25 additions & 26 deletions pyaqsapi/bybox/bybox.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

from datetime import date
from typing import Optional, Union

from pandas import DataFrame

Expand All @@ -19,9 +18,9 @@ def monitors(
maxlat: str,
minlon: str,
maxlon: str,
cbdate: Optional[date] = None,
cedate: Optional[date] = None,
return_header: Optional[bool] = False,
cbdate: date | None = None,
cedate: date | None = None,
return_header: bool | None = False,
):
"""
Return a table of monitors.
Expand Down Expand Up @@ -52,7 +51,7 @@ def monitors(
Only data west of this longitude will be returned. Note that -80
is less than -70.
return_header : If FALSE (default) only returns data requested. If TRUE
returns a AQSAPI_v2 object.
returns a AQSAPI_V2 object.
Examples
--------
Expand Down Expand Up @@ -114,18 +113,18 @@ def sampledata(
maxlat: str,
minlon: str,
maxlon: str,
cbdate: Optional[date] = None,
cedate: Optional[date] = None,
duration: Optional[str] = None,
return_header: Optional[bool] = False,
) -> Union[DataFrame, AQSAPI_V2]:
cbdate: date | None = None,
cedate: date | None = None,
duration: str | None = None,
return_header: bool | None = False,
) -> DataFrame | AQSAPI_V2:
"""
Return sample data where the data is aggregated by latitude/longitude
bounding box (_by_box).
If return_header is FALSE (default) this function
returns a single DataFrame with the requested data. If return_header is
TRUE returns a list of AQSAPI_v2 objects
TRUE returns a list of AQSAPI_V2 objects
Parameters
----------
Expand Down Expand Up @@ -158,7 +157,7 @@ def sampledata(
aqs_sampledurations() for a list of all available
duration codes.
return_header : If FALSE (default) only returns data requested. If TRUE
returns a AQSAPI_v2 object.
returns a AQSAPI_V2 object.
Examples
--------
Expand Down Expand Up @@ -215,10 +214,10 @@ def annualsummary(
maxlat: str,
minlon: str,
maxlon: str,
cbdate: Union[None, date] = None,
cedate: Union[None, date] = None,
return_header: Optional[bool] = False,
) -> Union[DataFrame, AQSAPI_V2]:
cbdate: date | None = None,
cedate: date | None = None,
return_header: bool | None = False,
) -> DataFrame | AQSAPI_V2:
"""
Return a DataFrame of annual data aggregated by latitude/longitude
bounding box (_by_box).
Expand Down Expand Up @@ -250,7 +249,7 @@ def annualsummary(
Only data west of this longitude will be returned. Note that -80
is less than -70.
return_header : If FALSE (default) only returns data requested. If TRUE
returns a AQSAPI_v2 object.
returns a AQSAPI_V2 object.
Examples
--------
Expand Down Expand Up @@ -306,10 +305,10 @@ def dailysummary(
maxlat: str,
minlon: str,
maxlon: str,
cbdate: Optional[Union[None, date]] = None,
cedate: Optional[Union[None, date]] = None,
cbdate: date | None = None,
cedate: date | None = None,
return_header: bool = False,
) -> Union[DataFrame, AQSAPI_V2]:
) -> DataFrame | AQSAPI_V2:
"""
Return a DataFrame of daily summary data aggregated by latitude/longitude
bounding box (_by_box).
Expand Down Expand Up @@ -340,7 +339,7 @@ def dailysummary(
Only data west of this longitude will be returned. Note that -80
is less than -70.
return_header : If FALSE (default) only returns data requested. If TRUE
returns a AQSAPI_v2 object.
returns a AQSAPI_V2 object.
Examples
--------
Expand Down Expand Up @@ -397,11 +396,11 @@ def quarterlysummary(
maxlat: str,
minlon: str,
maxlon: str,
cbdate: Optional[date] = None,
cedate: Optional[date] = None,
duration: Optional[str] = None,
cbdate: date | None = None,
cedate: date | None = None,
duration: str | None = None,
return_header: bool = False,
) -> Union[DataFrame, AQSAPI_V2]:
) -> DataFrame | AQSAPI_V2:
"""
Return a DataFrame of quarterly data aggregate by latitude/longitude
bounding box (_by_box).
Expand Down Expand Up @@ -449,7 +448,7 @@ def quarterlysummary(
Only data west of this longitude will be returned. Note that -80
is less than -70.
return_header : If FALSE (default) only returns data requested. If TRUE
returns a AQSAPI_v2 object.
returns a AQSAPI_V2 object.
Examples
--------
Expand Down
43 changes: 21 additions & 22 deletions pyaqsapi/bycbsa/bycbsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(by Core Based Statistic Area, as defined by the Census Bureau)."""

from datetime import date
from typing import Optional, Union

from pandas import DataFrame

Expand All @@ -15,10 +14,10 @@ def monitors(
bdate: date,
edate: date,
cbsa_code: str,
cbdate: Optional[date] = None,
cedate: Optional[date] = None,
return_header: Optional[bool] = False,
) -> Union[AQSAPI_V2, DataFrame]:
cbdate: date | None = None,
cedate: date | None = None,
return_header: bool | None = False,
) -> AQSAPI_V2 | DataFrame:
"""
Return a table of monitors.
Expand Down Expand Up @@ -102,11 +101,11 @@ def sampledata(
bdate: date,
edate: date,
cbsa_code: str,
duration: Optional[str] = None,
cbdate: Optional[date] = None,
cedate: Optional[date] = None,
return_header: Optional[bool] = False,
) -> Union[AQSAPI_V2, DataFrame]:
duration: str | None = None,
cbdate: date | None = None,
cedate: date | None = None,
return_header: bool | None = False,
) -> AQSAPI_V2 | DataFrame:
"""
Return sample data where the data is aggregated at the Core Based
Statistical Area (cbsa) level.
Expand Down Expand Up @@ -192,10 +191,10 @@ def annualsummary(
bdate: date,
edate: date,
cbsa_code: str,
cbdate: Optional[date] = None,
cedate: Optional[date] = None,
return_header: Optional[bool] = False,
) -> Union[AQSAPI_V2, DataFrame]:
cbdate: date | None = None,
cedate: date | None = None,
return_header: bool | None = False,
) -> AQSAPI_V2 | DataFrame:
"""
Return a DataFrame of annual data aggregated at the Core Based
Statistical Area (cbsa) level.
Expand Down Expand Up @@ -277,10 +276,10 @@ def dailysummary(
bdate: date,
edate: date,
cbsa_code: str,
cbdate: Optional[date] = None,
cedate: Optional[date] = None,
return_header: Optional[bool] = False,
) -> Union[AQSAPI_V2, DataFrame]:
cbdate: date | None = None,
cedate: date | None = None,
return_header: bool | None = False,
) -> AQSAPI_V2 | DataFrame:
"""
Return a DataFrame of data aggregated by Core Based Statistical Area
(cbsa).
Expand Down Expand Up @@ -362,10 +361,10 @@ def quarterlysummary(
bdate: date,
edate: date,
cbsa_code: str,
cbdate: Optional[date] = None,
cedate: Optional[date] = None,
return_header: Optional[bool] = False,
) -> Union[AQSAPI_V2, DataFrame]:
cbdate: date | None = None,
cedate: date | None = None,
return_header: bool | None = False,
) -> AQSAPI_V2 | DataFrame:
"""
Return quarterly summary data aggregated by Core Based Statistical Area
(cbsa_code).
Expand Down
Loading

0 comments on commit b361345

Please sign in to comment.