From 0215a73f424014a4c708fd7d3081dff78059bb96 Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Tue, 8 Oct 2024 14:36:56 -0300 Subject: [PATCH 1/4] fix: Types to use Option[T] --- supabase/_async/client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/supabase/_async/client.py b/supabase/_async/client.py index b0048354..a95b66b8 100644 --- a/supabase/_async/client.py +++ b/supabase/_async/client.py @@ -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. @@ -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) @@ -279,7 +279,7 @@ def _create_auth_header(self, token: str): return f"Bearer {token}" def _get_auth_headers( - self, authorization: Union[str, None] = None + self, authorization: Optional[str] = None ) -> Dict[str, str]: if authorization is None: authorization = self.options.headers.get( @@ -293,7 +293,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"]: @@ -310,7 +310,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. From 9cae1461cb8781d146984883b20ff0337d5da262 Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Tue, 8 Oct 2024 14:37:03 -0300 Subject: [PATCH 2/4] fix: Types to use Option[T] --- supabase/_sync/client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/supabase/_sync/client.py b/supabase/_sync/client.py index 9eadb47b..a7059bbd 100644 --- a/supabase/_sync/client.py +++ b/supabase/_sync/client.py @@ -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. @@ -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) @@ -278,7 +278,7 @@ def _create_auth_header(self, token: str): return f"Bearer {token}" def _get_auth_headers( - self, authorization: Union[str, None] = None + self, authorization: Optional[str] = None ) -> Dict[str, str]: if authorization is None: authorization = self.options.headers.get( @@ -292,7 +292,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"]: @@ -308,7 +308,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. From e12ab7824e09d63011ad5f615d9e58db3493fc41 Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Tue, 8 Oct 2024 14:38:09 -0300 Subject: [PATCH 3/4] fix: Types to use Option[T] --- supabase/_sync/client.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/supabase/_sync/client.py b/supabase/_sync/client.py index a7059bbd..f3ed2ba6 100644 --- a/supabase/_sync/client.py +++ b/supabase/_sync/client.py @@ -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: Optional[str] = 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) From 3be5a2399f6bf9b0b6106d18ff38b069b5376d64 Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Tue, 8 Oct 2024 14:38:21 -0300 Subject: [PATCH 4/4] fix: Types to use Option[T] --- supabase/_async/client.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/supabase/_async/client.py b/supabase/_async/client.py index a95b66b8..666571f1 100644 --- a/supabase/_async/client.py +++ b/supabase/_async/client.py @@ -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: Optional[str] = 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)