Skip to content

Commit 42539be

Browse files
committed
Refactor based on PR reviews
1 parent fb1286f commit 42539be

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

supertokens_python/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
1414

15+
from typing import Any, Callable, Dict, List, Optional, Union
16+
1517
from typing_extensions import Literal
16-
from typing import Callable, List, Union
18+
19+
from supertokens_python.framework.request import BaseRequest
1720

1821
from . import supertokens
1922
from .recipe_module import RecipeModule
@@ -39,3 +42,9 @@ def init(
3942

4043
def get_all_cors_headers() -> List[str]:
4144
return supertokens.Supertokens.get_instance().get_all_cors_headers()
45+
46+
47+
def get_request_from_user_context(
48+
user_context: Optional[Dict[str, Any]],
49+
) -> Optional[BaseRequest]:
50+
return Supertokens.get_instance().get_request_from_user_context(user_context)

supertokens_python/asyncio/__init__.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
14-
from typing import Any, Dict, List, Optional, Union
14+
from typing import Dict, List, Optional, Union
1515

1616
from supertokens_python import Supertokens
17-
from supertokens_python.framework.request import BaseRequest
1817
from supertokens_python.interfaces import (
1918
CreateUserIdMappingOkResult,
2019
DeleteUserIdMappingOkResult,
@@ -98,9 +97,3 @@ async def update_or_delete_user_id_mapping_info(
9897
return await Supertokens.get_instance().update_or_delete_user_id_mapping_info(
9998
user_id, user_id_type, external_user_id_info
10099
)
101-
102-
103-
def get_request_from_user_context(
104-
user_context: Optional[Dict[str, Any]],
105-
) -> Optional[BaseRequest]:
106-
return Supertokens.get_instance().get_request_from_user_context(user_context)

supertokens_python/syncio/__init__.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
14-
from typing import Any, Dict, List, Optional, Union
14+
from typing import Dict, List, Optional, Union
1515

1616
from supertokens_python import Supertokens
1717
from supertokens_python.async_to_sync_wrapper import sync
18-
from supertokens_python.framework.request import BaseRequest
1918
from supertokens_python.interfaces import (
2019
CreateUserIdMappingOkResult,
2120
DeleteUserIdMappingOkResult,
@@ -104,9 +103,3 @@ def update_or_delete_user_id_mapping_info(
104103
user_id, user_id_type, external_user_id_info
105104
)
106105
)
107-
108-
109-
def get_request_from_user_context(
110-
user_context: Optional[Dict[str, Any]],
111-
) -> Optional[BaseRequest]:
112-
return Supertokens.get_instance().get_request_from_user_context(user_context)

tests/test_user_context.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
from fastapi.testclient import TestClient
1818
from pytest import fixture, mark
1919

20-
from supertokens_python import InputAppInfo, SupertokensConfig, init
21-
from supertokens_python.asyncio import get_request_from_user_context
20+
from supertokens_python import (
21+
InputAppInfo,
22+
SupertokensConfig,
23+
get_request_from_user_context,
24+
init,
25+
)
2226
from supertokens_python.framework.fastapi import get_middleware
2327
from supertokens_python.recipe import emailpassword, session
2428
from supertokens_python.recipe.emailpassword.asyncio import sign_up

0 commit comments

Comments
 (0)