88 Any ,
99 ClassVar ,
1010 Protocol ,
11- TypeVar ,
1211)
1312
1413import dacite
@@ -38,7 +37,6 @@ class IsDataclass(Protocol):
3837 # the most reliable way to ascertain that something is a dataclass
3938 __dataclass_fields__ : ClassVar [dict [str , Any ]]
4039
41- T = TypeVar ("T" , bound = IsDataclass )
4240
4341logger = logging .getLogger (__name__ )
4442
@@ -111,7 +109,7 @@ async def login(self) -> LoginResp:
111109 )
112110 return result
113111
114- async def execute_api_call (
112+ async def execute_api_call [ T : IsDataclass ] (
115113 self ,
116114 method : str ,
117115 path : str ,
@@ -137,7 +135,7 @@ async def execute_api_call(
137135 raise SaicApiException (msg )
138136 return result
139137
140- async def execute_api_call_with_optional_result (
138+ async def execute_api_call_with_optional_result [ T : IsDataclass ] (
141139 self ,
142140 method : str ,
143141 path : str ,
@@ -179,7 +177,7 @@ async def execute_api_call_no_result(
179177 allow_null_body = True ,
180178 )
181179
182- async def __execute_api_call (
180+ async def __execute_api_call [ T : IsDataclass ] (
183181 self ,
184182 method : str ,
185183 path : str ,
@@ -210,7 +208,7 @@ async def __execute_api_call(
210208 msg = f"API call { method } { path } failed unexpectedly"
211209 raise SaicApiException (msg , return_code = 500 ) from e
212210
213- async def execute_api_call_with_event_id (
211+ async def execute_api_call_with_event_id [ T : IsDataclass ] (
214212 self ,
215213 method : str ,
216214 path : str ,
@@ -254,7 +252,7 @@ async def execute_api_call_with_event_id_no_result(
254252 delay = delay ,
255253 )
256254
257- async def __execute_api_call_with_event_id (
255+ async def __execute_api_call_with_event_id [ T : IsDataclass ] (
258256 self ,
259257 method : str ,
260258 path : str ,
@@ -286,7 +284,7 @@ async def execute_api_call_with_event_id_inner(*, event_id: str) -> T | None:
286284
287285 return await execute_api_call_with_event_id_inner (event_id = "0" )
288286
289- async def __deserialize (
287+ async def __deserialize [ T : IsDataclass ] (
290288 self ,
291289 request : httpx .Request ,
292290 response : httpx .Response ,
0 commit comments