Skip to content

Commit

Permalink
Apply linter to docs, record fresh test cassettes, and fix type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
gw-moore committed Jan 20, 2025
1 parent 62a5b02 commit 1bd502d
Show file tree
Hide file tree
Showing 63 changed files with 71,334 additions and 28 deletions.
20 changes: 7 additions & 13 deletions docs/tutorials/category.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,15 @@
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Matplotlib is building the font cache; this may take a moment.\n"
]
}
],
"outputs": [],
"source": [
"import pyfredapi as pf\n",
"from rich.pretty import pprint\n",
"import seaborn as sns\n",
"import operator\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import operator"
"import seaborn as sns\n",
"from rich.pretty import pprint\n",
"\n",
"import pyfredapi as pf"
]
},
{
Expand Down
18 changes: 12 additions & 6 deletions docs/tutorials/maps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@
"metadata": {},
"outputs": [],
"source": [
"import pyfredapi as pf\n",
"from rich import print\n",
"from rich.pretty import pprint\n",
"import matplotlib.pyplot as plt\n",
"import geopandas as gpd\n",
"import matplotlib.pyplot as plt\n",
"from rich import print\n",
"\n",
"\n",
"import requests"
"import pyfredapi as pf"
]
},
{
Expand Down Expand Up @@ -94,6 +91,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7fb27b941602401d91542211134fc71a",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -190,6 +188,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "acae54e37e7d407bbb7b55eff062a284",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -199,6 +198,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9a63283cbaf04dbcab1f6479b197f3a8",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -208,6 +208,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8dd0d8092fe74a7c96281538738b07e2",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -217,6 +218,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "72eea5119410473aa328ad9291626812",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -226,6 +228,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8edb47106e1a46a883d545849b8ab81b",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -254,6 +257,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "10185d26023b46108eb7d9f57d49d2b3",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -263,6 +267,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8763a12b2bbd4a93a75aff182afb95dc",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -281,6 +286,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7623eae2785240b9bd12b16a66d81610",
"metadata": {},
"outputs": [],
"source": [
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials/releases.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
"metadata": {},
"outputs": [],
"source": [
"import pyfredapi as pf\n",
"from rich.pretty import pprint"
"from rich.pretty import pprint\n",
"\n",
"import pyfredapi as pf"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials/series.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
"metadata": {},
"outputs": [],
"source": [
"import pyfredapi as pf\n",
"from rich import print as rprint\n",
"from rich.pretty import pprint"
"from rich.pretty import pprint\n",
"\n",
"import pyfredapi as pf"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials/series_collection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
"metadata": {},
"outputs": [],
"source": [
"import pyfredapi as pf\n",
"from rich.pretty import pprint"
"from rich.pretty import pprint\n",
"\n",
"import pyfredapi as pf"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion pyfredapi/__about__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Define the package metadata."""

__version__ = "0.9.2.dev1"
__version__ = "0.9.2.dev2"
4 changes: 2 additions & 2 deletions pyfredapi/utils/_common_type_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
try:
from polars import DataFrame as PlDataFrame
except ImportError:
PlDataFrame: Any # type: ignore
pass


ApiKeyType = Union[str, None]
JsonType = Dict[str, Any]
ReturnTypes = Union[Dict, PdDataFrame, PlDataFrame]
ReturnTypes = Union[Dict, PdDataFrame, "PlDataFrame"]
ReturnFormats = Union[Literal["json", "pandas", "polars"], ReturnFormat]
KwargsType = Dict[str, Union[int, str, None]]
88 changes: 88 additions & 0 deletions tests/vhs/test_category/test_get_category.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,92 @@ interactions:
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
method: GET
uri: https://api.stlouisfed.org/fred/category?category_id=125&file_type=json
response:
body:
string: '{"categories":[{"id":125,"name":"Trade Balance","parent_id":13}]}'
headers:
Cache-Control:
- max-age=0, no-cache
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Length:
- '82'
Content-Type:
- application/json; charset=UTF-8
Date:
- Mon, 20 Jan 2025 14:55:48 GMT
Expires:
- Mon, 20 Jan 2025 14:55:48 GMT
Last-Modified:
- Mon, 20 Jan 2025 14:55:48 GMT
Pragma:
- no-cache
Server:
- Apache
Strict-Transport-Security:
- max-age=86400
Vary:
- Accept-Encoding
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
method: GET
uri: https://api.stlouisfed.org/fred/category?category_id=125&file_type=json
response:
body:
string: '{"categories":[{"id":125,"name":"Trade Balance","parent_id":13}]}'
headers:
Cache-Control:
- max-age=0, no-cache
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Length:
- '82'
Content-Type:
- application/json; charset=UTF-8
Date:
- Mon, 20 Jan 2025 14:55:48 GMT
Expires:
- Mon, 20 Jan 2025 14:55:48 GMT
Last-Modified:
- Mon, 20 Jan 2025 14:55:48 GMT
Pragma:
- no-cache
Server:
- Apache
Strict-Transport-Security:
- max-age=86400
Vary:
- Accept-Encoding
status:
code: 200
message: OK
version: 1
80 changes: 80 additions & 0 deletions tests/vhs/test_category/test_get_category_children.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,84 @@ interactions:
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
method: GET
uri: https://api.stlouisfed.org/fred/category/children?category_id=125&file_type=json
response:
body:
string: '{"categories":[]}'
headers:
Cache-Control:
- max-age=0, no-cache
Connection:
- keep-alive
Content-Length:
- '17'
Content-Type:
- application/json; charset=UTF-8
Date:
- Mon, 20 Jan 2025 14:55:49 GMT
Expires:
- Mon, 20 Jan 2025 14:55:49 GMT
Last-Modified:
- Mon, 20 Jan 2025 14:55:49 GMT
Pragma:
- no-cache
Server:
- Apache
Strict-Transport-Security:
- max-age=86400
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.3
method: GET
uri: https://api.stlouisfed.org/fred/category/children?category_id=125&file_type=json
response:
body:
string: '{"categories":[]}'
headers:
Cache-Control:
- max-age=0, no-cache
Connection:
- keep-alive
Content-Length:
- '17'
Content-Type:
- application/json; charset=UTF-8
Date:
- Mon, 20 Jan 2025 14:55:49 GMT
Expires:
- Mon, 20 Jan 2025 14:55:49 GMT
Last-Modified:
- Mon, 20 Jan 2025 14:55:49 GMT
Pragma:
- no-cache
Server:
- Apache
Strict-Transport-Security:
- max-age=86400
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit 1bd502d

Please sign in to comment.