Skip to content

Commit

Permalink
Merge branch 'main' into update-typeddict
Browse files Browse the repository at this point in the history
  • Loading branch information
newwingbird authored Oct 15, 2024
2 parents 3583bdb + c36d80f commit 3e0613d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers = [
python = "^3.9"
postgrest = "^0.17.0"
realtime = "^2.0.0"
gotrue = "^2.7.0"
gotrue = "^2.9.0"
httpx = ">=0.26,<0.28"
storage3 = "^0.8.0"
supafunc = "^0.6.0"
Expand Down
12 changes: 5 additions & 7 deletions supabase/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
self,
supabase_url: str,
supabase_key: str,
options: Union[ClientOptions, None] = None,
options: Optional[ClientOptions] = None,
):
"""Instantiate the client.
Expand Down Expand Up @@ -97,7 +97,7 @@ async def create(
cls,
supabase_url: str,
supabase_key: str,
options: Union[ClientOptions, None] = None,
options: Optional[ClientOptions] = None,
):
auth_header = options.headers.get("Authorization") if options else None
client = cls(supabase_url, supabase_key, options)
Expand Down Expand Up @@ -278,9 +278,7 @@ def _init_postgrest_client(
def _create_auth_header(self, token: str):
return f"Bearer {token}"

def _get_auth_headers(
self, authorization: Union[str, None] = None
) -> Dict[str, str]:
def _get_auth_headers(self, authorization: Optional[str] = None) -> Dict[str, str]:
if authorization is None:
authorization = self.options.headers.get(
"Authorization", self._create_auth_header(self.supabase_key)
Expand All @@ -293,7 +291,7 @@ def _get_auth_headers(
}

def _listen_to_auth_events(
self, event: AuthChangeEvent, session: Union[Session, None]
self, event: AuthChangeEvent, session: Optional[Session]
):
access_token = self.supabase_key
if event in ["SIGNED_IN", "TOKEN_REFRESHED", "SIGNED_OUT"]:
Expand All @@ -310,7 +308,7 @@ def _listen_to_auth_events(
async def create_client(
supabase_url: str,
supabase_key: str,
options: Union[ClientOptions, None] = None,
options: Optional[ClientOptions] = None,
) -> AsyncClient:
"""Create client function to instantiate supabase client like JS runtime.
Expand Down
12 changes: 5 additions & 7 deletions supabase/_sync/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
self,
supabase_url: str,
supabase_key: str,
options: Union[ClientOptions, None] = None,
options: Optional[ClientOptions] = None,
):
"""Instantiate the client.
Expand Down Expand Up @@ -96,7 +96,7 @@ def create(
cls,
supabase_url: str,
supabase_key: str,
options: Union[ClientOptions, None] = None,
options: Optional[ClientOptions] = None,
):
auth_header = options.headers.get("Authorization") if options else None
client = cls(supabase_url, supabase_key, options)
Expand Down Expand Up @@ -277,9 +277,7 @@ def _init_postgrest_client(
def _create_auth_header(self, token: str):
return f"Bearer {token}"

def _get_auth_headers(
self, authorization: Union[str, None] = None
) -> Dict[str, str]:
def _get_auth_headers(self, authorization: Optional[str] = None) -> Dict[str, str]:
if authorization is None:
authorization = self.options.headers.get(
"Authorization", self._create_auth_header(self.supabase_key)
Expand All @@ -292,7 +290,7 @@ def _get_auth_headers(
}

def _listen_to_auth_events(
self, event: AuthChangeEvent, session: Union[Session, None]
self, event: AuthChangeEvent, session: Optional[Session]
):
access_token = self.supabase_key
if event in ["SIGNED_IN", "TOKEN_REFRESHED", "SIGNED_OUT"]:
Expand All @@ -308,7 +306,7 @@ def _listen_to_auth_events(
def create_client(
supabase_url: str,
supabase_key: str,
options: Union[ClientOptions, None] = None,
options: Optional[ClientOptions] = None,
) -> SyncClient:
"""Create client function to instantiate supabase client like JS runtime.
Expand Down

0 comments on commit 3e0613d

Please sign in to comment.