Skip to content

Commit

Permalink
refactor: reformat with latest black version
Browse files Browse the repository at this point in the history
  • Loading branch information
jcwillox committed Nov 20, 2024
1 parent 6211105 commit 0334fe9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 38 deletions.
1 change: 1 addition & 0 deletions upbankapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Typed python client for interacting with Up's banking API."""

from .client import Client
from .exceptions import *

Expand Down
61 changes: 23 additions & 38 deletions upbankapi/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def __init__(self, token: str = None):
@abstractmethod
def api(
self, endpoint: str, method: str = "GET", body: Dict = None, params=None
) -> Union[bool, Dict, Coroutine[Any, Any, Union[bool, Dict]]]:
...
) -> Union[bool, Dict, Coroutine[Any, Any, Union[bool, Dict]]]: ...

def _handle_response(
self, data: Dict, status: int, headers: Optional[Dict]
Expand All @@ -73,8 +72,7 @@ def _handle_response(
return data

@abstractmethod
def ping(self) -> Union[str, Coroutine[Any, Any, str]]:
...
def ping(self) -> Union[str, Coroutine[Any, Any, str]]: ...

def _handle_ping(self):
return self.api("/util/ping")
Expand All @@ -83,8 +81,7 @@ def _handle_ping(self):
@abstractmethod
def account(
self, account_id: str
) -> Union[Account, Coroutine[Any, Any, AsyncAccount]]:
...
) -> Union[Account, Coroutine[Any, Any, AsyncAccount]]: ...

def _handle_account(self, account_id: str):
return self.api(f"/accounts/{account_id}")
Expand All @@ -99,8 +96,7 @@ def accounts(
page_size: int = DEFAULT_PAGE_SIZE,
) -> Union[
PaginatedList[Account], Coroutine[Any, Any, AsyncPaginatedList[AsyncAccount]]
]:
...
]: ...

def _handle_accounts(
self,
Expand All @@ -125,17 +121,15 @@ def _handle_accounts(
@abstractmethod
def category(
self, category_id: str
) -> Union[Category, Coroutine[Any, Any, AsyncCategory]]:
...
) -> Union[Category, Coroutine[Any, Any, AsyncCategory]]: ...

def _handle_category(self, category_id: str):
return self.api(f"/categories/{category_id}")

@abstractmethod
def categories(
self, parent: Union[str, PartialCategory]
) -> Union[List[Category], Coroutine[Any, Any, List[AsyncCategory]]]:
...
) -> Union[List[Category], Coroutine[Any, Any, List[AsyncCategory]]]: ...

def _handle_categories(self, parent: Union[str, PartialCategory]):
filters = Filters()
Expand All @@ -151,8 +145,7 @@ def categorize(
self,
transaction: Union[str, Transaction],
category: Optional[Union[str, PartialCategory]],
) -> Union[bool, Coroutine[Any, Any, bool]]:
...
) -> Union[bool, Coroutine[Any, Any, bool]]: ...

def _handle_categorize(
self,
Expand Down Expand Up @@ -181,17 +174,17 @@ def _handle_categorize(
@abstractmethod
def tags(
self, *, limit: int = None, page_size: int = DEFAULT_PAGE_SIZE
) -> Union[PaginatedList[Tag], Coroutine[Any, Any, AsyncPaginatedList[AsyncTag]]]:
...
) -> Union[
PaginatedList[Tag], Coroutine[Any, Any, AsyncPaginatedList[AsyncTag]]
]: ...

def _handle_tags(self, limit: int = None, page_size: int = DEFAULT_PAGE_SIZE):
return self.api("/tags", params=Filters(page_size, limit))

@abstractmethod
def add_tags(
self, transaction: Union[str, Transaction], *tags: Union[str, Tag]
) -> Union[bool, Coroutine[Any, Any, bool]]:
...
) -> Union[bool, Coroutine[Any, Any, bool]]: ...

