From 79cd7438b1482742fd832044b90a51953609944d Mon Sep 17 00:00:00 2001 From: Oliver Rice Date: Wed, 16 Aug 2023 10:03:58 -0500 Subject: [PATCH] revert TypeAdapter to parse_obj_as for pydantic v1 support --- gotrue/_async/api.py | 4 ++-- gotrue/_sync/api.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gotrue/_async/api.py b/gotrue/_async/api.py index f23d26db..77fbf84a 100644 --- a/gotrue/_async/api.py +++ b/gotrue/_async/api.py @@ -2,7 +2,7 @@ from typing import Any, Dict, List, Optional, Union -from pydantic import TypeAdapter +from pydantic import parse_obj_as from ..exceptions import APIError from ..helpers import check_response, encode_uri_component @@ -94,7 +94,7 @@ async def list_users(self) -> List[User]: raise APIError("No users found in response", 400) if not isinstance(users, list): raise APIError("Expected a list of users", 400) - return TypeAdapter(List[User]).validate_python(users) + return parse_obj_as(List[User], users) async def sign_up_with_email( self, diff --git a/gotrue/_sync/api.py b/gotrue/_sync/api.py index aa4eaf20..abbdc480 100644 --- a/gotrue/_sync/api.py +++ b/gotrue/_sync/api.py @@ -2,7 +2,7 @@ from typing import Any, Dict, List, Optional, Union -from pydantic import TypeAdapter +from pydantic import parse_obj_as from ..exceptions import APIError from ..helpers import check_response, encode_uri_component @@ -94,7 +94,7 @@ def list_users(self) -> List[User]: raise APIError("No users found in response", 400) if not isinstance(users, list): raise APIError("Expected a list of users", 400) - return TypeAdapter(List[User]).validate_python(users) + return parse_obj_as(List[User], users) def sign_up_with_email( self,