19
19
from supertokens_python .framework .request import BaseRequest
20
20
21
21
from supertokens_python .recipe .emailpassword import EmailPasswordRecipe
22
- from supertokens_python .recipe .emailpassword .asyncio import \
23
- get_user_by_id as ep_get_user_by_id
22
+ from supertokens_python .recipe .emailpassword .asyncio import (
23
+ get_user_by_id as ep_get_user_by_id ,
24
+ )
24
25
from supertokens_python .recipe .passwordless import PasswordlessRecipe
25
- from supertokens_python .recipe .passwordless .asyncio import \
26
- get_user_by_id as pless_get_user_by_id
26
+ from supertokens_python .recipe .passwordless .asyncio import (
27
+ get_user_by_id as pless_get_user_by_id ,
28
+ )
27
29
from supertokens_python .recipe .thirdparty import ThirdPartyRecipe
28
- from supertokens_python .recipe .thirdparty .asyncio import \
29
- get_user_by_id as tp_get_user_by_idx
30
- from supertokens_python .recipe .thirdpartyemailpassword import \
31
- ThirdPartyEmailPasswordRecipe
32
- from supertokens_python .recipe .thirdpartyemailpassword .asyncio import \
33
- get_user_by_id as tpep_get_user_by_id
34
- from supertokens_python .recipe .thirdpartypasswordless import \
35
- ThirdPartyPasswordlessRecipe
36
- from supertokens_python .recipe .thirdpartypasswordless .asyncio import \
37
- get_user_by_id as tppless_get_user_by_id
30
+ from supertokens_python .recipe .thirdparty .asyncio import (
31
+ get_user_by_id as tp_get_user_by_idx ,
32
+ )
33
+ from supertokens_python .recipe .thirdpartyemailpassword import (
34
+ ThirdPartyEmailPasswordRecipe ,
35
+ )
36
+ from supertokens_python .recipe .thirdpartyemailpassword .asyncio import (
37
+ get_user_by_id as tpep_get_user_by_id ,
38
+ )
39
+ from supertokens_python .recipe .thirdpartypasswordless import (
40
+ ThirdPartyPasswordlessRecipe ,
41
+ )
42
+ from supertokens_python .recipe .thirdpartypasswordless .asyncio import (
43
+ get_user_by_id as tppless_get_user_by_id ,
44
+ )
38
45
from supertokens_python .types import User
39
46
from supertokens_python .utils import Awaitable
40
47
41
48
from ...normalised_url_path import NormalisedURLPath
42
49
from ...supertokens import AppInfo
43
- from .constants import (DASHBOARD_API , EMAIL_PASSSWORD_SIGNOUT ,
44
- EMAIL_PASSWORD_SIGN_IN , USER_API ,
45
- USER_EMAIL_VERIFY_API , USER_EMAIL_VERIFY_TOKEN_API ,
46
- USER_METADATA_API , USER_PASSWORD_API , USER_SESSION_API ,
47
- USERS_COUNT_API , USERS_LIST_GET_API , VALIDATE_KEY_API )
50
+ from .constants import (
51
+ DASHBOARD_API ,
52
+ EMAIL_PASSSWORD_SIGNOUT ,
53
+ EMAIL_PASSWORD_SIGN_IN ,
54
+ USER_API ,
55
+ USER_EMAIL_VERIFY_API ,
56
+ USER_EMAIL_VERIFY_TOKEN_API ,
57
+ USER_METADATA_API ,
58
+ USER_PASSWORD_API ,
59
+ USER_SESSION_API ,
60
+ USERS_COUNT_API ,
61
+ USERS_LIST_GET_API ,
62
+ VALIDATE_KEY_API ,
63
+ )
48
64
49
65
if TYPE_CHECKING :
50
66
from .interfaces import APIInterface , RecipeInterface
@@ -132,8 +148,7 @@ def to_json(self) -> Dict[str, Any]:
132
148
class InputOverrideConfig :
133
149
def __init__ (
134
150
self ,
135
- functions : Union [Callable [[RecipeInterface ],
136
- RecipeInterface ], None ] = None ,
151
+ functions : Union [Callable [[RecipeInterface ], RecipeInterface ], None ] = None ,
137
152
apis : Union [Callable [[APIInterface ], APIInterface ], None ] = None ,
138
153
):
139
154
self .functions = functions
@@ -143,8 +158,7 @@ def __init__(
143
158
class OverrideConfig :
144
159
def __init__ (
145
160
self ,
146
- functions : Union [Callable [[RecipeInterface ],
147
- RecipeInterface ], None ] = None ,
161
+ functions : Union [Callable [[RecipeInterface ], RecipeInterface ], None ] = None ,
148
162
apis : Union [Callable [[APIInterface ], APIInterface ], None ] = None ,
149
163
):
150
164
self .functions = functions
@@ -153,10 +167,7 @@ def __init__(
153
167
154
168
class DashboardConfig :
155
169
def __init__ (
156
- self ,
157
- api_key : str ,
158
- override : OverrideConfig ,
159
- auth_mode : str
170
+ self , api_key : Union [str , None ], override : OverrideConfig , auth_mode : str
160
171
):
161
172
self .api_key = api_key
162
173
self .override = override
@@ -165,7 +176,7 @@ def __init__(
165
176
166
177
def validate_and_normalise_user_input (
167
178
# app_info: AppInfo,
168
- api_key : str ,
179
+ api_key : Union [ str , None ] ,
169
180
override : Optional [InputOverrideConfig ] = None ,
170
181
) -> DashboardConfig :
171
182
@@ -178,7 +189,7 @@ def validate_and_normalise_user_input(
178
189
functions = override .functions ,
179
190
apis = override .apis ,
180
191
),
181
- "api-key" if api_key else "email-password"
192
+ "api-key" if api_key else "email-password" ,
182
193
)
183
194
184
195
@@ -190,8 +201,7 @@ def is_api_path(path: NormalisedURLPath, app_info: AppInfo) -> bool:
190
201
if not path .startswith (dashboard_recipe_base_path ):
191
202
return False
192
203
193
- path_without_dashboard_path = path .get_as_string_dangerous ().split (DASHBOARD_API )[
194
- 1 ]
204
+ path_without_dashboard_path = path .get_as_string_dangerous ().split (DASHBOARD_API )[1 ]
195
205
196
206
if len (path_without_dashboard_path ) > 0 and path_without_dashboard_path [0 ] == "/" :
197
207
path_without_dashboard_path = path_without_dashboard_path [1 :]
@@ -242,16 +252,15 @@ def __init__(self, user: UserWithMetadata, recipe: str):
242
252
243
253
244
254
if TYPE_CHECKING :
245
- from supertokens_python .recipe .emailpassword .types import \
246
- User as EmailPasswordUser
247
- from supertokens_python .recipe .passwordless .types import \
248
- User as PasswordlessUser
249
- from supertokens_python .recipe .thirdparty .types import \
250
- User as ThirdPartyUser
251
- from supertokens_python .recipe .thirdpartyemailpassword .types import \
252
- User as ThirdPartyEmailPasswordUser
253
- from supertokens_python .recipe .thirdpartypasswordless .types import \
254
- User as ThirdPartyPasswordlessUser
255
+ from supertokens_python .recipe .emailpassword .types import User as EmailPasswordUser
256
+ from supertokens_python .recipe .passwordless .types import User as PasswordlessUser
257
+ from supertokens_python .recipe .thirdparty .types import User as ThirdPartyUser
258
+ from supertokens_python .recipe .thirdpartyemailpassword .types import (
259
+ User as ThirdPartyEmailPasswordUser ,
260
+ )
261
+ from supertokens_python .recipe .thirdpartypasswordless .types import (
262
+ User as ThirdPartyPasswordlessUser ,
263
+ )
255
264
256
265
GetUserResult = Union [
257
266
EmailPasswordUser ,
0 commit comments