| 
3 | 3 | import abc  | 
4 | 4 | import json  | 
5 | 5 | 
 
  | 
6 |  | -from typing import Literal, cast  | 
 | 6 | +from typing import Any, Literal, cast  | 
7 | 7 | from urllib.parse import urlencode  | 
8 | 8 | 
 
  | 
9 | 9 | import httpx  | 
@@ -102,7 +102,7 @@ async def get_authorization_url(  | 
102 | 102 | 
 
  | 
103 | 103 |         return f'{self.authorize_endpoint}?{urlencode(params)}'  | 
104 | 104 | 
 
  | 
105 |  | -    async def get_access_token(self, code: str, redirect_uri: str, code_verifier: str | None = None) -> dict:  | 
 | 105 | +    async def get_access_token(self, code: str, redirect_uri: str, code_verifier: str | None = None) -> dict[str, Any]:  | 
106 | 106 |         """  | 
107 | 107 |         Get access token for given.  | 
108 | 108 | 
  | 
@@ -136,7 +136,7 @@ async def get_access_token(self, code: str, redirect_uri: str, code_verifier: st  | 
136 | 136 |             result = self.get_json_result(response, err_class=AccessTokenError)  | 
137 | 137 |             return result  | 
138 | 138 | 
 
  | 
139 |  | -    async def refresh_token(self, refresh_token: str) -> dict:  | 
 | 139 | +    async def refresh_token(self, refresh_token: str) -> dict[str, Any]:  | 
140 | 140 |         """  | 
141 | 141 |         Get new access token by refresh token.  | 
142 | 142 | 
  | 
@@ -202,15 +202,15 @@ def raise_httpx_oauth20_errors(response: httpx.Response) -> None:  | 
202 | 202 |             raise HTTPXOAuth20Error(str(e)) from e  | 
203 | 203 | 
 
  | 
204 | 204 |     @staticmethod  | 
205 |  | -    def get_json_result(response: httpx.Response, *, err_class: type[OAuth20RequestError]) -> dict:  | 
 | 205 | +    def get_json_result(response: httpx.Response, *, err_class: type[OAuth20RequestError]) -> dict[str, Any]:  | 
206 | 206 |         """Get response json"""  | 
207 | 207 |         try:  | 
208 |  | -            return cast(dict, response.json())  | 
209 |  | -        except json.decoder.JSONDecodeError as e:  | 
 | 208 | +            return cast(dict[str, Any], response.json())  | 
 | 209 | +        except json.JSONDecodeError as e:  | 
210 | 210 |             raise err_class('Result serialization failed.', response) from e  | 
211 | 211 | 
 
  | 
212 | 212 |     @abc.abstractmethod  | 
213 |  | -    async def get_userinfo(self, access_token: str) -> dict:  | 
 | 213 | +    async def get_userinfo(self, access_token: str) -> dict[str, Any]:  | 
214 | 214 |         """  | 
215 | 215 |         Get user info from the API provider  | 
216 | 216 | 
  | 
 | 
0 commit comments