def _handle_add_tags(
self, transaction: Union[str, Transaction], *tags: Union[str, Tag]
Expand All @@ -201,8 +194,7 @@ def _handle_add_tags(
@abstractmethod
def remove_tags(
self, transaction: Union[str, Transaction], *tags: Union[str, Tag]
) -> Union[bool, Coroutine[Any, Any, bool]]:
...
) -> Union[bool, Coroutine[Any, Any, bool]]: ...

def _handle_remove_tags(
self, transaction: Union[str, Transaction], *tags: Union[str, Tag]
Expand Down Expand Up @@ -231,8 +223,7 @@ def _handle_add_remove_tags(
@abstractmethod
def transaction(
self, transaction_id: str
) -> Union[Transaction, Coroutine[Any, Any, AsyncTransaction]]:
...
) -> Union[Transaction, Coroutine[Any, Any, AsyncTransaction]]: ...

def _handle_transaction(self, transaction_id: str):
return self.api(f"/transactions/{transaction_id}")
Expand All @@ -252,8 +243,7 @@ def transactions(
) -> Union[
PaginatedList[Transaction],
Coroutine[Any, Any, AsyncPaginatedList[AsyncTransaction]],
]:
...
]: ...

def _handle_transactions(
self,
Expand Down Expand Up @@ -300,8 +290,7 @@ def webhooks(
self, *, limit: int = None, page_size: int = DEFAULT_PAGE_SIZE
) -> Union[
PaginatedList[Webhook], Coroutine[Any, Any, AsyncPaginatedList[AsyncWebhook]]
]:
...
]: ...

def _handle_webhooks(self, limit: int = None, page_size: int = DEFAULT_PAGE_SIZE):
return self.api("/webhooks", params=Filters(page_size, limit))
Expand All @@ -313,21 +302,20 @@ class WebhookAdapterBase(ABC):
@abstractmethod
def __call__(
self, webhook_id: str
) -> Union[Webhook, Coroutine[Any, Any, AsyncWebhook]]:
...
) -> Union[Webhook, Coroutine[Any, Any, AsyncWebhook]]: ...

@abstractmethod
def get(self, webhook_id: str) -> Union[Webhook, Coroutine[Any, Any, AsyncWebhook]]:
...
def get(
self, webhook_id: str
) -> Union[Webhook, Coroutine[Any, Any, AsyncWebhook]]: ...

def _handle_get(self, webhook_id: str):
return self._client.api(f"/webhooks/{webhook_id}")

@abstractmethod
def create(
self, url: str, description: str = None
) -> Union[Webhook, Coroutine[Any, Any, AsyncWebhook]]:
...
) -> Union[Webhook, Coroutine[Any, Any, AsyncWebhook]]: ...

def _handle_create(self, url: str, description: str = None):
return self._client.api(
Expand All @@ -339,8 +327,7 @@ def _handle_create(self, url: str, description: str = None):
@abstractmethod
def ping(
self, webhook: Union[str, Webhook]
) -> Union[WebhookEvent, Coroutine[Any, Any, AsyncWebhookEvent]]:
...
) -> Union[WebhookEvent, Coroutine[Any, Any, AsyncWebhookEvent]]: ...

def _handle_ping(self, webhook: Union[str, Webhook]):
if isinstance(webhook, Webhook):
Expand All @@ -357,8 +344,7 @@ def logs(
) -> Union[
PaginatedList[WebhookLog],
Coroutine[Any, Any, AsyncPaginatedList[AsyncWebhookLog]],
]:
...
]: ...

def _handle_logs(
self,
Expand All @@ -375,8 +361,7 @@ def _handle_logs(
@abstractmethod
def delete(
self, webhook: Union[str, Webhook]
) -> Union[bool, Coroutine[Any, Any, bool]]:
...
) -> Union[bool, Coroutine[Any, Any, bool]]: ...

def _handle_delete(self, webhook: Union[str, Webhook]):
if isinstance(webhook, Webhook):
Expand Down
1 change: 1 addition & 0 deletions upbankapi/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Models used for deserializing the data from the API."""

from .pagination import PaginatedList, AsyncPaginatedList
from .accounts import AccountType, OwnershipType, Account
from .transactions import TransactionStatus, CardPurchaseMethodEnum, Transaction
Expand Down

0 comments on commit 0334fe9

Please sign in to comment.