Skip to content

Commit

Permalink
(beta) mass-format with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
xavdid-stripe committed May 13, 2024
1 parent 4ebd153 commit 11c92dc
Show file tree
Hide file tree
Showing 147 changed files with 669 additions and 783 deletions.
8 changes: 2 additions & 6 deletions examples/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def callback():
<p>Success! Account <code>{stripe_user_id}</code> is connected.</p>
<p>Click <a href="/deauthorize?stripe_user_id={stripe_user_id}">here</a> to
disconnect the account.</p>
""".format(
stripe_user_id=resp["stripe_user_id"]
)
""".format(stripe_user_id=resp["stripe_user_id"])


@app.route("/deauthorize")
Expand All @@ -49,9 +47,7 @@ def deauthorize():
return """
<p>Success! Account <code>{stripe_user_id}</code> is disconnected.</p>
<p>Click <a href="/">here</a> to restart the OAuth flow.</p>
""".format(
stripe_user_id=stripe_user_id
)
""".format(stripe_user_id=stripe_user_id)


if __name__ == "__main__":
Expand Down
1 change: 0 additions & 1 deletion stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,5 +584,4 @@ def __getattr__(name):
from stripe._webhook_endpoint_service import (
WebhookEndpointService as WebhookEndpointService,
)

# The end of the section generated from our OpenAPI spec
42 changes: 20 additions & 22 deletions stripe/_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -4179,7 +4179,6 @@ def list(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand All @@ -4200,7 +4199,6 @@ async def list_async(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand Down Expand Up @@ -4497,7 +4495,7 @@ def retrieve_capability(
cls,
account: str,
capability: str,
**params: Unpack["Account.RetrieveCapabilityParams"]
**params: Unpack["Account.RetrieveCapabilityParams"],
) -> "Capability":
"""
Retrieves information about the specified Account Capability.
Expand All @@ -4519,7 +4517,7 @@ async def retrieve_capability_async(
cls,
account: str,
capability: str,
**params: Unpack["Account.RetrieveCapabilityParams"]
**params: Unpack["Account.RetrieveCapabilityParams"],
) -> "Capability":
"""
Retrieves information about the specified Account Capability.
Expand All @@ -4541,7 +4539,7 @@ def modify_capability(
cls,
account: str,
capability: str,
**params: Unpack["Account.ModifyCapabilityParams"]
**params: Unpack["Account.ModifyCapabilityParams"],
) -> "Capability":
"""
Updates an existing Account Capability. Request or remove a capability by updating its requested parameter.
Expand All @@ -4563,7 +4561,7 @@ async def modify_capability_async(
cls,
account: str,
capability: str,
**params: Unpack["Account.ModifyCapabilityParams"]
**params: Unpack["Account.ModifyCapabilityParams"],
) -> "Capability":
"""
Updates an existing Account Capability. Request or remove a capability by updating its requested parameter.
Expand Down Expand Up @@ -4620,7 +4618,7 @@ async def list_capabilities_async(
def create_external_account(
cls,
account: str,
**params: Unpack["Account.CreateExternalAccountParams"]
**params: Unpack["Account.CreateExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Create an external account for a given account.
Expand All @@ -4640,7 +4638,7 @@ def create_external_account(
async def create_external_account_async(
cls,
account: str,
**params: Unpack["Account.CreateExternalAccountParams"]
**params: Unpack["Account.CreateExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Create an external account for a given account.
Expand All @@ -4661,7 +4659,7 @@ def retrieve_external_account(
cls,
account: str,
id: str,
**params: Unpack["Account.RetrieveExternalAccountParams"]
**params: Unpack["Account.RetrieveExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Retrieve a specified external account for a given account.
Expand All @@ -4682,7 +4680,7 @@ async def retrieve_external_account_async(
cls,
account: str,
id: str,
**params: Unpack["Account.RetrieveExternalAccountParams"]
**params: Unpack["Account.RetrieveExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Retrieve a specified external account for a given account.
Expand All @@ -4703,7 +4701,7 @@ def modify_external_account(
cls,
account: str,
id: str,
**params: Unpack["Account.ModifyExternalAccountParams"]
**params: Unpack["Account.ModifyExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Updates the metadata, account holder name, account holder type of a bank account belonging to
Expand Down Expand Up @@ -4731,7 +4729,7 @@ async def modify_external_account_async(
cls,
account: str,
id: str,
**params: Unpack["Account.ModifyExternalAccountParams"]
**params: Unpack["Account.ModifyExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Updates the metadata, account holder name, account holder type of a bank account belonging to
Expand Down Expand Up @@ -4759,7 +4757,7 @@ def delete_external_account(
cls,
account: str,
id: str,
**params: Unpack["Account.DeleteExternalAccountParams"]
**params: Unpack["Account.DeleteExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Delete a specified external account for a given account.
Expand All @@ -4780,7 +4778,7 @@ async def delete_external_account_async(
cls,
account: str,
id: str,
**params: Unpack["Account.DeleteExternalAccountParams"]
**params: Unpack["Account.DeleteExternalAccountParams"],
) -> Union["BankAccount", "Card"]:
"""
Delete a specified external account for a given account.
Expand All @@ -4800,7 +4798,7 @@ async def delete_external_account_async(
def list_external_accounts(
cls,
account: str,
**params: Unpack["Account.ListExternalAccountsParams"]
**params: Unpack["Account.ListExternalAccountsParams"],
) -> ListObject[Union["BankAccount", "Card"]]:
"""
List external accounts for an account.
Expand All @@ -4820,7 +4818,7 @@ def list_external_accounts(
async def list_external_accounts_async(
cls,
account: str,
**params: Unpack["Account.ListExternalAccountsParams"]
**params: Unpack["Account.ListExternalAccountsParams"],
) -> ListObject[Union["BankAccount", "Card"]]:
"""
List external accounts for an account.
Expand Down Expand Up @@ -4917,7 +4915,7 @@ def retrieve_person(
cls,
account: str,
person: str,
**params: Unpack["Account.RetrievePersonParams"]
**params: Unpack["Account.RetrievePersonParams"],
) -> "Person":
"""
Retrieves an existing person.
Expand All @@ -4938,7 +4936,7 @@ async def retrieve_person_async(
cls,
account: str,
person: str,
**params: Unpack["Account.RetrievePersonParams"]
**params: Unpack["Account.RetrievePersonParams"],
) -> "Person":
"""
Retrieves an existing person.
Expand All @@ -4959,7 +4957,7 @@ def modify_person(
cls,
account: str,
person: str,
**params: Unpack["Account.ModifyPersonParams"]
**params: Unpack["Account.ModifyPersonParams"],
) -> "Person":
"""
Updates an existing person.
Expand All @@ -4980,7 +4978,7 @@ async def modify_person_async(
cls,
account: str,
person: str,
**params: Unpack["Account.ModifyPersonParams"]
**params: Unpack["Account.ModifyPersonParams"],
) -> "Person":
"""
Updates an existing person.
Expand All @@ -5001,7 +4999,7 @@ def delete_person(
cls,
account: str,
person: str,
**params: Unpack["Account.DeletePersonParams"]
**params: Unpack["Account.DeletePersonParams"],
) -> "Person":
"""
Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
Expand All @@ -5022,7 +5020,7 @@ async def delete_person_async(
cls,
account: str,
person: str,
**params: Unpack["Account.DeletePersonParams"]
**params: Unpack["Account.DeletePersonParams"],
) -> "Person":
"""
Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
Expand Down
2 changes: 0 additions & 2 deletions stripe/_account_notice.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def list(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand All @@ -196,7 +195,6 @@ async def list_async(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand Down
6 changes: 3 additions & 3 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,9 @@ def _args_for_request_with_retries(
generator = MultipartDataGenerator()
generator.add_params(params or {})
post_data = generator.get_post_data()
headers[
"Content-Type"
] = "multipart/form-data; boundary=%s" % (generator.boundary,)
headers["Content-Type"] = (
"multipart/form-data; boundary=%s" % (generator.boundary,)
)
else:
post_data = encoded_body
else:
Expand Down
2 changes: 0 additions & 2 deletions stripe/_apple_pay_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ def list(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand All @@ -238,7 +237,6 @@ async def list_async(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand Down
10 changes: 4 additions & 6 deletions stripe/_application_fee.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def list(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand All @@ -230,7 +229,6 @@ async def list_async(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand Down Expand Up @@ -483,7 +481,7 @@ def retrieve_refund(
cls,
fee: str,
id: str,
**params: Unpack["ApplicationFee.RetrieveRefundParams"]
**params: Unpack["ApplicationFee.RetrieveRefundParams"],
) -> "ApplicationFeeRefund":
"""
By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee.
Expand All @@ -504,7 +502,7 @@ async def retrieve_refund_async(
cls,
fee: str,
id: str,
**params: Unpack["ApplicationFee.RetrieveRefundParams"]
**params: Unpack["ApplicationFee.RetrieveRefundParams"],
) -> "ApplicationFeeRefund":
"""
By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee.
Expand All @@ -525,7 +523,7 @@ def modify_refund(
cls,
fee: str,
id: str,
**params: Unpack["ApplicationFee.ModifyRefundParams"]
**params: Unpack["ApplicationFee.ModifyRefundParams"],
) -> "ApplicationFeeRefund":
"""
Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
Expand All @@ -548,7 +546,7 @@ async def modify_refund_async(
cls,
fee: str,
id: str,
**params: Unpack["ApplicationFee.ModifyRefundParams"]
**params: Unpack["ApplicationFee.ModifyRefundParams"],
) -> "ApplicationFeeRefund":
"""
Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
Expand Down
8 changes: 3 additions & 5 deletions stripe/_balance_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class BalanceTransaction(ListableAPIResource["BalanceTransaction"]):
Related guide: [Balance transaction types](https://stripe.com/docs/reports/balance-transaction-types)
"""

OBJECT_NAME: ClassVar[
Literal["balance_transaction"]
] = "balance_transaction"
OBJECT_NAME: ClassVar[Literal["balance_transaction"]] = (
"balance_transaction"
)

class FeeDetail(StripeObject):
amount: int
Expand Down Expand Up @@ -271,7 +271,6 @@ def list(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand All @@ -294,7 +293,6 @@ async def list_async(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand Down
6 changes: 2 additions & 4 deletions stripe/_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -3906,7 +3906,6 @@ def list(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand All @@ -3927,7 +3926,6 @@ async def list_async(
params=params,
)
if not isinstance(result, ListObject):

raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
Expand Down Expand Up @@ -4052,7 +4050,7 @@ def retrieve_refund(
cls,
charge: str,
refund: str,
**params: Unpack["Charge.RetrieveRefundParams"]
**params: Unpack["Charge.RetrieveRefundParams"],
) -> "Refund":
"""
Retrieves the details of an existing refund.
Expand All @@ -4073,7 +4071,7 @@ async def retrieve_refund_async(
cls,
charge: str,
refund: str,
**params: Unpack["Charge.RetrieveRefundParams"]
**params: Unpack["Charge.RetrieveRefundParams"],
) -> "Refund":
"""
Retrieves the details of an existing refund.
Expand Down
6 changes: 3 additions & 3 deletions stripe/_connect_collection_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@


class ConnectCollectionTransfer(StripeObject):
OBJECT_NAME: ClassVar[
Literal["connect_collection_transfer"]
] = "connect_collection_transfer"
OBJECT_NAME: ClassVar[Literal["connect_collection_transfer"]] = (
"connect_collection_transfer"
)
amount: int
"""
Amount transferred, in cents (or local equivalent).
Expand Down
Loading

0 comments on commit 11c92dc

Please sign in to comment.