Skip to content

Format unformatted files #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit_hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pre-commit

on: [push]
on: [push, pull_request]

jobs:
build:
Expand Down
12 changes: 6 additions & 6 deletions supabase_py/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
14 changes: 10 additions & 4 deletions supabase_py/lib/storage/storage_bucket_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Any
from typing import Any, Dict

import requests
from requests import HTTPError
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 0 additions & 5 deletions tests/test_dummy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import pytest


import supabase_py

"""
Expand All @@ -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")