From cb1dd66fafacd2a4b035151b9f4721a5a22d0bde Mon Sep 17 00:00:00 2001 From: Siddhant Sadangi Date: Sat, 9 Dec 2023 16:41:46 +0100 Subject: [PATCH] v1.2.2: Fixed type annotations for backward compatibility with python 3.8 (#9) --- src/st_supabase_connection/__init__.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/st_supabase_connection/__init__.py b/src/st_supabase_connection/__init__.py index 27bb8d9..ed30613 100644 --- a/src/st_supabase_connection/__init__.py +++ b/src/st_supabase_connection/__init__.py @@ -11,7 +11,7 @@ from streamlit.connections import BaseConnection from supabase import Client, create_client -__version__ = "1.2.1" +__version__ = "1.2.2" class SupabaseConnection(BaseConnection[Client]): @@ -138,8 +138,8 @@ def create_bucket( name: Optional[str] = None, public: Optional[bool] = False, file_size_limit: Optional[int] = None, - allowed_mime_types: Optional[list[str]] = None, - ) -> dict[str, str]: + allowed_mime_types: Optional["list[str]"] = None, + ) -> "dict[str, str]": """Creates a new storage bucket. Parameters @@ -175,7 +175,7 @@ def upload( file: Union[str, Path, BytesIO], destination_path: str, overwrite: Literal["true", "false"] = "false", - ) -> dict[str, str]: + ) -> "dict[str, str]": """Uploads a file to a Supabase bucket. Parameters @@ -263,8 +263,8 @@ def update_bucket( bucket_id: str, public: Optional[bool] = False, file_size_limit: Optional[bool] = None, - allowed_mime_types: Optional[Union[str, list[str]]] = None, - ) -> dict[str, str]: + allowed_mime_types: Optional[Union[str, "list[str]"]] = None, + ) -> "dict[str, str]": """Update a storage bucket. Parameters @@ -288,7 +288,7 @@ def update_bucket( response = self.client.storage._request("PUT", f"/bucket/{bucket_id}", json=json) return response.json() - def move(self, bucket_id: str, from_path: str, to_path: str) -> dict[str, str]: + def move(self, bucket_id: str, from_path: str, to_path: str) -> "dict[str, str]": """Moves an existing file, optionally renaming it at the same time. Parameters @@ -311,7 +311,7 @@ def move(self, bucket_id: str, from_path: str, to_path: str) -> dict[str, str]: ) return response.json() - def remove(self, bucket_id: str, paths: list) -> dict[str, str]: + def remove(self, bucket_id: str, paths: list) -> "dict[str, str]": """Deletes files within the same bucket Parameters @@ -337,7 +337,7 @@ def list_objects( sortby: Optional[Literal["name", "updated_at", "created_at", "last_accessed_at"]] = "name", order: Optional[Literal["asc", "desc"]] = "asc", ttl: Optional[Union[float, timedelta, str]] = None, - ) -> list[dict[str, str]]: + ) -> "list[dict[str, str]]": """Lists all the objects within a bucket. Parameters @@ -374,9 +374,9 @@ def _list_objects(_self, bucket_id, path, limit, offset, sortby, order): def create_signed_urls( self, bucket_id: str, - paths: list[str], + paths: "list[str]", expires_in: int, - ) -> list[dict[str, str]]: + ) -> "list[dict[str, str]]": """Parameters ---------- bucket_id : str @@ -424,7 +424,7 @@ def _get_public_url(_self, bucket_id, filepath): return _get_public_url(self, bucket_id, filepath) - def create_signed_upload_url(self, bucket_id: str, path: str) -> dict[str, str]: + def create_signed_upload_url(self, bucket_id: str, path: str) -> "dict[str, str]": """Parameters ---------- bucket_id : str @@ -459,7 +459,7 @@ def upload_to_signed_url( path: str, token: str, file: Union[str, Path, BytesIO], - ) -> dict[str, str]: + ) -> "dict[str, str]": """Upload a file with a token generated from `.create_signed_url()` Parameters