|
5 | 5 | import os |
6 | 6 | import sys |
7 | 7 | import warnings |
8 | | -from typing import Optional, Union |
| 8 | +from pathlib import Path |
| 9 | +from typing import Optional, TypedDict, Union |
9 | 10 |
|
10 | 11 | from kili.adapters.authentification import is_api_key_valid |
11 | 12 | from kili.adapters.http_client import HttpClient |
|
40 | 41 | warnings.filterwarnings("default", module="kili", category=DeprecationWarning) |
41 | 42 |
|
42 | 43 |
|
| 44 | +class GraphQLClientParams(TypedDict, total=False): |
| 45 | + """Parameters for GraphQLClient initialization.""" |
| 46 | + |
| 47 | + enable_schema_caching: bool |
| 48 | + graphql_schema_cache_dir: Optional[Union[str, Path]] |
| 49 | + |
| 50 | + |
43 | 51 | class FilterPoolFullWarning(logging.Filter): |
44 | 52 | """Filter out the specific urllib3 warning related to the connection pool.""" |
45 | 53 |
|
@@ -82,7 +90,7 @@ def __init__( |
82 | 90 | api_endpoint: Optional[str] = None, |
83 | 91 | verify: Optional[Union[bool, str]] = None, |
84 | 92 | client_name: GraphQLClientName = GraphQLClientName.SDK, |
85 | | - graphql_client_params: Optional[dict[str, object]] = None, |
| 93 | + graphql_client_params: Optional[GraphQLClientParams] = None, |
86 | 94 | ) -> None: |
87 | 95 | """Initialize Kili client. |
88 | 96 |
|
@@ -166,7 +174,7 @@ def __init__( |
166 | 174 | client_name=client_name, |
167 | 175 | verify=self.verify, |
168 | 176 | http_client=self.http_client, |
169 | | - **(graphql_client_params or {}), # pyright: ignore[reportGeneralTypeIssues] |
| 177 | + **(graphql_client_params or {}), |
170 | 178 | ) |
171 | 179 | self.kili_api_gateway = KiliAPIGateway(self.graphql_client, self.http_client) |
172 | 180 | self.internal = InternalClientMethods(self.kili_api_gateway) |
|
0 commit comments