|
16 | 16 | from re3data._serializer import _to_csv, _to_dataframe, _to_dict, _to_json |
17 | 17 |
|
18 | 18 | if TYPE_CHECKING: |
| 19 | + from pandas import DataFrame |
| 20 | + |
19 | 21 | from re3data._resources import Repository, RepositorySummary |
20 | 22 |
|
21 | 23 | BASE_URL: str = "https://www.re3data.org/api/beta/" |
@@ -79,25 +81,22 @@ def _build_query_params(query: str | None = None) -> dict[str, str]: |
79 | 81 | return query_params |
80 | 82 |
|
81 | 83 |
|
82 | | -# TODO: add dataframe to return types |
83 | | - |
84 | | - |
85 | 84 | @overload |
86 | 85 | def _dispatch_return_type( |
87 | 86 | 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: ... |
89 | 88 | @overload |
90 | 89 | def _dispatch_return_type( |
91 | 90 | response: Response, |
92 | 91 | resource_type: Literal[ResourceType.REPOSITORY_LIST], |
93 | 92 | return_type: ReturnType, |
94 | 93 | count: bool = False, |
95 | | -) -> list[RepositorySummary] | Response | dict[str, Any] | str | int: ... |
| 94 | +) -> list[RepositorySummary] | Response | dict[str, Any] | DataFrame | str | int: ... |
96 | 95 |
|
97 | 96 |
|
98 | 97 | def _dispatch_return_type( # noqa: PLR0911 |
99 | 98 | 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: |
101 | 100 | """Dispatch the response to the correct return type based on the provided return type and resource type. |
102 | 101 |
|
103 | 102 | Args: |
|
0 commit comments