diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d0f2143..fd9768d4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: - id: "check-toml" - repo: https://github.com/psf/black - rev: 24.8.0 + rev: 22.12.0 hooks: - id: black files: &files '^(glQiwiApi|tests|examples|benchmarks|docs)' diff --git a/glQiwiApi/core/cache/storage.py b/glQiwiApi/core/cache/storage.py index 8c61dc9a..a01e71bc 100644 --- a/glQiwiApi/core/cache/storage.py +++ b/glQiwiApi/core/cache/storage.py @@ -33,12 +33,10 @@ async def delete(self, key: str) -> None: pass @abc.abstractmethod - async def retrieve_all(self) -> List[Any]: - ... + async def retrieve_all(self) -> List[Any]: ... @abc.abstractmethod - async def contains_similar(self, item: Any) -> bool: - ... + async def contains_similar(self, item: Any) -> bool: ... def __getitem__(self, item: Any) -> Any: return self.retrieve(item) diff --git a/glQiwiApi/core/event_fetching/webhooks/config.py b/glQiwiApi/core/event_fetching/webhooks/config.py index 6179cb89..946f8921 100644 --- a/glQiwiApi/core/event_fetching/webhooks/config.py +++ b/glQiwiApi/core/event_fetching/webhooks/config.py @@ -48,9 +48,9 @@ class RoutesConfig: @dataclass() class EncryptionConfig: secret_p2p_key: str - base64_encryption_key: Optional[ - str - ] = None # taken from QIWI API using QiwiWallet instance by default + base64_encryption_key: Optional[str] = ( + None # taken from QIWI API using QiwiWallet instance by default + ) @dataclass() diff --git a/glQiwiApi/core/request_service.py b/glQiwiApi/core/request_service.py index d246e6c0..2cce3c7c 100644 --- a/glQiwiApi/core/request_service.py +++ b/glQiwiApi/core/request_service.py @@ -14,8 +14,7 @@ class RequestServiceProto(Protocol): - async def execute_api_method(self, method: APIMethod[T], **url_kw: Any) -> T: - ... + async def execute_api_method(self, method: APIMethod[T], **url_kw: Any) -> T: ... async def get_json_content( self, @@ -27,8 +26,7 @@ async def get_json_content( headers: Optional[Any] = None, params: Optional[Any] = None, **kwargs: Any, - ) -> Dict[str, Any]: - ... + ) -> Dict[str, Any]: ... async def send_request( self, @@ -40,11 +38,9 @@ async def send_request( headers: Optional[Any] = None, params: Optional[Any] = None, **kwargs: Any, - ) -> HTTPResponse: - ... + ) -> HTTPResponse: ... - async def shutdown(self) -> None: - ... + async def shutdown(self) -> None: ... class RequestService: diff --git a/glQiwiApi/qiwi/clients/p2p/methods/create_p2p_key_pair.py b/glQiwiApi/qiwi/clients/p2p/methods/create_p2p_key_pair.py index eff0b945..5d7e1d20 100644 --- a/glQiwiApi/qiwi/clients/p2p/methods/create_p2p_key_pair.py +++ b/glQiwiApi/qiwi/clients/p2p/methods/create_p2p_key_pair.py @@ -9,9 +9,9 @@ class CreateP2PKeyPair(QiwiAPIMethod[PairOfP2PKeys]): http_method: ClassVar[str] = 'POST' - url: ClassVar[ - str - ] = 'https://api.qiwi.com/partner/bill/v1/bills/widgets-api/api/p2p/protected/keys/create' + url: ClassVar[str] = ( + 'https://api.qiwi.com/partner/bill/v1/bills/widgets-api/api/p2p/protected/keys/create' + ) json_payload_schema: ClassVar[Dict[str, Any]] = { 'keysPairName': RuntimeValue(), diff --git a/glQiwiApi/qiwi/clients/wallet/methods/authenticate_wallet.py b/glQiwiApi/qiwi/clients/wallet/methods/authenticate_wallet.py index 21a4dbd7..5b28f78c 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/authenticate_wallet.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/authenticate_wallet.py @@ -6,9 +6,9 @@ class AuthenticateWallet(QiwiAPIMethod[Dict[str, Any]]): - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/identification/v1/persons/{phone_number}/identification' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/identification/v1/persons/{phone_number}/identification' + ) http_method: ClassVar[str] = 'POST' passport: str diff --git a/glQiwiApi/qiwi/clients/wallet/methods/check_restriction.py b/glQiwiApi/qiwi/clients/wallet/methods/check_restriction.py index 622013de..5ab8b38a 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/check_restriction.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/check_restriction.py @@ -5,7 +5,7 @@ class GetRestrictions(QiwiAPIMethod[List[Restriction]]): - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/person-profile/v1/persons/{phone_number}/status/restrictions' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/person-profile/v1/persons/{phone_number}/status/restrictions' + ) http_method: ClassVar[str] = 'GET' diff --git a/glQiwiApi/qiwi/clients/wallet/methods/fetch_statistics.py b/glQiwiApi/qiwi/clients/wallet/methods/fetch_statistics.py index d7bd66ed..7743d4ca 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/fetch_statistics.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/fetch_statistics.py @@ -10,9 +10,9 @@ class FetchStatistics(QiwiAPIMethod[Statistic]): - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/payment-history/v2/persons/{phone_number}/payments/total' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/payment-history/v2/persons/{phone_number}/payments/total' + ) http_method: ClassVar[str] = 'GET' start_date: datetime = Field(default_factory=datetime.now) diff --git a/glQiwiApi/qiwi/clients/wallet/methods/get_available_balances.py b/glQiwiApi/qiwi/clients/wallet/methods/get_available_balances.py index d25e82f8..66053782 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/get_available_balances.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/get_available_balances.py @@ -7,6 +7,6 @@ class GetAvailableBalances(QiwiAPIMethod[List[AvailableBalance]]): http_method: ClassVar[str] = 'GET' - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/funding-sources/v2/persons/{phone_number}/accounts/offer' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/funding-sources/v2/persons/{phone_number}/accounts/offer' + ) diff --git a/glQiwiApi/qiwi/clients/wallet/methods/get_identification.py b/glQiwiApi/qiwi/clients/wallet/methods/get_identification.py index 8cf34974..21ee890f 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/get_identification.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/get_identification.py @@ -6,6 +6,6 @@ class GetIdentification(QiwiAPIMethod[Identification]): http_method: ClassVar[str] = 'GET' - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/identification/v1/persons/{phone_number}/identification' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/identification/v1/persons/{phone_number}/identification' + ) diff --git a/glQiwiApi/qiwi/clients/wallet/methods/get_receipt.py b/glQiwiApi/qiwi/clients/wallet/methods/get_receipt.py index f36380ab..2e474aa0 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/get_receipt.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/get_receipt.py @@ -9,9 +9,9 @@ class GetReceipt(QiwiAPIMethod[File]): - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/payment-history/v1/transactions/{transaction_id}/cheque/file' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/payment-history/v1/transactions/{transaction_id}/cheque/file' + ) http_method: ClassVar[str] = 'GET' transaction_id: Union[str, int] = Field(..., path_runtime_value=True) diff --git a/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/confirm_qiwi_master.py b/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/confirm_qiwi_master.py index 50366f2e..ba7e9757 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/confirm_qiwi_master.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/confirm_qiwi_master.py @@ -7,9 +7,9 @@ class ConfirmQiwiMasterPurchaseOrder(QiwiAPIMethod[OrderDetails]): - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/cards/v2/persons/{phone_number}/orders/{order_id}/submit' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/cards/v2/persons/{phone_number}/orders/{order_id}/submit' + ) http_method: ClassVar[str] = 'PUT' order_id: str = Field(..., path_runtime_value=True) diff --git a/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/get_statement.py b/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/get_statement.py index d9ea116a..817a8699 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/get_statement.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/get_statement.py @@ -9,9 +9,9 @@ class GetQiwiMasterStatement(QiwiAPIMethod[File]): - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/payment-history/v1/persons/{phone_number}/cards/{card_id}/statement' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/payment-history/v1/persons/{phone_number}/cards/{card_id}/statement' + ) http_method: ClassVar[str] = 'GET' card_id: str = Field(..., path_runtime_value=True) diff --git a/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/unblock_card.py b/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/unblock_card.py index 21f2c920..cf695de2 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/unblock_card.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/qiwi_master/unblock_card.py @@ -6,9 +6,9 @@ class UnblockQiwiMasterCard(QiwiAPIMethod[Dict[str, Any]]): - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/cards/v2/persons/{phone_number}/cards/{card_id}/unblock' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/cards/v2/persons/{phone_number}/cards/{card_id}/unblock' + ) http_method: ClassVar[str] = 'GET' card_id: str = Field(..., path_runtime_value=True) diff --git a/glQiwiApi/qiwi/clients/wallet/methods/set_default_balance.py b/glQiwiApi/qiwi/clients/wallet/methods/set_default_balance.py index a177ab73..9600bf50 100644 --- a/glQiwiApi/qiwi/clients/wallet/methods/set_default_balance.py +++ b/glQiwiApi/qiwi/clients/wallet/methods/set_default_balance.py @@ -7,8 +7,8 @@ class SetDefaultBalance(QiwiAPIMethod[Dict[Any, Any]]): http_method: ClassVar[str] = 'PATCH' - url: ClassVar[ - str - ] = 'https://edge.qiwi.com/funding-sources/v2/persons/{phone_number}/accounts/{account_alias}' + url: ClassVar[str] = ( + 'https://edge.qiwi.com/funding-sources/v2/persons/{phone_number}/accounts/{account_alias}' + ) account_alias: str = Field(..., path_runtime_value=True) diff --git a/glQiwiApi/qiwi/clients/wallet/types/partner.py b/glQiwiApi/qiwi/clients/wallet/types/partner.py index daf715fe..7afb923d 100644 --- a/glQiwiApi/qiwi/clients/wallet/types/partner.py +++ b/glQiwiApi/qiwi/clients/wallet/types/partner.py @@ -1,4 +1,5 @@ """Main model: Partner""" + from typing import List, Optional from glQiwiApi.types.base import Base diff --git a/glQiwiApi/types/amount.py b/glQiwiApi/types/amount.py index c73206e2..497f549a 100644 --- a/glQiwiApi/types/amount.py +++ b/glQiwiApi/types/amount.py @@ -39,8 +39,7 @@ def humanize_pay_currency(cls, v): # type: ignore return Currency.get(str(v)) -class HashableSum(HashableBase, AmountWithCurrency): - ... +class HashableSum(HashableBase, AmountWithCurrency): ... class PlainAmount(BaseModel): @@ -48,8 +47,7 @@ class PlainAmount(BaseModel): currency: str -class HashablePlainAmount(HashableBase, PlainAmount): - ... +class HashablePlainAmount(HashableBase, PlainAmount): ... class Type(BaseModel): diff --git a/glQiwiApi/types/arbitrary/inputs.py b/glQiwiApi/types/arbitrary/inputs.py index c4e56a61..b5d3913a 100644 --- a/glQiwiApi/types/arbitrary/inputs.py +++ b/glQiwiApi/types/arbitrary/inputs.py @@ -18,8 +18,7 @@ def __init__(self, input_: InputType) -> None: self._file_descriptor: Optional[BinaryIO] = None @abc.abstractmethod - def get_file(self) -> BinaryIO: - ... + def get_file(self) -> BinaryIO: ... def get_path(self) -> str: raise TypeError( diff --git a/glQiwiApi/utils/validators.py b/glQiwiApi/utils/validators.py index 2c72d41b..9f628482 100644 --- a/glQiwiApi/utils/validators.py +++ b/glQiwiApi/utils/validators.py @@ -111,13 +111,11 @@ def _validate(self, value: _FieldType) -> None: @overload -def String(optional: Literal[True], **options: Any) -> Field[Optional[str]]: - ... +def String(optional: Literal[True], **options: Any) -> Field[Optional[str]]: ... @overload -def String(optional: Literal[False], **options: Any) -> Field[str]: - ... +def String(optional: Literal[False], **options: Any) -> Field[str]: ... def String(optional: bool = False, **options: Any) -> Union[Field[Optional[str]], Field[str]]: @@ -129,13 +127,11 @@ def PhoneNumber(**options: Any) -> Field[Optional[str]]: @overload -def Integer(optional: Literal[True]) -> Field[Optional[int]]: - ... +def Integer(optional: Literal[True]) -> Field[Optional[int]]: ... @overload -def Integer(optional: Literal[False]) -> Field[int]: - ... +def Integer(optional: Literal[False]) -> Field[int]: ... def Integer(optional: bool = False) -> Union[Field[Optional[int]], Field[int]]: diff --git a/glQiwiApi/yoo_money/client.py b/glQiwiApi/yoo_money/client.py index 34cc1133..550224ee 100644 --- a/glQiwiApi/yoo_money/client.py +++ b/glQiwiApi/yoo_money/client.py @@ -2,6 +2,7 @@ Provides effortless work with YooMoney API using asynchronous requests. """ + from __future__ import annotations import asyncio