Skip to content

Commit 4bcdfdd

Browse files
committed
s
1 parent 7d140eb commit 4bcdfdd

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/re3data/_client/_async.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
from re3data._response import Response, _build_response
2323

2424
if TYPE_CHECKING:
25-
from re3data._resources import Repository, RepositorySummary
25+
from pandas import DataFrame
2626

27+
from re3data._resources import Repository, RepositorySummary
2728
logger = logging.getLogger(__name__)
2829

2930

@@ -59,7 +60,7 @@ async def list(
5960
query: str | None = None,
6061
return_type: ReturnType = ReturnType.DATACLASS,
6162
count: bool = False,
62-
) -> list[RepositorySummary] | Response | dict[str, Any] | str | int:
63+
) -> list[RepositorySummary] | Response | dict[str, Any] | DataFrame | str | int:
6364
"""List the metadata of all repositories in the re3data API.
6465
6566
Args:
@@ -83,7 +84,7 @@ async def list(
8384

8485
async def get(
8586
self, repository_id: str, return_type: ReturnType = ReturnType.DATACLASS
86-
) -> Repository | Response | dict[str, Any] | str:
87+
) -> Repository | Response | dict[str, Any] | DataFrame | str:
8788
"""Get the metadata of a specific repository.
8889
8990
Args:

src/re3data/_client/_sync.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
from re3data._response import Response, _build_response
2525

2626
if TYPE_CHECKING:
27-
from re3data._resources import Repository, RepositorySummary
27+
from pandas import DataFrame
2828

29+
from re3data._resources import Repository, RepositorySummary
2930
logger = logging.getLogger(__name__)
3031

3132

@@ -61,7 +62,7 @@ def list(
6162
query: str | None = None,
6263
return_type: ReturnType = ReturnType.DATACLASS,
6364
count: bool = False,
64-
) -> list[RepositorySummary] | Response | dict[str, Any] | str | int:
65+
) -> list[RepositorySummary] | Response | dict[str, Any] | DataFrame | str | int:
6566
"""List the metadata of all repositories in the re3data API.
6667
6768
Args:
@@ -85,7 +86,7 @@ def list(
8586

8687
def get(
8788
self, repository_id: str, return_type: ReturnType = ReturnType.DATACLASS
88-
) -> Repository | Response | dict[str, Any] | str:
89+
) -> Repository | Response | dict[str, Any] | DataFrame | str:
8990
"""Get the metadata of a specific repository.
9091
9192
Args:

src/re3data/_client/base.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
from re3data._serializer import _to_csv, _to_dataframe, _to_dict, _to_json
1717

1818
if TYPE_CHECKING:
19+
from pandas import DataFrame
20+
1921
from re3data._resources import Repository, RepositorySummary
2022

2123
BASE_URL: str = "https://www.re3data.org/api/beta/"
@@ -79,25 +81,22 @@ def _build_query_params(query: str | None = None) -> dict[str, str]:
7981
return query_params
8082

8183

82-
# TODO: add dataframe to return types
83-
84-
8584
@overload
8685
def _dispatch_return_type(
8786
response: Response, resource_type: Literal[ResourceType.REPOSITORY], return_type: ReturnType, count: bool = False
88-
) -> Repository | Response | dict[str, Any] | str: ...
87+
) -> Repository | Response | dict[str, Any] | DataFrame | str: ...
8988
@overload
9089
def _dispatch_return_type(
9190
response: Response,
9291
resource_type: Literal[ResourceType.REPOSITORY_LIST],
9392
return_type: ReturnType,
9493
count: bool = False,
95-
) -> list[RepositorySummary] | Response | dict[str, Any] | str | int: ...
94+
) -> list[RepositorySummary] | Response | dict[str, Any] | DataFrame | str | int: ...
9695

9796

9897
def _dispatch_return_type( # noqa: PLR0911
9998
response: Response, resource_type: ResourceType, return_type: ReturnType, count: bool = False
100-
) -> Repository | list[RepositorySummary] | Response | dict[str, Any] | str | int:
99+
) -> Repository | list[RepositorySummary] | Response | dict[str, Any] | DataFrame | str | int:
101100
"""Dispatch the response to the correct return type based on the provided return type and resource type.
102101
103102
Args:

0 commit comments

Comments
 (0)