Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Dani Reinón committed Nov 14, 2021
1 parent cb4624d commit 0f3210f
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 27 deletions.
2 changes: 1 addition & 1 deletion 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, Optional, Union

from ..helpers import encode_uri_component, check_response
from ..helpers import check_response, encode_uri_component
from ..http_clients import AsyncClient
from ..types import (
CookieOptions,
Expand Down
2 changes: 1 addition & 1 deletion gotrue/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from uuid import uuid4

from ..constants import COOKIE_OPTIONS, DEFAULT_HEADERS, GOTRUE_URL, STORAGE_KEY
from ..exceptions import APIError
from ..types import (
AuthChangeEvent,
CookieOptions,
Expand All @@ -18,7 +19,6 @@
User,
UserAttributes,
)
from ..exceptions import APIError
from .api import AsyncGoTrueAPI
from .storage import AsyncMemoryStorage, AsyncSupportedStorage

Expand Down
2 changes: 1 addition & 1 deletion 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, Optional, Union

from ..helpers import encode_uri_component, check_response
from ..helpers import check_response, encode_uri_component
from ..http_clients import SyncClient
from ..types import (
CookieOptions,
Expand Down
14 changes: 4 additions & 10 deletions gotrue/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from uuid import uuid4

from ..constants import COOKIE_OPTIONS, DEFAULT_HEADERS, GOTRUE_URL, STORAGE_KEY
from ..exceptions import APIError
from ..types import (
AuthChangeEvent,
CookieOptions,
Expand All @@ -18,7 +19,6 @@
User,
UserAttributes,
)
from ..exceptions import APIError
from .api import SyncGoTrueAPI
from .storage import SyncMemoryStorage, SyncSupportedStorage

Expand Down Expand Up @@ -377,9 +377,7 @@ def set_auth(self, *, access_token: str) -> Session:
self._save_session(session=session)
return session

def get_session_from_url(
self, *, url: str, store_session: bool = False
) -> Session:
def get_session_from_url(self, *, url: str, store_session: bool = False) -> Session:
"""Gets the session data from a URL string.
Parameters
Expand Down Expand Up @@ -571,17 +569,13 @@ def _recover_and_refresh(self) -> None:
self._save_session(session=session)
self._notify_all_subscribers(event=AuthChangeEvent.SIGNED_IN)

def _call_refresh_token(
self, *, refresh_token: Optional[str] = None
) -> Session:
def _call_refresh_token(self, *, refresh_token: Optional[str] = None) -> Session:
if refresh_token is None:
if self.current_session:
refresh_token = self.current_session.refresh_token
else:
raise ValueError("No current session and refresh_token not supplied.")
response = self.api.refresh_access_token(
refresh_token=cast(str, refresh_token)
)
response = self.api.refresh_access_token(refresh_token=cast(str, refresh_token))
self._save_session(session=response)
self._notify_all_subscribers(event=AuthChangeEvent.SIGNED_IN)
return response
Expand Down
2 changes: 1 addition & 1 deletion gotrue/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from enum import Enum
from time import time
from httpx import Response
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union

from httpx import Response
from pydantic import BaseModel, root_validator

from gotrue.helpers import check_response
Expand Down
2 changes: 1 addition & 1 deletion tests/_async/test_client_with_auto_confirm_disabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from faker import Faker

from gotrue import AsyncGoTrueClient
from gotrue.types import User
from gotrue.exceptions import APIError
from gotrue.types import User

GOTRUE_URL = "http://localhost:9999"
TEST_TWILIO = False
Expand Down
2 changes: 1 addition & 1 deletion tests/_async/test_client_with_auto_confirm_enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from faker import Faker

from gotrue import AsyncGoTrueClient
from gotrue.types import Session, User, UserAttributes
from gotrue.exceptions import APIError
from gotrue.types import Session, User, UserAttributes

GOTRUE_URL = "http://localhost:9998"
TEST_TWILIO = False
Expand Down
2 changes: 1 addition & 1 deletion tests/_sync/test_client_with_auto_confirm_disabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from faker import Faker

from gotrue import SyncGoTrueClient
from gotrue.types import User
from gotrue.exceptions import APIError
from gotrue.types import User

GOTRUE_URL = "http://localhost:9999"
TEST_TWILIO = False
Expand Down
14 changes: 4 additions & 10 deletions tests/_sync/test_client_with_auto_confirm_enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from faker import Faker

from gotrue import SyncGoTrueClient
from gotrue.types import Session, User, UserAttributes
from gotrue.exceptions import APIError
from gotrue.types import Session, User, UserAttributes

GOTRUE_URL = "http://localhost:9998"
TEST_TWILIO = False
Expand Down Expand Up @@ -93,9 +93,7 @@ def test_set_session_should_return_no_error(
assert response.refresh_token
client_with_session.set_session(refresh_token=response.refresh_token)
data = {"hello": "world"}
response = client_with_session.update(
attributes=UserAttributes(data=data)
)
response = client_with_session.update(attributes=UserAttributes(data=data))
assert response.user_metadata == data
except Exception as e:
assert False, str(e)
Expand Down Expand Up @@ -165,9 +163,7 @@ def test_sign_in_with_refresh_token(client_with_session: SyncGoTrueClient):
)
assert isinstance(response, Session)
assert response.refresh_token
response2 = client_with_session.sign_in(
refresh_token=response.refresh_token
)
response2 = client_with_session.sign_in(refresh_token=response.refresh_token)
assert isinstance(response2, Session)
assert response2.access_token
assert response2.refresh_token
Expand Down Expand Up @@ -211,9 +207,7 @@ def test_get_user(client: SyncGoTrueClient):
def test_update_user(client: SyncGoTrueClient):
try:
client.init_recover()
response = client.update(
attributes=UserAttributes(data={"hello": "world"})
)
response = client.update(attributes=UserAttributes(data={"hello": "world"}))
assert isinstance(response, User)
assert response.id
assert response.email == email
Expand Down

0 comments on commit 0f3210f

Please sign in to comment.