From 45c2866739bbe20640de21b3b19439c440c750c1 Mon Sep 17 00:00:00 2001 From: Joel Lee Date: Wed, 26 May 2021 08:38:14 +0800 Subject: [PATCH 1/2] chore: update pre-commit hook --- .github/workflows/pre-commit_hooks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit_hooks.yaml b/.github/workflows/pre-commit_hooks.yaml index 656d87f4..da918515 100644 --- a/.github/workflows/pre-commit_hooks.yaml +++ b/.github/workflows/pre-commit_hooks.yaml @@ -1,6 +1,6 @@ name: pre-commit -on: [push] +on: [push, pull_request] jobs: build: From 4776baae2b60218b3edf46f9fbe86ca87bce5237 Mon Sep 17 00:00:00 2001 From: Joel Lee Date: Wed, 26 May 2021 08:41:16 +0800 Subject: [PATCH 2/2] chore: apply formatters to unformatted files --- supabase_py/client.py | 12 ++++++------ supabase_py/lib/storage/storage_bucket_api.py | 14 ++++++++++---- tests/test_client.py | 4 +++- tests/test_dummy.py | 5 ----- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/supabase_py/client.py b/supabase_py/client.py index d34a13c2..9a65370b 100644 --- a/supabase_py/client.py +++ b/supabase_py/client.py @@ -7,10 +7,6 @@ from supabase_py.lib.realtime_client import SupabaseRealtimeClient from supabase_py.lib.supabase_storage_client import SupabaseStorageClient - -from typing import Any, Dict - - DEFAULT_OPTIONS = { "schema": "public", "auto_refresh_token": True, @@ -149,9 +145,13 @@ def get_subscriptions(self): return self.realtime.channels @staticmethod - def _init_realtime_client(realtime_url: str, supabase_key: str) -> SupabaseRealtimeClient: + def _init_realtime_client( + realtime_url: str, supabase_key: str + ) -> SupabaseRealtimeClient: """Private method for creating an instance of the realtime-py client.""" - return SupabaseRealtimeClient(realtime_url, {"params": {"apikey": supabase_key}}) + return SupabaseRealtimeClient( + realtime_url, {"params": {"apikey": supabase_key}} + ) @staticmethod def _init_supabase_auth_client( diff --git a/supabase_py/lib/storage/storage_bucket_api.py b/supabase_py/lib/storage/storage_bucket_api.py index eecd6ccc..0b6658d8 100644 --- a/supabase_py/lib/storage/storage_bucket_api.py +++ b/supabase_py/lib/storage/storage_bucket_api.py @@ -1,4 +1,4 @@ -from typing import Dict, Any +from typing import Any, Dict import requests from requests import HTTPError @@ -50,7 +50,9 @@ def create_bucket(self, id: str) -> Dict[str, Any]: A unique identifier for the bucket you are creating. """ try: - response = requests.post(f"{self.url}/bucket", data={"id": id}, headers=self.headers) + response = requests.post( + f"{self.url}/bucket", data={"id": id}, headers=self.headers + ) response.raise_for_status() except HTTPError as http_err: print(f"HTTP error occurred: {http_err}") # Python 3.6 @@ -68,7 +70,9 @@ def empty_bucket(self, id: str) -> Dict[str, Any]: The unique identifier of the bucket you would like to empty. """ try: - response = requests.post(f"{self.url}/bucket/{id}/empty", data={}, headers=self.headers) + response = requests.post( + f"{self.url}/bucket/{id}/empty", data={}, headers=self.headers + ) response.raise_for_status() except HTTPError as http_err: print(f"HTTP error occurred: {http_err}") # Python 3.6 @@ -87,7 +91,9 @@ def delete_bucket(self, id: str) -> Dict[str, Any]: The unique identifier of the bucket you would like to delete. """ try: - response = requests.delete(f"{self.url}/bucket/{id}", data={}, headers=self.headers) + response = requests.delete( + f"{self.url}/bucket/{id}", data={}, headers=self.headers + ) response.raise_for_status() except HTTPError as http_err: diff --git a/tests/test_client.py b/tests/test_client.py index ba33fabb..f8de8c1b 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -26,7 +26,9 @@ def _assert_authenticated_user(data: Dict[str, Any]) -> None: assert user.get("aud") == "authenticated" -@pytest.mark.xfail(reason="None of these values should be able to instanciate a client object") +@pytest.mark.xfail( + reason="None of these values should be able to instanciate a client object" +) @pytest.mark.parametrize("url", ["", None, "valeefgpoqwjgpj", 139, -1, {}, []]) @pytest.mark.parametrize("key", ["", None, "valeefgpoqwjgpj", 139, -1, {}, []]) def test_incorrect_values_dont_instanciate_client(url: Any, key: Any) -> None: diff --git a/tests/test_dummy.py b/tests/test_dummy.py index fca09c2d..54a1a871 100644 --- a/tests/test_dummy.py +++ b/tests/test_dummy.py @@ -1,6 +1,3 @@ -import pytest - - import supabase_py """ @@ -10,12 +7,10 @@ """ - def test_dummy() -> None: # Test auth component assert True == True - def test_client_initialziation() -> None: client = supabase_py.Client("http://testwebsite.com", "atestapi")