Skip to content

Commit

Permalink
revert TypeAdapter to parse_obj_as for pydantic v1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
olirice committed Aug 16, 2023
1 parent 9c4aa2a commit 79cd743
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gotrue/_async/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Any, Dict, List, Optional, Union

from pydantic import TypeAdapter
from pydantic import parse_obj_as

Check warning on line 5 in gotrue/_async/api.py

View check run for this annotation

Codecov / codecov/patch

gotrue/_async/api.py#L5

Added line #L5 was not covered by tests

from ..exceptions import APIError
from ..helpers import check_response, encode_uri_component
Expand Down Expand Up @@ -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)

Check warning on line 97 in gotrue/_async/api.py

View check run for this annotation

Codecov / codecov/patch

gotrue/_async/api.py#L97

Added line #L97 was not covered by tests

async def sign_up_with_email(
self,
Expand Down
4 changes: 2 additions & 2 deletions gotrue/_sync/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Any, Dict, List, Optional, Union

from pydantic import TypeAdapter
from pydantic import parse_obj_as

Check warning on line 5 in gotrue/_sync/api.py

View check run for this annotation

Codecov / codecov/patch

gotrue/_sync/api.py#L5

Added line #L5 was not covered by tests

from ..exceptions import APIError
from ..helpers import check_response, encode_uri_component
Expand Down Expand Up @@ -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)

Check warning on line 97 in gotrue/_sync/api.py

View check run for this annotation

Codecov / codecov/patch

gotrue/_sync/api.py#L97

Added line #L97 was not covered by tests

def sign_up_with_email(
self,
Expand Down

0 comments on commit 79cd743

Please sign in to comment.