From 11c92dc754cf1e93ed1910624c182aa244d3981c Mon Sep 17 00:00:00 2001 From: David Brownman Date: Mon, 13 May 2024 09:53:47 -0600 Subject: [PATCH] (beta) mass-format with ruff --- examples/oauth.py | 8 +- stripe/__init__.py | 1 - stripe/_account.py | 42 ++++---- stripe/_account_notice.py | 2 - stripe/_api_requestor.py | 6 +- stripe/_apple_pay_domain.py | 2 - stripe/_application_fee.py | 10 +- stripe/_balance_transaction.py | 8 +- stripe/_charge.py | 6 +- stripe/_connect_collection_transfer.py | 6 +- stripe/_country_spec.py | 2 - stripe/_coupon.py | 2 - stripe/_credit_note.py | 2 - stripe/_credit_note_line_item.py | 6 +- stripe/_customer.py | 86 ++++++++------- stripe/_customer_balance_transaction.py | 6 +- stripe/_customer_cash_balance_transaction.py | 6 +- .../_customer_funding_instructions_service.py | 4 +- stripe/_dispute.py | 2 - stripe/_error_object.py | 2 +- stripe/_event.py | 2 - stripe/_exchange_rate.py | 2 - stripe/_file.py | 2 - stripe/_file_link.py | 2 - stripe/_funding_instructions.py | 6 +- stripe/_http_client.py | 52 ++++----- stripe/_invoice.py | 34 +++--- stripe/_invoice_item.py | 2 - stripe/_invoice_line_item_service.py | 4 +- stripe/_invoice_service.py | 12 ++- stripe/_list_object.py | 1 - stripe/_margin.py | 2 - stripe/_order.py | 2 - stripe/_payment_intent.py | 42 ++++---- stripe/_payment_intent_service.py | 8 +- stripe/_payment_link.py | 22 ++-- stripe/_payment_link_service.py | 8 +- stripe/_payment_method.py | 10 +- stripe/_payment_method_configuration.py | 16 ++- stripe/_payment_method_domain.py | 16 ++- stripe/_payout.py | 2 - stripe/_plan.py | 2 - stripe/_price.py | 2 - stripe/_product.py | 10 +- stripe/_promotion_code.py | 2 - stripe/_quote.py | 30 +++--- stripe/_quote_phase.py | 6 +- stripe/_quote_preview_invoice.py | 6 +- .../_quote_preview_subscription_schedule.py | 6 +- stripe/_quote_service.py | 8 +- stripe/_refund.py | 2 - stripe/_request_options.py | 2 +- stripe/_reserve_transaction.py | 6 +- stripe/_review.py | 2 - stripe/_setup_attempt.py | 2 - stripe/_setup_intent.py | 10 +- stripe/_setup_intent_service.py | 4 +- stripe/_shipping_rate.py | 2 - stripe/_source.py | 4 +- stripe/_source_mandate_notification.py | 6 +- stripe/_stripe_client.py | 1 - stripe/_stripe_object.py | 10 +- stripe/_subscription.py | 18 ++-- stripe/_subscription_item.py | 10 +- stripe/_subscription_schedule.py | 32 +++--- stripe/_subscription_schedule_service.py | 4 +- stripe/_subscription_service.py | 8 +- stripe/_tax_code.py | 2 - stripe/_tax_deducted_at_source.py | 6 +- stripe/_tax_id.py | 2 - stripe/_tax_rate.py | 2 - stripe/_topup.py | 2 - stripe/_transfer.py | 10 +- stripe/_usage_record_summary.py | 6 +- stripe/_util.py | 20 ++-- stripe/_verify_mixin.py | 6 +- stripe/_webhook_endpoint.py | 2 - stripe/app_info.py | 1 + stripe/apps/_secret.py | 2 - stripe/billing/_meter.py | 2 - stripe/billing/_meter_event.py | 6 +- stripe/billing/_meter_event_adjustment.py | 6 +- stripe/billing/_meter_event_summary.py | 6 +- stripe/billing_portal/_configuration.py | 8 +- stripe/billing_portal/_session.py | 6 +- stripe/capital/_financing_offer.py | 16 ++- stripe/capital/_financing_summary.py | 6 +- stripe/capital/_financing_transaction.py | 8 +- stripe/checkout/_session.py | 6 +- stripe/climate/_order.py | 2 - stripe/climate/_product.py | 2 - stripe/climate/_supplier.py | 2 - stripe/entitlements/_active_entitlement.py | 8 +- stripe/entitlements/_feature.py | 8 +- stripe/financial_connections/_account.py | 12 +-- .../financial_connections/_account_owner.py | 6 +- stripe/financial_connections/_session.py | 6 +- stripe/financial_connections/_transaction.py | 8 +- stripe/forwarding/_request.py | 2 - stripe/gift_cards/_card.py | 2 - stripe/gift_cards/_transaction.py | 8 +- stripe/identity/_verification_report.py | 8 +- stripe/identity/_verification_session.py | 8 +- stripe/issuing/_authorization.py | 36 +++---- stripe/issuing/_card.py | 2 - stripe/issuing/_cardholder.py | 2 - stripe/issuing/_credit_underwriting_record.py | 48 +++++---- .../_credit_underwriting_record_service.py | 4 +- stripe/issuing/_dispute.py | 2 - stripe/issuing/_personalization_design.py | 32 +++--- stripe/issuing/_physical_bundle.py | 8 +- stripe/issuing/_token.py | 2 - stripe/issuing/_transaction.py | 8 +- stripe/radar/_early_fraud_warning.py | 8 +- stripe/radar/_value_list.py | 2 - stripe/radar/_value_list_item.py | 8 +- stripe/reporting/_report_run.py | 8 +- stripe/reporting/_report_type.py | 8 +- stripe/sigma/_scheduled_query_run.py | 8 +- stripe/tax/_calculation.py | 4 +- stripe/tax/_calculation_line_item.py | 6 +- stripe/tax/_form.py | 2 - stripe/tax/_registration.py | 2 - stripe/tax/_transaction.py | 4 +- stripe/tax/_transaction_line_item.py | 6 +- stripe/terminal/_configuration.py | 8 +- stripe/terminal/_connection_token.py | 6 +- stripe/terminal/_location.py | 2 - stripe/terminal/_reader.py | 6 +- .../_confirmation_token_service.py | 4 +- stripe/test_helpers/_test_clock.py | 8 +- .../_personalization_design_service.py | 4 +- stripe/treasury/_credit_reversal.py | 8 +- stripe/treasury/_debit_reversal.py | 8 +- stripe/treasury/_financial_account.py | 24 ++--- .../treasury/_financial_account_features.py | 6 +- stripe/treasury/_inbound_transfer.py | 28 +++-- stripe/treasury/_outbound_payment.py | 24 ++--- stripe/treasury/_outbound_transfer.py | 56 +++++----- stripe/treasury/_received_credit.py | 8 +- stripe/treasury/_received_debit.py | 8 +- stripe/treasury/_transaction.py | 8 +- stripe/treasury/_transaction_entry.py | 8 +- tests/test_api_requestor.py | 2 +- tests/test_exports.py | 28 ++++- tests/test_generated_examples.py | 102 +++++++++--------- tests/test_http_client.py | 22 ++-- 147 files changed, 669 insertions(+), 783 deletions(-) diff --git a/examples/oauth.py b/examples/oauth.py index b7ffc3881..1d2ad31cc 100644 --- a/examples/oauth.py +++ b/examples/oauth.py @@ -33,9 +33,7 @@ def callback():

Success! Account {stripe_user_id} is connected.

Click here to disconnect the account.

-""".format( - stripe_user_id=resp["stripe_user_id"] - ) +""".format(stripe_user_id=resp["stripe_user_id"]) @app.route("/deauthorize") @@ -49,9 +47,7 @@ def deauthorize(): return """

Success! Account {stripe_user_id} is disconnected.

Click here to restart the OAuth flow.

-""".format( - stripe_user_id=stripe_user_id - ) +""".format(stripe_user_id=stripe_user_id) if __name__ == "__main__": diff --git a/stripe/__init__.py b/stripe/__init__.py index dbc830ef0..27a470b78 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -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 diff --git a/stripe/_account.py b/stripe/_account.py index 57e778931..b370c5746 100644 --- a/stripe/_account.py +++ b/stripe/_account.py @@ -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__) @@ -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__) @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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 @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/stripe/_account_notice.py b/stripe/_account_notice.py index af9551dbf..0436d1626 100644 --- a/stripe/_account_notice.py +++ b/stripe/_account_notice.py @@ -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__) @@ -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__) diff --git a/stripe/_api_requestor.py b/stripe/_api_requestor.py index 2ef72c77b..120256938 100644 --- a/stripe/_api_requestor.py +++ b/stripe/_api_requestor.py @@ -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: diff --git a/stripe/_apple_pay_domain.py b/stripe/_apple_pay_domain.py index 254841b3f..e88f6a708 100644 --- a/stripe/_apple_pay_domain.py +++ b/stripe/_apple_pay_domain.py @@ -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__) @@ -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__) diff --git a/stripe/_application_fee.py b/stripe/_application_fee.py index d0f617b5a..c6428ac9e 100644 --- a/stripe/_application_fee.py +++ b/stripe/_application_fee.py @@ -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__) @@ -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__) @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/stripe/_balance_transaction.py b/stripe/_balance_transaction.py index a08724cc5..16ade6d2c 100644 --- a/stripe/_balance_transaction.py +++ b/stripe/_balance_transaction.py @@ -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 @@ -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__) @@ -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__) diff --git a/stripe/_charge.py b/stripe/_charge.py index ae4d32702..a52a4ae82 100644 --- a/stripe/_charge.py +++ b/stripe/_charge.py @@ -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__) @@ -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__) @@ -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. @@ -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. diff --git a/stripe/_connect_collection_transfer.py b/stripe/_connect_collection_transfer.py index 258173535..397e20d15 100644 --- a/stripe/_connect_collection_transfer.py +++ b/stripe/_connect_collection_transfer.py @@ -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). diff --git a/stripe/_country_spec.py b/stripe/_country_spec.py index 15c4886ba..8304d3380 100644 --- a/stripe/_country_spec.py +++ b/stripe/_country_spec.py @@ -112,7 +112,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -133,7 +132,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_coupon.py b/stripe/_coupon.py index 3e8d9edc3..35af2b6fa 100644 --- a/stripe/_coupon.py +++ b/stripe/_coupon.py @@ -394,7 +394,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -415,7 +414,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_credit_note.py b/stripe/_credit_note.py index bf54f864e..a77300c9b 100644 --- a/stripe/_credit_note.py +++ b/stripe/_credit_note.py @@ -877,7 +877,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -898,7 +897,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_credit_note_line_item.py b/stripe/_credit_note_line_item.py index f358bc77a..40ebeb2df 100644 --- a/stripe/_credit_note_line_item.py +++ b/stripe/_credit_note_line_item.py @@ -15,9 +15,9 @@ class CreditNoteLineItem(StripeObject): The credit note line item object """ - OBJECT_NAME: ClassVar[ - Literal["credit_note_line_item"] - ] = "credit_note_line_item" + OBJECT_NAME: ClassVar[Literal["credit_note_line_item"]] = ( + "credit_note_line_item" + ) class DiscountAmount(StripeObject): amount: int diff --git a/stripe/_customer.py b/stripe/_customer.py index fffafa5b7..6c624efa6 100644 --- a/stripe/_customer.py +++ b/stripe/_customer.py @@ -1473,7 +1473,7 @@ async def create_async( def _cls_create_funding_instructions( cls, customer: str, - **params: Unpack["Customer.CreateFundingInstructionsParams"] + **params: Unpack["Customer.CreateFundingInstructionsParams"], ) -> "FundingInstructions": """ Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new @@ -1495,7 +1495,7 @@ def _cls_create_funding_instructions( @staticmethod def create_funding_instructions( customer: str, - **params: Unpack["Customer.CreateFundingInstructionsParams"] + **params: Unpack["Customer.CreateFundingInstructionsParams"], ) -> "FundingInstructions": """ Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new @@ -1539,7 +1539,7 @@ def create_funding_instructions( # pyright: ignore[reportGeneralTypeIssues] async def _cls_create_funding_instructions_async( cls, customer: str, - **params: Unpack["Customer.CreateFundingInstructionsParams"] + **params: Unpack["Customer.CreateFundingInstructionsParams"], ) -> "FundingInstructions": """ Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new @@ -1561,7 +1561,7 @@ async def _cls_create_funding_instructions_async( @staticmethod async def create_funding_instructions_async( customer: str, - **params: Unpack["Customer.CreateFundingInstructionsParams"] + **params: Unpack["Customer.CreateFundingInstructionsParams"], ) -> "FundingInstructions": """ Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new @@ -1820,7 +1820,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1841,7 +1840,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1853,7 +1851,7 @@ async def list_async( def _cls_list_payment_methods( cls, customer: str, - **params: Unpack["Customer.ListPaymentMethodsParams"] + **params: Unpack["Customer.ListPaymentMethodsParams"], ) -> ListObject["PaymentMethod"]: """ Returns a list of PaymentMethods for a given Customer @@ -1910,7 +1908,7 @@ def list_payment_methods( # pyright: ignore[reportGeneralTypeIssues] async def _cls_list_payment_methods_async( cls, customer: str, - **params: Unpack["Customer.ListPaymentMethodsParams"] + **params: Unpack["Customer.ListPaymentMethodsParams"], ) -> ListObject["PaymentMethod"]: """ Returns a list of PaymentMethods for a given Customer @@ -2028,7 +2026,7 @@ def _cls_retrieve_payment_method( cls, customer: str, payment_method: str, - **params: Unpack["Customer.RetrievePaymentMethodParams"] + **params: Unpack["Customer.RetrievePaymentMethodParams"], ) -> "PaymentMethod": """ Retrieves a PaymentMethod object for a given Customer. @@ -2050,7 +2048,7 @@ def _cls_retrieve_payment_method( def retrieve_payment_method( customer: str, payment_method: str, - **params: Unpack["Customer.RetrievePaymentMethodParams"] + **params: Unpack["Customer.RetrievePaymentMethodParams"], ) -> "PaymentMethod": """ Retrieves a PaymentMethod object for a given Customer. @@ -2061,7 +2059,7 @@ def retrieve_payment_method( def retrieve_payment_method( self, payment_method: str, - **params: Unpack["Customer.RetrievePaymentMethodParams"] + **params: Unpack["Customer.RetrievePaymentMethodParams"], ) -> "PaymentMethod": """ Retrieves a PaymentMethod object for a given Customer. @@ -2072,7 +2070,7 @@ def retrieve_payment_method( def retrieve_payment_method( # pyright: ignore[reportGeneralTypeIssues] self, payment_method: str, - **params: Unpack["Customer.RetrievePaymentMethodParams"] + **params: Unpack["Customer.RetrievePaymentMethodParams"], ) -> "PaymentMethod": """ Retrieves a PaymentMethod object for a given Customer. @@ -2094,7 +2092,7 @@ async def _cls_retrieve_payment_method_async( cls, customer: str, payment_method: str, - **params: Unpack["Customer.RetrievePaymentMethodParams"] + **params: Unpack["Customer.RetrievePaymentMethodParams"], ) -> "PaymentMethod": """ Retrieves a PaymentMethod object for a given Customer. @@ -2116,7 +2114,7 @@ async def _cls_retrieve_payment_method_async( async def retrieve_payment_method_async( customer: str, payment_method: str, - **params: Unpack["Customer.RetrievePaymentMethodParams"] + **params: Unpack["Customer.RetrievePaymentMethodParams"], ) -> "PaymentMethod": """ Retrieves a PaymentMethod object for a given Customer. @@ -2127,7 +2125,7 @@ async def retrieve_payment_method_async( async def retrieve_payment_method_async( self, payment_method: str, - **params: Unpack["Customer.RetrievePaymentMethodParams"] + **params: Unpack["Customer.RetrievePaymentMethodParams"], ) -> "PaymentMethod": """ Retrieves a PaymentMethod object for a given Customer. @@ -2138,7 +2136,7 @@ async def retrieve_payment_method_async( async def retrieve_payment_method_async( # pyright: ignore[reportGeneralTypeIssues] self, payment_method: str, - **params: Unpack["Customer.RetrievePaymentMethodParams"] + **params: Unpack["Customer.RetrievePaymentMethodParams"], ) -> "PaymentMethod": """ Retrieves a PaymentMethod object for a given Customer. @@ -2197,7 +2195,7 @@ async def search_auto_paging_iter_async( def create_balance_transaction( cls, customer: str, - **params: Unpack["Customer.CreateBalanceTransactionParams"] + **params: Unpack["Customer.CreateBalanceTransactionParams"], ) -> "CustomerBalanceTransaction": """ Creates an immutable transaction that updates the customer's credit [balance](https://stripe.com/docs/billing/customer/balance). @@ -2217,7 +2215,7 @@ def create_balance_transaction( async def create_balance_transaction_async( cls, customer: str, - **params: Unpack["Customer.CreateBalanceTransactionParams"] + **params: Unpack["Customer.CreateBalanceTransactionParams"], ) -> "CustomerBalanceTransaction": """ Creates an immutable transaction that updates the customer's credit [balance](https://stripe.com/docs/billing/customer/balance). @@ -2238,7 +2236,7 @@ def retrieve_balance_transaction( cls, customer: str, transaction: str, - **params: Unpack["Customer.RetrieveBalanceTransactionParams"] + **params: Unpack["Customer.RetrieveBalanceTransactionParams"], ) -> "CustomerBalanceTransaction": """ Retrieves a specific customer balance transaction that updated the customer's [balances](https://stripe.com/docs/billing/customer/balance). @@ -2260,7 +2258,7 @@ async def retrieve_balance_transaction_async( cls, customer: str, transaction: str, - **params: Unpack["Customer.RetrieveBalanceTransactionParams"] + **params: Unpack["Customer.RetrieveBalanceTransactionParams"], ) -> "CustomerBalanceTransaction": """ Retrieves a specific customer balance transaction that updated the customer's [balances](https://stripe.com/docs/billing/customer/balance). @@ -2282,7 +2280,7 @@ def modify_balance_transaction( cls, customer: str, transaction: str, - **params: Unpack["Customer.ModifyBalanceTransactionParams"] + **params: Unpack["Customer.ModifyBalanceTransactionParams"], ) -> "CustomerBalanceTransaction": """ Most credit balance transaction fields are immutable, but you may update its description and metadata. @@ -2304,7 +2302,7 @@ async def modify_balance_transaction_async( cls, customer: str, transaction: str, - **params: Unpack["Customer.ModifyBalanceTransactionParams"] + **params: Unpack["Customer.ModifyBalanceTransactionParams"], ) -> "CustomerBalanceTransaction": """ Most credit balance transaction fields are immutable, but you may update its description and metadata. @@ -2325,7 +2323,7 @@ async def modify_balance_transaction_async( def list_balance_transactions( cls, customer: str, - **params: Unpack["Customer.ListBalanceTransactionsParams"] + **params: Unpack["Customer.ListBalanceTransactionsParams"], ) -> ListObject["CustomerBalanceTransaction"]: """ Returns a list of transactions that updated the customer's [balances](https://stripe.com/docs/billing/customer/balance). @@ -2345,7 +2343,7 @@ def list_balance_transactions( async def list_balance_transactions_async( cls, customer: str, - **params: Unpack["Customer.ListBalanceTransactionsParams"] + **params: Unpack["Customer.ListBalanceTransactionsParams"], ) -> ListObject["CustomerBalanceTransaction"]: """ Returns a list of transactions that updated the customer's [balances](https://stripe.com/docs/billing/customer/balance). @@ -2366,7 +2364,7 @@ def retrieve_cash_balance_transaction( cls, customer: str, transaction: str, - **params: Unpack["Customer.RetrieveCashBalanceTransactionParams"] + **params: Unpack["Customer.RetrieveCashBalanceTransactionParams"], ) -> "CustomerCashBalanceTransaction": """ Retrieves a specific cash balance transaction, which updated the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). @@ -2388,7 +2386,7 @@ async def retrieve_cash_balance_transaction_async( cls, customer: str, transaction: str, - **params: Unpack["Customer.RetrieveCashBalanceTransactionParams"] + **params: Unpack["Customer.RetrieveCashBalanceTransactionParams"], ) -> "CustomerCashBalanceTransaction": """ Retrieves a specific cash balance transaction, which updated the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). @@ -2409,7 +2407,7 @@ async def retrieve_cash_balance_transaction_async( def list_cash_balance_transactions( cls, customer: str, - **params: Unpack["Customer.ListCashBalanceTransactionsParams"] + **params: Unpack["Customer.ListCashBalanceTransactionsParams"], ) -> ListObject["CustomerCashBalanceTransaction"]: """ Returns a list of transactions that modified the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). @@ -2429,7 +2427,7 @@ def list_cash_balance_transactions( async def list_cash_balance_transactions_async( cls, customer: str, - **params: Unpack["Customer.ListCashBalanceTransactionsParams"] + **params: Unpack["Customer.ListCashBalanceTransactionsParams"], ) -> ListObject["CustomerCashBalanceTransaction"]: """ Returns a list of transactions that modified the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). @@ -2494,7 +2492,7 @@ def retrieve_source( cls, customer: str, id: str, - **params: Unpack["Customer.RetrieveSourceParams"] + **params: Unpack["Customer.RetrieveSourceParams"], ) -> Union["Account", "BankAccount", "Card", "Source"]: """ Retrieve a specified source for a given customer. @@ -2515,7 +2513,7 @@ async def retrieve_source_async( cls, customer: str, id: str, - **params: Unpack["Customer.RetrieveSourceParams"] + **params: Unpack["Customer.RetrieveSourceParams"], ) -> Union["Account", "BankAccount", "Card", "Source"]: """ Retrieve a specified source for a given customer. @@ -2536,7 +2534,7 @@ def modify_source( cls, customer: str, id: str, - **params: Unpack["Customer.ModifySourceParams"] + **params: Unpack["Customer.ModifySourceParams"], ) -> Union["Account", "BankAccount", "Card", "Source"]: """ Update a specified source for a given customer. @@ -2557,7 +2555,7 @@ async def modify_source_async( cls, customer: str, id: str, - **params: Unpack["Customer.ModifySourceParams"] + **params: Unpack["Customer.ModifySourceParams"], ) -> Union["Account", "BankAccount", "Card", "Source"]: """ Update a specified source for a given customer. @@ -2578,7 +2576,7 @@ def delete_source( cls, customer: str, id: str, - **params: Unpack["Customer.DeleteSourceParams"] + **params: Unpack["Customer.DeleteSourceParams"], ) -> Union["Account", "BankAccount", "Card", "Source"]: """ Delete a specified source for a given customer. @@ -2599,7 +2597,7 @@ async def delete_source_async( cls, customer: str, id: str, - **params: Unpack["Customer.DeleteSourceParams"] + **params: Unpack["Customer.DeleteSourceParams"], ) -> Union["Account", "BankAccount", "Card", "Source"]: """ Delete a specified source for a given customer. @@ -2692,7 +2690,7 @@ def retrieve_tax_id( cls, customer: str, id: str, - **params: Unpack["Customer.RetrieveTaxIdParams"] + **params: Unpack["Customer.RetrieveTaxIdParams"], ) -> "TaxId": """ Retrieves the tax_id object with the given identifier. @@ -2713,7 +2711,7 @@ async def retrieve_tax_id_async( cls, customer: str, id: str, - **params: Unpack["Customer.RetrieveTaxIdParams"] + **params: Unpack["Customer.RetrieveTaxIdParams"], ) -> "TaxId": """ Retrieves the tax_id object with the given identifier. @@ -2734,7 +2732,7 @@ def delete_tax_id( cls, customer: str, id: str, - **params: Unpack["Customer.DeleteTaxIdParams"] + **params: Unpack["Customer.DeleteTaxIdParams"], ) -> "TaxId": """ Deletes an existing tax_id object. @@ -2755,7 +2753,7 @@ async def delete_tax_id_async( cls, customer: str, id: str, - **params: Unpack["Customer.DeleteTaxIdParams"] + **params: Unpack["Customer.DeleteTaxIdParams"], ) -> "TaxId": """ Deletes an existing tax_id object. @@ -2811,7 +2809,7 @@ async def list_tax_ids_async( def retrieve_cash_balance( cls, customer: str, - **params: Unpack["Customer.RetrieveCashBalanceParams"] + **params: Unpack["Customer.RetrieveCashBalanceParams"], ) -> "CashBalance": """ Retrieves a customer's cash balance. @@ -2831,7 +2829,7 @@ def retrieve_cash_balance( async def retrieve_cash_balance_async( cls, customer: str, - **params: Unpack["Customer.RetrieveCashBalanceParams"] + **params: Unpack["Customer.RetrieveCashBalanceParams"], ) -> "CashBalance": """ Retrieves a customer's cash balance. @@ -2851,7 +2849,7 @@ async def retrieve_cash_balance_async( def modify_cash_balance( cls, customer: str, - **params: Unpack["Customer.ModifyCashBalanceParams"] + **params: Unpack["Customer.ModifyCashBalanceParams"], ) -> "CashBalance": """ Changes the settings on a customer's cash balance. @@ -2871,7 +2869,7 @@ def modify_cash_balance( async def modify_cash_balance_async( cls, customer: str, - **params: Unpack["Customer.ModifyCashBalanceParams"] + **params: Unpack["Customer.ModifyCashBalanceParams"], ) -> "CashBalance": """ Changes the settings on a customer's cash balance. @@ -2894,7 +2892,7 @@ class TestHelpers(APIResourceTestHelpers["Customer"]): def _cls_fund_cash_balance( cls, customer: str, - **params: Unpack["Customer.FundCashBalanceParams"] + **params: Unpack["Customer.FundCashBalanceParams"], ) -> "CustomerCashBalanceTransaction": """ Create an incoming testmode bank transfer @@ -2951,7 +2949,7 @@ def fund_cash_balance( # pyright: ignore[reportGeneralTypeIssues] async def _cls_fund_cash_balance_async( cls, customer: str, - **params: Unpack["Customer.FundCashBalanceParams"] + **params: Unpack["Customer.FundCashBalanceParams"], ) -> "CustomerCashBalanceTransaction": """ Create an incoming testmode bank transfer diff --git a/stripe/_customer_balance_transaction.py b/stripe/_customer_balance_transaction.py index fd342c70f..2befceca3 100644 --- a/stripe/_customer_balance_transaction.py +++ b/stripe/_customer_balance_transaction.py @@ -22,9 +22,9 @@ class CustomerBalanceTransaction(APIResource["CustomerBalanceTransaction"]): Related guide: [Customer balance](https://stripe.com/docs/billing/customer/balance) """ - OBJECT_NAME: ClassVar[ - Literal["customer_balance_transaction"] - ] = "customer_balance_transaction" + OBJECT_NAME: ClassVar[Literal["customer_balance_transaction"]] = ( + "customer_balance_transaction" + ) amount: int """ The amount of the transaction. A negative value is a credit for the customer's balance, and a positive value is a debit to the customer's `balance`. diff --git a/stripe/_customer_cash_balance_transaction.py b/stripe/_customer_cash_balance_transaction.py index 0983295d1..64db2470e 100644 --- a/stripe/_customer_cash_balance_transaction.py +++ b/stripe/_customer_cash_balance_transaction.py @@ -20,9 +20,9 @@ class CustomerCashBalanceTransaction(StripeObject): to payments, and refunds to the customer. """ - OBJECT_NAME: ClassVar[ - Literal["customer_cash_balance_transaction"] - ] = "customer_cash_balance_transaction" + OBJECT_NAME: ClassVar[Literal["customer_cash_balance_transaction"]] = ( + "customer_cash_balance_transaction" + ) class AdjustedForOverdraft(StripeObject): balance_transaction: ExpandableField["BalanceTransaction"] diff --git a/stripe/_customer_funding_instructions_service.py b/stripe/_customer_funding_instructions_service.py index b397991a2..0b287c8e4 100644 --- a/stripe/_customer_funding_instructions_service.py +++ b/stripe/_customer_funding_instructions_service.py @@ -10,7 +10,9 @@ class CustomerFundingInstructionsService(StripeService): class CreateParams(TypedDict): - bank_transfer: "CustomerFundingInstructionsService.CreateParamsBankTransfer" + bank_transfer: ( + "CustomerFundingInstructionsService.CreateParamsBankTransfer" + ) """ Additional parameters for `bank_transfer` funding types """ diff --git a/stripe/_dispute.py b/stripe/_dispute.py index 23745c487..8ca3084eb 100644 --- a/stripe/_dispute.py +++ b/stripe/_dispute.py @@ -943,7 +943,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -964,7 +963,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_error_object.py b/stripe/_error_object.py index f3556b019..da2f38918 100644 --- a/stripe/_error_object.py +++ b/stripe/_error_object.py @@ -56,7 +56,7 @@ def _refresh_from( partial=False, last_response=None, requestor, - api_mode: ApiMode + api_mode: ApiMode, ) -> None: # Unlike most other API resources, the API will omit attributes in # error objects when they have a null value. We manually set default diff --git a/stripe/_event.py b/stripe/_event.py index 57e1433d7..ff8890e84 100644 --- a/stripe/_event.py +++ b/stripe/_event.py @@ -479,7 +479,6 @@ def list(cls, **params: Unpack["Event.ListParams"]) -> ListObject["Event"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -500,7 +499,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_exchange_rate.py b/stripe/_exchange_rate.py index 443400403..535678a93 100644 --- a/stripe/_exchange_rate.py +++ b/stripe/_exchange_rate.py @@ -89,7 +89,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -110,7 +109,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_file.py b/stripe/_file.py index c83b91752..72e4c82e7 100644 --- a/stripe/_file.py +++ b/stripe/_file.py @@ -251,7 +251,6 @@ def list(cls, **params: Unpack["File.ListParams"]) -> ListObject["File"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -272,7 +271,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_file_link.py b/stripe/_file_link.py index e03684b86..ff62720d5 100644 --- a/stripe/_file_link.py +++ b/stripe/_file_link.py @@ -199,7 +199,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -220,7 +219,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_funding_instructions.py b/stripe/_funding_instructions.py index 658638ff3..ccab42862 100644 --- a/stripe/_funding_instructions.py +++ b/stripe/_funding_instructions.py @@ -14,9 +14,9 @@ class FundingInstructions(StripeObject): Related guide: [Customer balance funding instructions](https://stripe.com/docs/payments/customer-balance/funding-instructions) """ - OBJECT_NAME: ClassVar[ - Literal["funding_instructions"] - ] = "funding_instructions" + OBJECT_NAME: ClassVar[Literal["funding_instructions"]] = ( + "funding_instructions" + ) class BankTransfer(StripeObject): class FinancialAddress(StripeObject): diff --git a/stripe/_http_client.py b/stripe/_http_client.py index f7969a5b5..a936dd654 100644 --- a/stripe/_http_client.py +++ b/stripe/_http_client.py @@ -162,9 +162,7 @@ def __init__( if proxy: if isinstance(proxy, str): proxy = {"http": proxy, "https": proxy} - if not isinstance( - proxy, dict - ): # pyright: ignore[reportUnnecessaryIsInstance] + if not isinstance(proxy, dict): # pyright: ignore[reportUnnecessaryIsInstance] raise ValueError( "Proxy(ies) must be specified as either a string " "URL or a dict() with string URL under the" @@ -399,7 +397,7 @@ def request( headers: Optional[Mapping[str, str]], post_data: Any = None, *, - _usage: Optional[List[str]] = None + _usage: Optional[List[str]] = None, ) -> Tuple[str, int, Mapping[str, str]]: raise NotImplementedError( "HTTPClient subclasses must implement `request`" @@ -412,7 +410,7 @@ def request_stream( headers: Optional[Mapping[str, str]], post_data: Any = None, *, - _usage: Optional[List[str]] = None + _usage: Optional[List[str]] = None, ) -> Tuple[Any, int, Mapping[str, str]]: raise NotImplementedError( "HTTPClient subclasses must implement `request_stream`" @@ -431,7 +429,7 @@ async def request_with_retries_async( post_data=None, max_network_retries: Optional[int] = None, *, - _usage: Optional[List[str]] = None + _usage: Optional[List[str]] = None, ) -> Tuple[Any, int, Any]: return await self._request_with_retries_internal_async( method, @@ -451,7 +449,7 @@ async def request_stream_with_retries_async( post_data=None, max_network_retries=None, *, - _usage: Optional[List[str]] = None + _usage: Optional[List[str]] = None, ) -> Tuple[AsyncIterable[bytes], int, Any]: return await self._request_with_retries_internal_async( method, @@ -473,9 +471,8 @@ async def _request_with_retries_internal_async( is_streaming: Literal[False], max_network_retries: Optional[int], *, - _usage: Optional[List[str]] = None - ) -> Tuple[Any, int, Mapping[str, str]]: - ... + _usage: Optional[List[str]] = None, + ) -> Tuple[Any, int, Mapping[str, str]]: ... @overload async def _request_with_retries_internal_async( @@ -487,9 +484,8 @@ async def _request_with_retries_internal_async( is_streaming: Literal[True], max_network_retries: Optional[int], *, - _usage: Optional[List[str]] = None - ) -> Tuple[AsyncIterable[bytes], int, Mapping[str, str]]: - ... + _usage: Optional[List[str]] = None, + ) -> Tuple[AsyncIterable[bytes], int, Mapping[str, str]]: ... async def _request_with_retries_internal_async( self, @@ -500,7 +496,7 @@ async def _request_with_retries_internal_async( is_streaming: bool, max_network_retries: Optional[int], *, - _usage: Optional[List[str]] = None + _usage: Optional[List[str]] = None, ) -> Tuple[Any, int, Mapping[str, str]]: headers = self._add_telemetry_header(headers) @@ -599,7 +595,7 @@ def __init__( verify_ssl_certs: bool = True, proxy: Optional[Union[str, HTTPClient._Proxy]] = None, async_fallback_client: Optional[HTTPClient] = None, - **kwargs + **kwargs, ): super(RequestsClient, self).__init__( verify_ssl_certs=verify_ssl_certs, @@ -642,8 +638,7 @@ def _request_internal( headers: Optional[Mapping[str, str]], post_data, is_streaming: Literal[True], - ) -> Tuple[Any, int, Mapping[str, str]]: - ... + ) -> Tuple[Any, int, Mapping[str, str]]: ... @overload def _request_internal( @@ -653,8 +648,7 @@ def _request_internal( headers: Optional[Mapping[str, str]], post_data, is_streaming: Literal[False], - ) -> Tuple[bytes, int, Mapping[str, str]]: - ... + ) -> Tuple[bytes, int, Mapping[str, str]]: ... def _request_internal( self, @@ -832,8 +826,7 @@ def _request_internal( headers: Mapping[str, str], post_data, is_streaming: Literal[True], - ) -> Tuple[BytesIO, int, Any]: - ... + ) -> Tuple[BytesIO, int, Any]: ... @overload def _request_internal( @@ -843,8 +836,7 @@ def _request_internal( headers: Mapping[str, str], post_data, is_streaming: Literal[False], - ) -> Tuple[str, int, Any]: - ... + ) -> Tuple[str, int, Any]: ... def _request_internal( self, @@ -970,8 +962,7 @@ def _request_internal( headers: Mapping[str, str], post_data, is_streaming: Literal[True], - ) -> Tuple[BytesIO, int, Any]: - ... + ) -> Tuple[BytesIO, int, Any]: ... @overload def _request_internal( @@ -981,8 +972,7 @@ def _request_internal( headers: Mapping[str, str], post_data, is_streaming: Literal[False], - ) -> Tuple[str, int, Mapping[str, str]]: - ... + ) -> Tuple[str, int, Mapping[str, str]]: ... def _request_internal( self, @@ -1149,8 +1139,7 @@ def _request_internal( headers: Mapping[str, str], post_data, is_streaming: Literal[False], - ) -> Tuple[str, int, Any]: - ... + ) -> Tuple[str, int, Any]: ... @overload def _request_internal( @@ -1160,8 +1149,7 @@ def _request_internal( headers: Mapping[str, str], post_data, is_streaming: Literal[True], - ) -> Tuple[HTTPResponse, int, Any]: - ... + ) -> Tuple[HTTPResponse, int, Any]: ... def _request_internal( self, @@ -1227,7 +1215,7 @@ def __init__( self, timeout: Optional[Union[float, "HTTPXTimeout"]] = 80, allow_sync_methods=False, - **kwargs + **kwargs, ): super(HTTPXClient, self).__init__(**kwargs) diff --git a/stripe/_invoice.py b/stripe/_invoice.py index 0708b13ce..a9e5cedb8 100644 --- a/stripe/_invoice.py +++ b/stripe/_invoice.py @@ -2520,7 +2520,9 @@ class CreatePreviewParamsScheduleDetailsAmendment(TypedDict): """ Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment. """ - amendment_start: "Invoice.CreatePreviewParamsScheduleDetailsAmendmentAmendmentStart" + amendment_start: ( + "Invoice.CreatePreviewParamsScheduleDetailsAmendmentAmendmentStart" + ) """ Details to identify the earliest timestamp where the proposed change should take effect. """ @@ -5295,7 +5297,9 @@ class UpcomingLinesParamsScheduleDetailsAmendment(TypedDict): """ Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment. """ - amendment_start: "Invoice.UpcomingLinesParamsScheduleDetailsAmendmentAmendmentStart" + amendment_start: ( + "Invoice.UpcomingLinesParamsScheduleDetailsAmendmentAmendmentStart" + ) """ Details to identify the earliest timestamp where the proposed change should take effect. """ @@ -6734,7 +6738,9 @@ class UpcomingLinesParamsSubscriptionItemPriceData(TypedDict): """ The ID of the product that this price will belong to. """ - recurring: "Invoice.UpcomingLinesParamsSubscriptionItemPriceDataRecurring" + recurring: ( + "Invoice.UpcomingLinesParamsSubscriptionItemPriceDataRecurring" + ) """ The recurring components of a price such as `interval` and `interval_count`. """ @@ -7344,7 +7350,9 @@ class UpcomingParamsScheduleDetailsAmendment(TypedDict): """ Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment. """ - amendment_start: "Invoice.UpcomingParamsScheduleDetailsAmendmentAmendmentStart" + amendment_start: ( + "Invoice.UpcomingParamsScheduleDetailsAmendmentAmendmentStart" + ) """ Details to identify the earliest timestamp where the proposed change should take effect. """ @@ -8299,7 +8307,9 @@ class UpcomingParamsScheduleDetailsPhaseItemPriceData(TypedDict): """ The ID of the product that this price will belong to. """ - recurring: "Invoice.UpcomingParamsScheduleDetailsPhaseItemPriceDataRecurring" + recurring: ( + "Invoice.UpcomingParamsScheduleDetailsPhaseItemPriceDataRecurring" + ) """ The recurring components of a price such as `interval` and `interval_count`. """ @@ -8593,7 +8603,9 @@ class UpcomingParamsSubscriptionDetailsItemPriceData(TypedDict): """ The ID of the product that this price will belong to. """ - recurring: "Invoice.UpcomingParamsSubscriptionDetailsItemPriceDataRecurring" + recurring: ( + "Invoice.UpcomingParamsSubscriptionDetailsItemPriceDataRecurring" + ) """ The recurring components of a price such as `interval` and `interval_count`. """ @@ -9499,7 +9511,7 @@ async def add_lines_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_attach_payment_intent( cls, invoice: str, - **params: Unpack["Invoice.AttachPaymentIntentParams"] + **params: Unpack["Invoice.AttachPaymentIntentParams"], ) -> "Invoice": """ Attaches a PaymentIntent to the invoice, adding it to the list of payments. @@ -9588,7 +9600,7 @@ def attach_payment_intent( # pyright: ignore[reportGeneralTypeIssues] async def _cls_attach_payment_intent_async( cls, invoice: str, - **params: Unpack["Invoice.AttachPaymentIntentParams"] + **params: Unpack["Invoice.AttachPaymentIntentParams"], ) -> "Invoice": """ Attaches a PaymentIntent to the invoice, adding it to the list of payments. @@ -9966,7 +9978,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -9987,7 +9998,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -10902,7 +10912,7 @@ def retrieve_payment( cls, invoice: str, invoice_payment: str, - **params: Unpack["Invoice.RetrievePaymentParams"] + **params: Unpack["Invoice.RetrievePaymentParams"], ) -> "InvoicePayment": """ Retrieves the invoice payment with the given ID. @@ -10924,7 +10934,7 @@ async def retrieve_payment_async( cls, invoice: str, invoice_payment: str, - **params: Unpack["Invoice.RetrievePaymentParams"] + **params: Unpack["Invoice.RetrievePaymentParams"], ) -> "InvoicePayment": """ Retrieves the invoice payment with the given ID. diff --git a/stripe/_invoice_item.py b/stripe/_invoice_item.py index a100a0512..747dcd5a1 100644 --- a/stripe/_invoice_item.py +++ b/stripe/_invoice_item.py @@ -680,7 +680,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -701,7 +700,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_invoice_line_item_service.py b/stripe/_invoice_line_item_service.py index a12b08c24..6763171bc 100644 --- a/stripe/_invoice_line_item_service.py +++ b/stripe/_invoice_line_item_service.py @@ -199,7 +199,9 @@ class UpdateParamsTaxAmount(TypedDict): """ The amount, in cents (or local equivalent), of the tax. """ - tax_rate_data: "InvoiceLineItemService.UpdateParamsTaxAmountTaxRateData" + tax_rate_data: ( + "InvoiceLineItemService.UpdateParamsTaxAmountTaxRateData" + ) """ Data to find or create a TaxRate object. diff --git a/stripe/_invoice_service.py b/stripe/_invoice_service.py index 25f272527..b27a5e6f4 100644 --- a/stripe/_invoice_service.py +++ b/stripe/_invoice_service.py @@ -1110,7 +1110,9 @@ class CreatePreviewParamsCustomerDetailsAddress(TypedDict): """ class CreatePreviewParamsCustomerDetailsShipping(TypedDict): - address: "InvoiceService.CreatePreviewParamsCustomerDetailsShippingAddress" + address: ( + "InvoiceService.CreatePreviewParamsCustomerDetailsShippingAddress" + ) """ Customer shipping address. """ @@ -4990,7 +4992,9 @@ class UpcomingParamsSubscriptionItemPriceData(TypedDict): """ The ID of the product that this price will belong to. """ - recurring: "InvoiceService.UpcomingParamsSubscriptionItemPriceDataRecurring" + recurring: ( + "InvoiceService.UpcomingParamsSubscriptionItemPriceDataRecurring" + ) """ The recurring components of a price such as `interval` and `interval_count`. """ @@ -5212,7 +5216,9 @@ class UpdateLinesParamsLineTaxAmount(TypedDict): """ The amount, in cents (or local equivalent), of the tax. """ - tax_rate_data: "InvoiceService.UpdateLinesParamsLineTaxAmountTaxRateData" + tax_rate_data: ( + "InvoiceService.UpdateLinesParamsLineTaxAmountTaxRateData" + ) """ Data to find or create a TaxRate object. diff --git a/stripe/_list_object.py b/stripe/_list_object.py index 2e2d03ff1..bb007269f 100644 --- a/stripe/_list_object.py +++ b/stripe/_list_object.py @@ -190,7 +190,6 @@ def is_empty(self) -> bool: def _get_filters_for_next_page( self, params: RequestOptions ) -> Mapping[str, Any]: - last_id = getattr(self.data[-1], "id") if not last_id: raise ValueError( diff --git a/stripe/_margin.py b/stripe/_margin.py index 085047872..836f72e04 100644 --- a/stripe/_margin.py +++ b/stripe/_margin.py @@ -170,7 +170,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -191,7 +190,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_order.py b/stripe/_order.py index 98ac00a8b..0b72f7d5c 100644 --- a/stripe/_order.py +++ b/stripe/_order.py @@ -3531,7 +3531,6 @@ def list(cls, **params: Unpack["Order.ListParams"]) -> ListObject["Order"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -3552,7 +3551,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_payment_intent.py b/stripe/_payment_intent.py index f0ae4ea7f..a82e82097 100644 --- a/stripe/_payment_intent.py +++ b/stripe/_payment_intent.py @@ -6310,7 +6310,9 @@ class CreateParamsAutomaticPaymentMethods(TypedDict): """ class CreateParamsMandateData(TypedDict): - customer_acceptance: "PaymentIntent.CreateParamsMandateDataCustomerAcceptance" + customer_acceptance: ( + "PaymentIntent.CreateParamsMandateDataCustomerAcceptance" + ) """ This hash contains details about the customer acceptance of the Mandate. """ @@ -9482,7 +9484,9 @@ class ModifyParams(RequestOptions): """ class ModifyParamsMandateData(TypedDict): - customer_acceptance: "PaymentIntent.ModifyParamsMandateDataCustomerAcceptance" + customer_acceptance: ( + "PaymentIntent.ModifyParamsMandateDataCustomerAcceptance" + ) """ This hash contains details about the customer acceptance of the Mandate. """ @@ -12634,7 +12638,7 @@ class VerifyMicrodepositsParams(RequestOptions): def _cls_apply_customer_balance( cls, intent: str, - **params: Unpack["PaymentIntent.ApplyCustomerBalanceParams"] + **params: Unpack["PaymentIntent.ApplyCustomerBalanceParams"], ) -> "PaymentIntent": """ Manually reconcile the remaining amount for a customer_balance PaymentIntent. @@ -12654,7 +12658,7 @@ def _cls_apply_customer_balance( @staticmethod def apply_customer_balance( intent: str, - **params: Unpack["PaymentIntent.ApplyCustomerBalanceParams"] + **params: Unpack["PaymentIntent.ApplyCustomerBalanceParams"], ) -> "PaymentIntent": """ Manually reconcile the remaining amount for a customer_balance PaymentIntent. @@ -12692,7 +12696,7 @@ def apply_customer_balance( # pyright: ignore[reportGeneralTypeIssues] async def _cls_apply_customer_balance_async( cls, intent: str, - **params: Unpack["PaymentIntent.ApplyCustomerBalanceParams"] + **params: Unpack["PaymentIntent.ApplyCustomerBalanceParams"], ) -> "PaymentIntent": """ Manually reconcile the remaining amount for a customer_balance PaymentIntent. @@ -12712,7 +12716,7 @@ async def _cls_apply_customer_balance_async( @staticmethod async def apply_customer_balance_async( intent: str, - **params: Unpack["PaymentIntent.ApplyCustomerBalanceParams"] + **params: Unpack["PaymentIntent.ApplyCustomerBalanceParams"], ) -> "PaymentIntent": """ Manually reconcile the remaining amount for a customer_balance PaymentIntent. @@ -13362,7 +13366,7 @@ async def create_async( def _cls_decrement_authorization( cls, intent: str, - **params: Unpack["PaymentIntent.DecrementAuthorizationParams"] + **params: Unpack["PaymentIntent.DecrementAuthorizationParams"], ) -> "PaymentIntent": """ Perform a decremental authorization on an eligible @@ -13397,7 +13401,7 @@ def _cls_decrement_authorization( @staticmethod def decrement_authorization( intent: str, - **params: Unpack["PaymentIntent.DecrementAuthorizationParams"] + **params: Unpack["PaymentIntent.DecrementAuthorizationParams"], ) -> "PaymentIntent": """ Perform a decremental authorization on an eligible @@ -13480,7 +13484,7 @@ def decrement_authorization( # pyright: ignore[reportGeneralTypeIssues] async def _cls_decrement_authorization_async( cls, intent: str, - **params: Unpack["PaymentIntent.DecrementAuthorizationParams"] + **params: Unpack["PaymentIntent.DecrementAuthorizationParams"], ) -> "PaymentIntent": """ Perform a decremental authorization on an eligible @@ -13515,7 +13519,7 @@ async def _cls_decrement_authorization_async( @staticmethod async def decrement_authorization_async( intent: str, - **params: Unpack["PaymentIntent.DecrementAuthorizationParams"] + **params: Unpack["PaymentIntent.DecrementAuthorizationParams"], ) -> "PaymentIntent": """ Perform a decremental authorization on an eligible @@ -13598,7 +13602,7 @@ async def decrement_authorization_async( # pyright: ignore[reportGeneralTypeIss def _cls_increment_authorization( cls, intent: str, - **params: Unpack["PaymentIntent.IncrementAuthorizationParams"] + **params: Unpack["PaymentIntent.IncrementAuthorizationParams"], ) -> "PaymentIntent": """ Perform an incremental authorization on an eligible @@ -13641,7 +13645,7 @@ def _cls_increment_authorization( @staticmethod def increment_authorization( intent: str, - **params: Unpack["PaymentIntent.IncrementAuthorizationParams"] + **params: Unpack["PaymentIntent.IncrementAuthorizationParams"], ) -> "PaymentIntent": """ Perform an incremental authorization on an eligible @@ -13748,7 +13752,7 @@ def increment_authorization( # pyright: ignore[reportGeneralTypeIssues] async def _cls_increment_authorization_async( cls, intent: str, - **params: Unpack["PaymentIntent.IncrementAuthorizationParams"] + **params: Unpack["PaymentIntent.IncrementAuthorizationParams"], ) -> "PaymentIntent": """ Perform an incremental authorization on an eligible @@ -13791,7 +13795,7 @@ async def _cls_increment_authorization_async( @staticmethod async def increment_authorization_async( intent: str, - **params: Unpack["PaymentIntent.IncrementAuthorizationParams"] + **params: Unpack["PaymentIntent.IncrementAuthorizationParams"], ) -> "PaymentIntent": """ Perform an incremental authorization on an eligible @@ -13907,7 +13911,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -13928,7 +13931,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -14016,7 +14018,7 @@ async def retrieve_async( def _cls_verify_microdeposits( cls, intent: str, - **params: Unpack["PaymentIntent.VerifyMicrodepositsParams"] + **params: Unpack["PaymentIntent.VerifyMicrodepositsParams"], ) -> "PaymentIntent": """ Verifies microdeposits on a PaymentIntent object. @@ -14036,7 +14038,7 @@ def _cls_verify_microdeposits( @staticmethod def verify_microdeposits( intent: str, - **params: Unpack["PaymentIntent.VerifyMicrodepositsParams"] + **params: Unpack["PaymentIntent.VerifyMicrodepositsParams"], ) -> "PaymentIntent": """ Verifies microdeposits on a PaymentIntent object. @@ -14074,7 +14076,7 @@ def verify_microdeposits( # pyright: ignore[reportGeneralTypeIssues] async def _cls_verify_microdeposits_async( cls, intent: str, - **params: Unpack["PaymentIntent.VerifyMicrodepositsParams"] + **params: Unpack["PaymentIntent.VerifyMicrodepositsParams"], ) -> "PaymentIntent": """ Verifies microdeposits on a PaymentIntent object. @@ -14094,7 +14096,7 @@ async def _cls_verify_microdeposits_async( @staticmethod async def verify_microdeposits_async( intent: str, - **params: Unpack["PaymentIntent.VerifyMicrodepositsParams"] + **params: Unpack["PaymentIntent.VerifyMicrodepositsParams"], ) -> "PaymentIntent": """ Verifies microdeposits on a PaymentIntent object. diff --git a/stripe/_payment_intent_service.py b/stripe/_payment_intent_service.py index 6f6181e2b..a9c30c750 100644 --- a/stripe/_payment_intent_service.py +++ b/stripe/_payment_intent_service.py @@ -4003,7 +4003,9 @@ class CreateParamsAutomaticPaymentMethods(TypedDict): """ class CreateParamsMandateData(TypedDict): - customer_acceptance: "PaymentIntentService.CreateParamsMandateDataCustomerAcceptance" + customer_acceptance: ( + "PaymentIntentService.CreateParamsMandateDataCustomerAcceptance" + ) """ This hash contains details about the customer acceptance of the Mandate. """ @@ -7245,7 +7247,9 @@ class UpdateParams(TypedDict): """ class UpdateParamsMandateData(TypedDict): - customer_acceptance: "PaymentIntentService.UpdateParamsMandateDataCustomerAcceptance" + customer_acceptance: ( + "PaymentIntentService.UpdateParamsMandateDataCustomerAcceptance" + ) """ This hash contains details about the customer acceptance of the Mandate. """ diff --git a/stripe/_payment_link.py b/stripe/_payment_link.py index 8e1e1e132..31ba7f183 100644 --- a/stripe/_payment_link.py +++ b/stripe/_payment_link.py @@ -1208,7 +1208,9 @@ class CreateParamsPhoneNumberCollection(TypedDict): """ class CreateParamsRestrictions(TypedDict): - completed_sessions: "PaymentLink.CreateParamsRestrictionsCompletedSessions" + completed_sessions: ( + "PaymentLink.CreateParamsRestrictionsCompletedSessions" + ) """ Configuration for the `completed_sessions` restriction type. """ @@ -1517,7 +1519,9 @@ class CreateParamsSubscriptionDataInvoiceSettingsIssuer(TypedDict): """ class CreateParamsSubscriptionDataTrialSettings(TypedDict): - end_behavior: "PaymentLink.CreateParamsSubscriptionDataTrialSettingsEndBehavior" + end_behavior: ( + "PaymentLink.CreateParamsSubscriptionDataTrialSettingsEndBehavior" + ) """ Defines how the subscription should behave when the user's free trial ends. """ @@ -1992,7 +1996,9 @@ class ModifyParamsPaymentIntentData(TypedDict): """ class ModifyParamsRestrictions(TypedDict): - completed_sessions: "PaymentLink.ModifyParamsRestrictionsCompletedSessions" + completed_sessions: ( + "PaymentLink.ModifyParamsRestrictionsCompletedSessions" + ) """ Configuration for the `completed_sessions` restriction type. """ @@ -2287,7 +2293,9 @@ class ModifyParamsSubscriptionDataInvoiceSettingsIssuer(TypedDict): """ class ModifyParamsSubscriptionDataTrialSettings(TypedDict): - end_behavior: "PaymentLink.ModifyParamsSubscriptionDataTrialSettingsEndBehavior" + end_behavior: ( + "PaymentLink.ModifyParamsSubscriptionDataTrialSettingsEndBehavior" + ) """ Defines how the subscription should behave when the user's free trial ends. """ @@ -2501,7 +2509,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -2522,7 +2529,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -2534,7 +2540,7 @@ async def list_async( def _cls_list_line_items( cls, payment_link: str, - **params: Unpack["PaymentLink.ListLineItemsParams"] + **params: Unpack["PaymentLink.ListLineItemsParams"], ) -> ListObject["LineItem"]: """ When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. @@ -2591,7 +2597,7 @@ def list_line_items( # pyright: ignore[reportGeneralTypeIssues] async def _cls_list_line_items_async( cls, payment_link: str, - **params: Unpack["PaymentLink.ListLineItemsParams"] + **params: Unpack["PaymentLink.ListLineItemsParams"], ) -> ListObject["LineItem"]: """ When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. diff --git a/stripe/_payment_link_service.py b/stripe/_payment_link_service.py index 924ba0d28..553136978 100644 --- a/stripe/_payment_link_service.py +++ b/stripe/_payment_link_service.py @@ -562,7 +562,9 @@ class CreateParamsPhoneNumberCollection(TypedDict): """ class CreateParamsRestrictions(TypedDict): - completed_sessions: "PaymentLinkService.CreateParamsRestrictionsCompletedSessions" + completed_sessions: ( + "PaymentLinkService.CreateParamsRestrictionsCompletedSessions" + ) """ Configuration for the `completed_sessions` restriction type. """ @@ -1346,7 +1348,9 @@ class UpdateParamsPaymentIntentData(TypedDict): """ class UpdateParamsRestrictions(TypedDict): - completed_sessions: "PaymentLinkService.UpdateParamsRestrictionsCompletedSessions" + completed_sessions: ( + "PaymentLinkService.UpdateParamsRestrictionsCompletedSessions" + ) """ Configuration for the `completed_sessions` restriction type. """ diff --git a/stripe/_payment_method.py b/stripe/_payment_method.py index 51fa8b36d..8aa6b48ea 100644 --- a/stripe/_payment_method.py +++ b/stripe/_payment_method.py @@ -2080,7 +2080,7 @@ class RetrieveParams(RequestOptions): def _cls_attach( cls, payment_method: str, - **params: Unpack["PaymentMethod.AttachParams"] + **params: Unpack["PaymentMethod.AttachParams"], ) -> "PaymentMethod": """ Attaches a PaymentMethod object to a Customer. @@ -2185,7 +2185,7 @@ def attach( # pyright: ignore[reportGeneralTypeIssues] async def _cls_attach_async( cls, payment_method: str, - **params: Unpack["PaymentMethod.AttachParams"] + **params: Unpack["PaymentMethod.AttachParams"], ) -> "PaymentMethod": """ Attaches a PaymentMethod object to a Customer. @@ -2326,7 +2326,7 @@ async def create_async( def _cls_detach( cls, payment_method: str, - **params: Unpack["PaymentMethod.DetachParams"] + **params: Unpack["PaymentMethod.DetachParams"], ) -> "PaymentMethod": """ Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer. @@ -2383,7 +2383,7 @@ def detach( # pyright: ignore[reportGeneralTypeIssues] async def _cls_detach_async( cls, payment_method: str, - **params: Unpack["PaymentMethod.DetachParams"] + **params: Unpack["PaymentMethod.DetachParams"], ) -> "PaymentMethod": """ Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer. @@ -2449,7 +2449,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -2470,7 +2469,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_payment_method_configuration.py b/stripe/_payment_method_configuration.py index 2f4da96cd..39b67ac54 100644 --- a/stripe/_payment_method_configuration.py +++ b/stripe/_payment_method_configuration.py @@ -33,9 +33,9 @@ class PaymentMethodConfiguration( - [Multiple configurations for your Connect accounts](https://stripe.com/docs/connect/multiple-payment-method-configurations) """ - OBJECT_NAME: ClassVar[ - Literal["payment_method_configuration"] - ] = "payment_method_configuration" + OBJECT_NAME: ClassVar[Literal["payment_method_configuration"]] = ( + "payment_method_configuration" + ) class AcssDebit(StripeObject): class DisplayPreference(StripeObject): @@ -2580,7 +2580,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -2601,7 +2600,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -2613,7 +2611,7 @@ async def list_async( def modify( cls, id: str, - **params: Unpack["PaymentMethodConfiguration.ModifyParams"] + **params: Unpack["PaymentMethodConfiguration.ModifyParams"], ) -> "PaymentMethodConfiguration": """ Update payment method configuration @@ -2632,7 +2630,7 @@ def modify( async def modify_async( cls, id: str, - **params: Unpack["PaymentMethodConfiguration.ModifyParams"] + **params: Unpack["PaymentMethodConfiguration.ModifyParams"], ) -> "PaymentMethodConfiguration": """ Update payment method configuration @@ -2651,7 +2649,7 @@ async def modify_async( def retrieve( cls, id: str, - **params: Unpack["PaymentMethodConfiguration.RetrieveParams"] + **params: Unpack["PaymentMethodConfiguration.RetrieveParams"], ) -> "PaymentMethodConfiguration": """ Retrieve payment method configuration @@ -2664,7 +2662,7 @@ def retrieve( async def retrieve_async( cls, id: str, - **params: Unpack["PaymentMethodConfiguration.RetrieveParams"] + **params: Unpack["PaymentMethodConfiguration.RetrieveParams"], ) -> "PaymentMethodConfiguration": """ Retrieve payment method configuration diff --git a/stripe/_payment_method_domain.py b/stripe/_payment_method_domain.py index c92a4c5c2..60e544186 100644 --- a/stripe/_payment_method_domain.py +++ b/stripe/_payment_method_domain.py @@ -23,9 +23,9 @@ class PaymentMethodDomain( Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration). """ - OBJECT_NAME: ClassVar[ - Literal["payment_method_domain"] - ] = "payment_method_domain" + OBJECT_NAME: ClassVar[Literal["payment_method_domain"]] = ( + "payment_method_domain" + ) class ApplePay(StripeObject): class StatusDetails(StripeObject): @@ -243,7 +243,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -264,7 +263,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -332,7 +330,7 @@ async def retrieve_async( def _cls_validate( cls, payment_method_domain: str, - **params: Unpack["PaymentMethodDomain.ValidateParams"] + **params: Unpack["PaymentMethodDomain.ValidateParams"], ) -> "PaymentMethodDomain": """ Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain. @@ -357,7 +355,7 @@ def _cls_validate( @staticmethod def validate( payment_method_domain: str, - **params: Unpack["PaymentMethodDomain.ValidateParams"] + **params: Unpack["PaymentMethodDomain.ValidateParams"], ) -> "PaymentMethodDomain": """ Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain. @@ -410,7 +408,7 @@ def validate( # pyright: ignore[reportGeneralTypeIssues] async def _cls_validate_async( cls, payment_method_domain: str, - **params: Unpack["PaymentMethodDomain.ValidateParams"] + **params: Unpack["PaymentMethodDomain.ValidateParams"], ) -> "PaymentMethodDomain": """ Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain. @@ -435,7 +433,7 @@ async def _cls_validate_async( @staticmethod async def validate_async( payment_method_domain: str, - **params: Unpack["PaymentMethodDomain.ValidateParams"] + **params: Unpack["PaymentMethodDomain.ValidateParams"], ) -> "PaymentMethodDomain": """ Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain. diff --git a/stripe/_payout.py b/stripe/_payout.py index 6becddf37..7e1d627c2 100644 --- a/stripe/_payout.py +++ b/stripe/_payout.py @@ -436,7 +436,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -457,7 +456,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_plan.py b/stripe/_plan.py index 7d2343e04..07bdb1c1a 100644 --- a/stripe/_plan.py +++ b/stripe/_plan.py @@ -523,7 +523,6 @@ def list(cls, **params: Unpack["Plan.ListParams"]) -> ListObject["Plan"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -544,7 +543,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_price.py b/stripe/_price.py index 267747758..3921b88f1 100644 --- a/stripe/_price.py +++ b/stripe/_price.py @@ -817,7 +817,6 @@ def list(cls, **params: Unpack["Price.ListParams"]) -> ListObject["Price"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -838,7 +837,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_product.py b/stripe/_product.py index 4abd22822..20f1ec0a0 100644 --- a/stripe/_product.py +++ b/stripe/_product.py @@ -779,7 +779,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -800,7 +799,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -907,7 +905,7 @@ def delete_feature( cls, product: str, id: str, - **params: Unpack["Product.DeleteFeatureParams"] + **params: Unpack["Product.DeleteFeatureParams"], ) -> "ProductFeature": """ Deletes the feature attachment to a product @@ -928,7 +926,7 @@ async def delete_feature_async( cls, product: str, id: str, - **params: Unpack["Product.DeleteFeatureParams"] + **params: Unpack["Product.DeleteFeatureParams"], ) -> "ProductFeature": """ Deletes the feature attachment to a product @@ -1021,7 +1019,7 @@ def retrieve_feature( cls, product: str, id: str, - **params: Unpack["Product.RetrieveFeatureParams"] + **params: Unpack["Product.RetrieveFeatureParams"], ) -> "ProductFeature": """ Retrieves a product_feature, which represents a feature attachment to a product @@ -1042,7 +1040,7 @@ async def retrieve_feature_async( cls, product: str, id: str, - **params: Unpack["Product.RetrieveFeatureParams"] + **params: Unpack["Product.RetrieveFeatureParams"], ) -> "ProductFeature": """ Retrieves a product_feature, which represents a feature attachment to a product diff --git a/stripe/_promotion_code.py b/stripe/_promotion_code.py index f785facd4..13fb3c528 100644 --- a/stripe/_promotion_code.py +++ b/stripe/_promotion_code.py @@ -315,7 +315,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -336,7 +335,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_quote.py b/stripe/_quote.py index d21f3d897..da4b640ad 100644 --- a/stripe/_quote.py +++ b/stripe/_quote.py @@ -4256,7 +4256,6 @@ def list(cls, **params: Unpack["Quote.ListParams"]) -> ListObject["Quote"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -4277,7 +4276,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -4289,7 +4287,7 @@ async def list_async( def _cls_list_computed_upfront_line_items( cls, quote: str, - **params: Unpack["Quote.ListComputedUpfrontLineItemsParams"] + **params: Unpack["Quote.ListComputedUpfrontLineItemsParams"], ) -> ListObject["LineItem"]: """ When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items. @@ -4309,7 +4307,7 @@ def _cls_list_computed_upfront_line_items( @staticmethod def list_computed_upfront_line_items( quote: str, - **params: Unpack["Quote.ListComputedUpfrontLineItemsParams"] + **params: Unpack["Quote.ListComputedUpfrontLineItemsParams"], ) -> ListObject["LineItem"]: """ When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items. @@ -4347,7 +4345,7 @@ def list_computed_upfront_line_items( # pyright: ignore[reportGeneralTypeIssues async def _cls_list_computed_upfront_line_items_async( cls, quote: str, - **params: Unpack["Quote.ListComputedUpfrontLineItemsParams"] + **params: Unpack["Quote.ListComputedUpfrontLineItemsParams"], ) -> ListObject["LineItem"]: """ When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items. @@ -4367,7 +4365,7 @@ async def _cls_list_computed_upfront_line_items_async( @staticmethod async def list_computed_upfront_line_items_async( quote: str, - **params: Unpack["Quote.ListComputedUpfrontLineItemsParams"] + **params: Unpack["Quote.ListComputedUpfrontLineItemsParams"], ) -> ListObject["LineItem"]: """ When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items. @@ -4622,7 +4620,7 @@ def _cls_list_preview_invoice_lines( cls, quote: str, preview_invoice: str, - **params: Unpack["Quote.ListPreviewInvoiceLinesParams"] + **params: Unpack["Quote.ListPreviewInvoiceLinesParams"], ) -> ListObject["InvoiceLineItem"]: """ Preview the invoice line items that would be generated by accepting the quote. @@ -4644,7 +4642,7 @@ def _cls_list_preview_invoice_lines( def list_preview_invoice_lines( quote: str, preview_invoice: str, - **params: Unpack["Quote.ListPreviewInvoiceLinesParams"] + **params: Unpack["Quote.ListPreviewInvoiceLinesParams"], ) -> ListObject["InvoiceLineItem"]: """ Preview the invoice line items that would be generated by accepting the quote. @@ -4655,7 +4653,7 @@ def list_preview_invoice_lines( def list_preview_invoice_lines( self, preview_invoice: str, - **params: Unpack["Quote.ListPreviewInvoiceLinesParams"] + **params: Unpack["Quote.ListPreviewInvoiceLinesParams"], ) -> ListObject["InvoiceLineItem"]: """ Preview the invoice line items that would be generated by accepting the quote. @@ -4666,7 +4664,7 @@ def list_preview_invoice_lines( def list_preview_invoice_lines( # pyright: ignore[reportGeneralTypeIssues] self, preview_invoice: str, - **params: Unpack["Quote.ListPreviewInvoiceLinesParams"] + **params: Unpack["Quote.ListPreviewInvoiceLinesParams"], ) -> ListObject["InvoiceLineItem"]: """ Preview the invoice line items that would be generated by accepting the quote. @@ -4688,7 +4686,7 @@ async def _cls_list_preview_invoice_lines_async( cls, quote: str, preview_invoice: str, - **params: Unpack["Quote.ListPreviewInvoiceLinesParams"] + **params: Unpack["Quote.ListPreviewInvoiceLinesParams"], ) -> ListObject["InvoiceLineItem"]: """ Preview the invoice line items that would be generated by accepting the quote. @@ -4710,7 +4708,7 @@ async def _cls_list_preview_invoice_lines_async( async def list_preview_invoice_lines_async( quote: str, preview_invoice: str, - **params: Unpack["Quote.ListPreviewInvoiceLinesParams"] + **params: Unpack["Quote.ListPreviewInvoiceLinesParams"], ) -> ListObject["InvoiceLineItem"]: """ Preview the invoice line items that would be generated by accepting the quote. @@ -4721,7 +4719,7 @@ async def list_preview_invoice_lines_async( async def list_preview_invoice_lines_async( self, preview_invoice: str, - **params: Unpack["Quote.ListPreviewInvoiceLinesParams"] + **params: Unpack["Quote.ListPreviewInvoiceLinesParams"], ) -> ListObject["InvoiceLineItem"]: """ Preview the invoice line items that would be generated by accepting the quote. @@ -4732,7 +4730,7 @@ async def list_preview_invoice_lines_async( async def list_preview_invoice_lines_async( # pyright: ignore[reportGeneralTypeIssues] self, preview_invoice: str, - **params: Unpack["Quote.ListPreviewInvoiceLinesParams"] + **params: Unpack["Quote.ListPreviewInvoiceLinesParams"], ) -> ListObject["InvoiceLineItem"]: """ Preview the invoice line items that would be generated by accepting the quote. @@ -5273,7 +5271,7 @@ async def list_preview_invoices_async( def list_preview_subscription_schedules( cls, quote: str, - **params: Unpack["Quote.ListPreviewSubscriptionSchedulesParams"] + **params: Unpack["Quote.ListPreviewSubscriptionSchedulesParams"], ) -> ListObject["QuotePreviewSubscriptionSchedule"]: """ Preview the schedules that would be generated by accepting the quote @@ -5293,7 +5291,7 @@ def list_preview_subscription_schedules( async def list_preview_subscription_schedules_async( cls, quote: str, - **params: Unpack["Quote.ListPreviewSubscriptionSchedulesParams"] + **params: Unpack["Quote.ListPreviewSubscriptionSchedulesParams"], ) -> ListObject["QuotePreviewSubscriptionSchedule"]: """ Preview the schedules that would be generated by accepting the quote diff --git a/stripe/_quote_phase.py b/stripe/_quote_phase.py index ac3dabd71..b87e55be3 100644 --- a/stripe/_quote_phase.py +++ b/stripe/_quote_phase.py @@ -233,7 +233,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -254,7 +253,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -266,7 +264,7 @@ async def list_async( def _cls_list_line_items( cls, quote_phase: str, - **params: Unpack["QuotePhase.ListLineItemsParams"] + **params: Unpack["QuotePhase.ListLineItemsParams"], ) -> ListObject["LineItem"]: """ When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. @@ -323,7 +321,7 @@ def list_line_items( # pyright: ignore[reportGeneralTypeIssues] async def _cls_list_line_items_async( cls, quote_phase: str, - **params: Unpack["QuotePhase.ListLineItemsParams"] + **params: Unpack["QuotePhase.ListLineItemsParams"], ) -> ListObject["LineItem"]: """ When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. diff --git a/stripe/_quote_preview_invoice.py b/stripe/_quote_preview_invoice.py index 9dd8bad99..97be87d84 100644 --- a/stripe/_quote_preview_invoice.py +++ b/stripe/_quote_preview_invoice.py @@ -64,9 +64,9 @@ class QuotePreviewInvoice(StripeObject): Related guide: [Send invoices to customers](https://stripe.com/docs/billing/invoices/sending) """ - OBJECT_NAME: ClassVar[ - Literal["quote_preview_invoice"] - ] = "quote_preview_invoice" + OBJECT_NAME: ClassVar[Literal["quote_preview_invoice"]] = ( + "quote_preview_invoice" + ) class AmountsDue(StripeObject): amount: int diff --git a/stripe/_quote_preview_subscription_schedule.py b/stripe/_quote_preview_subscription_schedule.py index 07a409363..1929918d5 100644 --- a/stripe/_quote_preview_subscription_schedule.py +++ b/stripe/_quote_preview_subscription_schedule.py @@ -23,9 +23,9 @@ class QuotePreviewSubscriptionSchedule(StripeObject): - OBJECT_NAME: ClassVar[ - Literal["quote_preview_subscription_schedule"] - ] = "quote_preview_subscription_schedule" + OBJECT_NAME: ClassVar[Literal["quote_preview_subscription_schedule"]] = ( + "quote_preview_subscription_schedule" + ) class AppliesTo(StripeObject): new_reference: Optional[str] diff --git a/stripe/_quote_service.py b/stripe/_quote_service.py index 31d4ee354..6ab4b351a 100644 --- a/stripe/_quote_service.py +++ b/stripe/_quote_service.py @@ -1249,7 +1249,9 @@ class CreateParamsSubscriptionDataBillOnAcceptanceBillUntilLineEndsAt( """ class CreateParamsSubscriptionDataOverride(TypedDict): - applies_to: "QuoteService.CreateParamsSubscriptionDataOverrideAppliesTo" + applies_to: ( + "QuoteService.CreateParamsSubscriptionDataOverrideAppliesTo" + ) """ Whether the override applies to an existing Subscription Schedule or a new Subscription Schedule. """ @@ -2715,7 +2717,9 @@ class UpdateParamsSubscriptionDataBillOnAcceptanceBillUntilLineEndsAt( """ class UpdateParamsSubscriptionDataOverride(TypedDict): - applies_to: "QuoteService.UpdateParamsSubscriptionDataOverrideAppliesTo" + applies_to: ( + "QuoteService.UpdateParamsSubscriptionDataOverrideAppliesTo" + ) """ Whether the override applies to an existing Subscription Schedule or a new Subscription Schedule. """ diff --git a/stripe/_refund.py b/stripe/_refund.py index 118a7916a..bb2449bf7 100644 --- a/stripe/_refund.py +++ b/stripe/_refund.py @@ -718,7 +718,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -739,7 +738,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_request_options.py b/stripe/_request_options.py index 0d39e885a..d188818f8 100644 --- a/stripe/_request_options.py +++ b/stripe/_request_options.py @@ -45,7 +45,7 @@ def merge_options( def extract_options_from_dict( - d: Optional[Mapping[str, Any]] + d: Optional[Mapping[str, Any]], ) -> Tuple[RequestOptions, Dict[str, Any]]: """ Extracts a RequestOptions object from a dict, and returns a tuple of diff --git a/stripe/_reserve_transaction.py b/stripe/_reserve_transaction.py index 72e367f7a..aef70b250 100644 --- a/stripe/_reserve_transaction.py +++ b/stripe/_reserve_transaction.py @@ -6,9 +6,9 @@ class ReserveTransaction(StripeObject): - OBJECT_NAME: ClassVar[ - Literal["reserve_transaction"] - ] = "reserve_transaction" + OBJECT_NAME: ClassVar[Literal["reserve_transaction"]] = ( + "reserve_transaction" + ) amount: int currency: str """ diff --git a/stripe/_review.py b/stripe/_review.py index 82c4a8cf6..691e8335a 100644 --- a/stripe/_review.py +++ b/stripe/_review.py @@ -304,7 +304,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -325,7 +324,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_setup_attempt.py b/stripe/_setup_attempt.py index 15c4dbb86..e6e78e517 100644 --- a/stripe/_setup_attempt.py +++ b/stripe/_setup_attempt.py @@ -818,7 +818,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -839,7 +838,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_setup_intent.py b/stripe/_setup_intent.py index 1c2be63a1..06c6ff9fc 100644 --- a/stripe/_setup_intent.py +++ b/stripe/_setup_intent.py @@ -2007,7 +2007,9 @@ class CreateParamsAutomaticPaymentMethods(TypedDict): """ class CreateParamsMandateData(TypedDict): - customer_acceptance: "SetupIntent.CreateParamsMandateDataCustomerAcceptance" + customer_acceptance: ( + "SetupIntent.CreateParamsMandateDataCustomerAcceptance" + ) """ This hash contains details about the customer acceptance of the Mandate. """ @@ -4879,7 +4881,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -4900,7 +4901,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -4976,7 +4976,7 @@ async def retrieve_async( def _cls_verify_microdeposits( cls, intent: str, - **params: Unpack["SetupIntent.VerifyMicrodepositsParams"] + **params: Unpack["SetupIntent.VerifyMicrodepositsParams"], ) -> "SetupIntent": """ Verifies microdeposits on a SetupIntent object. @@ -5033,7 +5033,7 @@ def verify_microdeposits( # pyright: ignore[reportGeneralTypeIssues] async def _cls_verify_microdeposits_async( cls, intent: str, - **params: Unpack["SetupIntent.VerifyMicrodepositsParams"] + **params: Unpack["SetupIntent.VerifyMicrodepositsParams"], ) -> "SetupIntent": """ Verifies microdeposits on a SetupIntent object. diff --git a/stripe/_setup_intent_service.py b/stripe/_setup_intent_service.py index 0436382d3..406344779 100644 --- a/stripe/_setup_intent_service.py +++ b/stripe/_setup_intent_service.py @@ -1352,7 +1352,9 @@ class CreateParamsAutomaticPaymentMethods(TypedDict): """ class CreateParamsMandateData(TypedDict): - customer_acceptance: "SetupIntentService.CreateParamsMandateDataCustomerAcceptance" + customer_acceptance: ( + "SetupIntentService.CreateParamsMandateDataCustomerAcceptance" + ) """ This hash contains details about the customer acceptance of the Mandate. """ diff --git a/stripe/_shipping_rate.py b/stripe/_shipping_rate.py index fa424e3c9..b156339ea 100644 --- a/stripe/_shipping_rate.py +++ b/stripe/_shipping_rate.py @@ -379,7 +379,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -400,7 +399,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_source.py b/stripe/_source.py index cd5d444e8..f2495dd98 100644 --- a/stripe/_source.py +++ b/stripe/_source.py @@ -1160,7 +1160,7 @@ async def create_async( def _cls_list_source_transactions( cls, source: str, - **params: Unpack["Source.ListSourceTransactionsParams"] + **params: Unpack["Source.ListSourceTransactionsParams"], ) -> ListObject["SourceTransaction"]: """ List source transactions for a given source. @@ -1217,7 +1217,7 @@ def list_source_transactions( # pyright: ignore[reportGeneralTypeIssues] async def _cls_list_source_transactions_async( cls, source: str, - **params: Unpack["Source.ListSourceTransactionsParams"] + **params: Unpack["Source.ListSourceTransactionsParams"], ) -> ListObject["SourceTransaction"]: """ List source transactions for a given source. diff --git a/stripe/_source_mandate_notification.py b/stripe/_source_mandate_notification.py index fbb525eb1..2d6a62020 100644 --- a/stripe/_source_mandate_notification.py +++ b/stripe/_source_mandate_notification.py @@ -15,9 +15,9 @@ class SourceMandateNotification(StripeObject): deliver an email to the customer. """ - OBJECT_NAME: ClassVar[ - Literal["source_mandate_notification"] - ] = "source_mandate_notification" + OBJECT_NAME: ClassVar[Literal["source_mandate_notification"]] = ( + "source_mandate_notification" + ) class AcssDebit(StripeObject): statement_descriptor: Optional[str] diff --git a/stripe/_stripe_client.py b/stripe/_stripe_client.py index 2791dd471..3011fb88b 100644 --- a/stripe/_stripe_client.py +++ b/stripe/_stripe_client.py @@ -103,7 +103,6 @@ from stripe._transfer_service import TransferService from stripe._treasury_service import TreasuryService from stripe._webhook_endpoint_service import WebhookEndpointService - # services: The end of the section generated from our OpenAPI spec diff --git a/stripe/_stripe_object.py b/stripe/_stripe_object.py index 4a036e9b7..d0b2230f0 100644 --- a/stripe/_stripe_object.py +++ b/stripe/_stripe_object.py @@ -38,15 +38,13 @@ @overload def _compute_diff( current: Dict[str, Any], previous: Optional[Dict[str, Any]] -) -> Dict[str, Any]: - ... +) -> Dict[str, Any]: ... @overload def _compute_diff( current: object, previous: Optional[Dict[str, Any]] -) -> object: - ... +) -> object: ... def _compute_diff( @@ -101,7 +99,7 @@ def __init__( *, _requestor: Optional["_APIRequestor"] = None, # TODO: is a more specific type possible here? - **params: Any + **params: Any, ): super(StripeObject, self).__init__() @@ -522,7 +520,7 @@ def to_dict(self) -> Dict[str, Any]: def _to_dict_recursive(self) -> Dict[str, Any]: def maybe_to_dict_recursive( - value: Optional[Union[StripeObject, Dict[str, Any]]] + value: Optional[Union[StripeObject, Dict[str, Any]]], ) -> Optional[Dict[str, Any]]: if value is None: return None diff --git a/stripe/_subscription.py b/stripe/_subscription.py index 17d985663..003ef5e36 100644 --- a/stripe/_subscription.py +++ b/stripe/_subscription.py @@ -2475,7 +2475,7 @@ class SearchParams(RequestOptions): def _cls_cancel( cls, subscription_exposed_id: str, - **params: Unpack["Subscription.CancelParams"] + **params: Unpack["Subscription.CancelParams"], ) -> "Subscription": """ Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. @@ -2501,7 +2501,7 @@ def _cls_cancel( @staticmethod def cancel( subscription_exposed_id: str, - **params: Unpack["Subscription.CancelParams"] + **params: Unpack["Subscription.CancelParams"], ) -> "Subscription": """ Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. @@ -2551,7 +2551,7 @@ def cancel( # pyright: ignore[reportGeneralTypeIssues] async def _cls_cancel_async( cls, subscription_exposed_id: str, - **params: Unpack["Subscription.CancelParams"] + **params: Unpack["Subscription.CancelParams"], ) -> "Subscription": """ Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. @@ -2577,7 +2577,7 @@ async def _cls_cancel_async( @staticmethod async def cancel_async( subscription_exposed_id: str, - **params: Unpack["Subscription.CancelParams"] + **params: Unpack["Subscription.CancelParams"], ) -> "Subscription": """ Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. @@ -2671,7 +2671,7 @@ async def create_async( def _cls_delete_discount( cls, subscription_exposed_id: str, - **params: Unpack["Subscription.DeleteDiscountParams"] + **params: Unpack["Subscription.DeleteDiscountParams"], ) -> "Discount": """ Removes the currently applied discount on a subscription. @@ -2693,7 +2693,7 @@ def _cls_delete_discount( @staticmethod def delete_discount( subscription_exposed_id: str, - **params: Unpack["Subscription.DeleteDiscountParams"] + **params: Unpack["Subscription.DeleteDiscountParams"], ) -> "Discount": """ Removes the currently applied discount on a subscription. @@ -2731,7 +2731,7 @@ def delete_discount( # pyright: ignore[reportGeneralTypeIssues] async def _cls_delete_discount_async( cls, subscription_exposed_id: str, - **params: Unpack["Subscription.DeleteDiscountParams"] + **params: Unpack["Subscription.DeleteDiscountParams"], ) -> "Discount": """ Removes the currently applied discount on a subscription. @@ -2753,7 +2753,7 @@ async def _cls_delete_discount_async( @staticmethod async def delete_discount_async( subscription_exposed_id: str, - **params: Unpack["Subscription.DeleteDiscountParams"] + **params: Unpack["Subscription.DeleteDiscountParams"], ) -> "Discount": """ Removes the currently applied discount on a subscription. @@ -2800,7 +2800,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -2821,7 +2820,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_subscription_item.py b/stripe/_subscription_item.py index d0385b8ac..9e832e89c 100644 --- a/stripe/_subscription_item.py +++ b/stripe/_subscription_item.py @@ -687,7 +687,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -708,7 +707,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -776,7 +774,7 @@ async def retrieve_async( def create_usage_record( cls, subscription_item: str, - **params: Unpack["SubscriptionItem.CreateUsageRecordParams"] + **params: Unpack["SubscriptionItem.CreateUsageRecordParams"], ) -> "UsageRecord": """ Creates a usage record for a specified subscription item and date, and fills it with a quantity. @@ -802,7 +800,7 @@ def create_usage_record( async def create_usage_record_async( cls, subscription_item: str, - **params: Unpack["SubscriptionItem.CreateUsageRecordParams"] + **params: Unpack["SubscriptionItem.CreateUsageRecordParams"], ) -> "UsageRecord": """ Creates a usage record for a specified subscription item and date, and fills it with a quantity. @@ -828,7 +826,7 @@ async def create_usage_record_async( def list_usage_record_summaries( cls, subscription_item: str, - **params: Unpack["SubscriptionItem.ListUsageRecordSummariesParams"] + **params: Unpack["SubscriptionItem.ListUsageRecordSummariesParams"], ) -> ListObject["UsageRecordSummary"]: """ For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that's been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September). @@ -850,7 +848,7 @@ def list_usage_record_summaries( async def list_usage_record_summaries_async( cls, subscription_item: str, - **params: Unpack["SubscriptionItem.ListUsageRecordSummariesParams"] + **params: Unpack["SubscriptionItem.ListUsageRecordSummariesParams"], ) -> ListObject["UsageRecordSummary"]: """ For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that's been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September). diff --git a/stripe/_subscription_schedule.py b/stripe/_subscription_schedule.py index a1038ef7f..4a70b48e6 100644 --- a/stripe/_subscription_schedule.py +++ b/stripe/_subscription_schedule.py @@ -45,9 +45,9 @@ class SubscriptionSchedule( Related guide: [Subscription schedules](https://stripe.com/docs/billing/subscriptions/subscription-schedules) """ - OBJECT_NAME: ClassVar[ - Literal["subscription_schedule"] - ] = "subscription_schedule" + OBJECT_NAME: ClassVar[Literal["subscription_schedule"]] = ( + "subscription_schedule" + ) class CurrentPhase(StripeObject): end_date: int @@ -578,7 +578,9 @@ class AmendParamsAmendment(TypedDict): """ Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment. """ - amendment_start: "SubscriptionSchedule.AmendParamsAmendmentAmendmentStart" + amendment_start: ( + "SubscriptionSchedule.AmendParamsAmendmentAmendmentStart" + ) """ Details to identify the earliest timestamp where the proposed change should take effect. """ @@ -1763,7 +1765,9 @@ class CreateParamsPhaseItemPriceData(TypedDict): """ The ID of the product that this price will belong to. """ - recurring: "SubscriptionSchedule.CreateParamsPhaseItemPriceDataRecurring" + recurring: ( + "SubscriptionSchedule.CreateParamsPhaseItemPriceDataRecurring" + ) """ The recurring components of a price such as `interval` and `interval_count`. """ @@ -2559,7 +2563,9 @@ class ModifyParamsPhaseItemPriceData(TypedDict): """ The ID of the product that this price will belong to. """ - recurring: "SubscriptionSchedule.ModifyParamsPhaseItemPriceDataRecurring" + recurring: ( + "SubscriptionSchedule.ModifyParamsPhaseItemPriceDataRecurring" + ) """ The recurring components of a price such as `interval` and `interval_count`. """ @@ -2740,7 +2746,7 @@ class RetrieveParams(RequestOptions): def _cls_amend( cls, schedule: str, - **params: Unpack["SubscriptionSchedule.AmendParams"] + **params: Unpack["SubscriptionSchedule.AmendParams"], ) -> "SubscriptionSchedule": """ Amends an existing subscription schedule. @@ -2797,7 +2803,7 @@ def amend( # pyright: ignore[reportGeneralTypeIssues] async def _cls_amend_async( cls, schedule: str, - **params: Unpack["SubscriptionSchedule.AmendParams"] + **params: Unpack["SubscriptionSchedule.AmendParams"], ) -> "SubscriptionSchedule": """ Amends an existing subscription schedule. @@ -2854,7 +2860,7 @@ async def amend_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_cancel( cls, schedule: str, - **params: Unpack["SubscriptionSchedule.CancelParams"] + **params: Unpack["SubscriptionSchedule.CancelParams"], ) -> "SubscriptionSchedule": """ Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active. @@ -2911,7 +2917,7 @@ def cancel( # pyright: ignore[reportGeneralTypeIssues] async def _cls_cancel_async( cls, schedule: str, - **params: Unpack["SubscriptionSchedule.CancelParams"] + **params: Unpack["SubscriptionSchedule.CancelParams"], ) -> "SubscriptionSchedule": """ Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active. @@ -3009,7 +3015,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -3030,7 +3035,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -3076,7 +3080,7 @@ async def modify_async( def _cls_release( cls, schedule: str, - **params: Unpack["SubscriptionSchedule.ReleaseParams"] + **params: Unpack["SubscriptionSchedule.ReleaseParams"], ) -> "SubscriptionSchedule": """ Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property. @@ -3133,7 +3137,7 @@ def release( # pyright: ignore[reportGeneralTypeIssues] async def _cls_release_async( cls, schedule: str, - **params: Unpack["SubscriptionSchedule.ReleaseParams"] + **params: Unpack["SubscriptionSchedule.ReleaseParams"], ) -> "SubscriptionSchedule": """ Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property. diff --git a/stripe/_subscription_schedule_service.py b/stripe/_subscription_schedule_service.py index 710b0131c..9b84ac1a7 100644 --- a/stripe/_subscription_schedule_service.py +++ b/stripe/_subscription_schedule_service.py @@ -48,7 +48,9 @@ class AmendParamsAmendment(TypedDict): """ Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment. """ - amendment_start: "SubscriptionScheduleService.AmendParamsAmendmentAmendmentStart" + amendment_start: ( + "SubscriptionScheduleService.AmendParamsAmendmentAmendmentStart" + ) """ Details to identify the earliest timestamp where the proposed change should take effect. """ diff --git a/stripe/_subscription_service.py b/stripe/_subscription_service.py index 750ed2fa2..e829cfb6d 100644 --- a/stripe/_subscription_service.py +++ b/stripe/_subscription_service.py @@ -849,7 +849,9 @@ class CreateParamsTransferData(TypedDict): """ class CreateParamsTrialSettings(TypedDict): - end_behavior: "SubscriptionService.CreateParamsTrialSettingsEndBehavior" + end_behavior: ( + "SubscriptionService.CreateParamsTrialSettingsEndBehavior" + ) """ Defines how the subscription should behave when the user's free trial ends. """ @@ -1833,7 +1835,9 @@ class UpdateParamsTransferData(TypedDict): """ class UpdateParamsTrialSettings(TypedDict): - end_behavior: "SubscriptionService.UpdateParamsTrialSettingsEndBehavior" + end_behavior: ( + "SubscriptionService.UpdateParamsTrialSettingsEndBehavior" + ) """ Defines how the subscription should behave when the user's free trial ends. """ diff --git a/stripe/_tax_code.py b/stripe/_tax_code.py index a20795230..e9160c8b1 100644 --- a/stripe/_tax_code.py +++ b/stripe/_tax_code.py @@ -68,7 +68,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -89,7 +88,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_tax_deducted_at_source.py b/stripe/_tax_deducted_at_source.py index c2a064fa9..a07bcf4ca 100644 --- a/stripe/_tax_deducted_at_source.py +++ b/stripe/_tax_deducted_at_source.py @@ -6,9 +6,9 @@ class TaxDeductedAtSource(StripeObject): - OBJECT_NAME: ClassVar[ - Literal["tax_deducted_at_source"] - ] = "tax_deducted_at_source" + OBJECT_NAME: ClassVar[Literal["tax_deducted_at_source"]] = ( + "tax_deducted_at_source" + ) id: str """ Unique identifier for the object. diff --git a/stripe/_tax_id.py b/stripe/_tax_id.py index 1e481e344..bc61e7638 100644 --- a/stripe/_tax_id.py +++ b/stripe/_tax_id.py @@ -471,7 +471,6 @@ def list(cls, **params: Unpack["TaxId.ListParams"]) -> ListObject["TaxId"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -492,7 +491,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_tax_rate.py b/stripe/_tax_rate.py index 8ab062194..8a19bb5d5 100644 --- a/stripe/_tax_rate.py +++ b/stripe/_tax_rate.py @@ -318,7 +318,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -339,7 +338,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_topup.py b/stripe/_topup.py index c6404973e..9c1dc0004 100644 --- a/stripe/_topup.py +++ b/stripe/_topup.py @@ -372,7 +372,6 @@ def list(cls, **params: Unpack["Topup.ListParams"]) -> ListObject["Topup"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -393,7 +392,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/_transfer.py b/stripe/_transfer.py index 222d59d72..f691fd9a3 100644 --- a/stripe/_transfer.py +++ b/stripe/_transfer.py @@ -319,7 +319,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -340,7 +339,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -453,7 +451,7 @@ def retrieve_reversal( cls, transfer: str, id: str, - **params: Unpack["Transfer.RetrieveReversalParams"] + **params: Unpack["Transfer.RetrieveReversalParams"], ) -> "Reversal": """ By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a specific reversal stored on the transfer. @@ -474,7 +472,7 @@ async def retrieve_reversal_async( cls, transfer: str, id: str, - **params: Unpack["Transfer.RetrieveReversalParams"] + **params: Unpack["Transfer.RetrieveReversalParams"], ) -> "Reversal": """ By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a specific reversal stored on the transfer. @@ -495,7 +493,7 @@ def modify_reversal( cls, transfer: str, id: str, - **params: Unpack["Transfer.ModifyReversalParams"] + **params: Unpack["Transfer.ModifyReversalParams"], ) -> "Reversal": """ Updates the specified reversal by setting the values of the parameters passed. Any parameters not provided will be left unchanged. @@ -518,7 +516,7 @@ async def modify_reversal_async( cls, transfer: str, id: str, - **params: Unpack["Transfer.ModifyReversalParams"] + **params: Unpack["Transfer.ModifyReversalParams"], ) -> "Reversal": """ Updates the specified reversal by setting the values of the parameters passed. Any parameters not provided will be left unchanged. diff --git a/stripe/_usage_record_summary.py b/stripe/_usage_record_summary.py index 0e450a682..fa46e82e3 100644 --- a/stripe/_usage_record_summary.py +++ b/stripe/_usage_record_summary.py @@ -6,9 +6,9 @@ class UsageRecordSummary(StripeObject): - OBJECT_NAME: ClassVar[ - Literal["usage_record_summary"] - ] = "usage_record_summary" + OBJECT_NAME: ClassVar[Literal["usage_record_summary"]] = ( + "usage_record_summary" + ) class Period(StripeObject): end: Optional[int] diff --git a/stripe/_util.py b/stripe/_util.py index 04b971508..4a05819d9 100644 --- a/stripe/_util.py +++ b/stripe/_util.py @@ -212,8 +212,7 @@ def convert_to_stripe_object( klass_: Optional[Type["StripeObject"]] = None, *, api_mode: ApiMode = "V1", -) -> "StripeObject": - ... +) -> "StripeObject": ... @overload @@ -226,8 +225,7 @@ def convert_to_stripe_object( klass_: Optional[Type["StripeObject"]] = None, *, api_mode: ApiMode = "V1", -) -> List["StripeObject"]: - ... +) -> List["StripeObject"]: ... def convert_to_stripe_object( @@ -263,8 +261,7 @@ def _convert_to_stripe_object( klass_: Optional[Type["StripeObject"]] = None, requestor: "_APIRequestor", api_mode: ApiMode, -) -> "StripeObject": - ... +) -> "StripeObject": ... @overload @@ -275,8 +272,7 @@ def _convert_to_stripe_object( klass_: Optional[Type["StripeObject"]] = None, requestor: "_APIRequestor", api_mode: ApiMode, -) -> List["StripeObject"]: - ... +) -> List["StripeObject"]: ... def _convert_to_stripe_object( @@ -368,17 +364,15 @@ def convert_to_dict(obj): @overload def populate_headers( idempotency_key: str, -) -> Dict[str, str]: - ... +) -> Dict[str, str]: ... @overload -def populate_headers(idempotency_key: None) -> None: - ... +def populate_headers(idempotency_key: None) -> None: ... def populate_headers( - idempotency_key: Union[str, None] + idempotency_key: Union[str, None], ) -> Union[Dict[str, str], None]: if idempotency_key is not None: return {"Idempotency-Key": idempotency_key} diff --git a/stripe/_verify_mixin.py b/stripe/_verify_mixin.py index 870eff351..bf779c617 100644 --- a/stripe/_verify_mixin.py +++ b/stripe/_verify_mixin.py @@ -5,16 +5,14 @@ class _Verifiable(Protocol): - def instance_url(self) -> str: - ... + def instance_url(self) -> str: ... def _request( self, method: str, url: str, params: Dict[str, Any], - ) -> StripeObject: - ... + ) -> StripeObject: ... class VerifyMixin(object): diff --git a/stripe/_webhook_endpoint.py b/stripe/_webhook_endpoint.py index bf0c60c77..eaf49351a 100644 --- a/stripe/_webhook_endpoint.py +++ b/stripe/_webhook_endpoint.py @@ -938,7 +938,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -959,7 +958,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/app_info.py b/stripe/app_info.py index 44b9fe99d..b4be7cadc 100644 --- a/stripe/app_info.py +++ b/stripe/app_info.py @@ -7,6 +7,7 @@ To: from stripe import AppInfo """ + from typing_extensions import TYPE_CHECKING # No deprecation warning is raised here, because it would happen diff --git a/stripe/apps/_secret.py b/stripe/apps/_secret.py index 39f7ef8e2..f79259ba8 100644 --- a/stripe/apps/_secret.py +++ b/stripe/apps/_secret.py @@ -285,7 +285,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -306,7 +305,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/billing/_meter.py b/stripe/billing/_meter.py index a6d0221b6..084c06e2a 100644 --- a/stripe/billing/_meter.py +++ b/stripe/billing/_meter.py @@ -389,7 +389,6 @@ def list(cls, **params: Unpack["Meter.ListParams"]) -> ListObject["Meter"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -410,7 +409,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/billing/_meter_event.py b/stripe/billing/_meter_event.py index aa247a91a..46fc203e6 100644 --- a/stripe/billing/_meter_event.py +++ b/stripe/billing/_meter_event.py @@ -12,9 +12,9 @@ class MeterEvent(CreateableAPIResource["MeterEvent"]): Meter events are associated with billing meters, which define the shape of the event's payload and how those events are aggregated for billing. """ - OBJECT_NAME: ClassVar[ - Literal["billing.meter_event"] - ] = "billing.meter_event" + OBJECT_NAME: ClassVar[Literal["billing.meter_event"]] = ( + "billing.meter_event" + ) class CreateParams(RequestOptions): event_name: str diff --git a/stripe/billing/_meter_event_adjustment.py b/stripe/billing/_meter_event_adjustment.py index a1199b996..23f7ab0ac 100644 --- a/stripe/billing/_meter_event_adjustment.py +++ b/stripe/billing/_meter_event_adjustment.py @@ -12,9 +12,9 @@ class MeterEventAdjustment(CreateableAPIResource["MeterEventAdjustment"]): A billing meter event adjustment is a resource that allows you to cancel a meter event. For example, you might create a billing meter event adjustment to cancel a meter event that was created in error or attached to the wrong customer. """ - OBJECT_NAME: ClassVar[ - Literal["billing.meter_event_adjustment"] - ] = "billing.meter_event_adjustment" + OBJECT_NAME: ClassVar[Literal["billing.meter_event_adjustment"]] = ( + "billing.meter_event_adjustment" + ) class Cancel(StripeObject): identifier: Optional[str] diff --git a/stripe/billing/_meter_event_summary.py b/stripe/billing/_meter_event_summary.py index 5b6fc0700..a6b1e23fc 100644 --- a/stripe/billing/_meter_event_summary.py +++ b/stripe/billing/_meter_event_summary.py @@ -11,9 +11,9 @@ class MeterEventSummary(StripeObject): usage was accrued by a customer for that period. """ - OBJECT_NAME: ClassVar[ - Literal["billing.meter_event_summary"] - ] = "billing.meter_event_summary" + OBJECT_NAME: ClassVar[Literal["billing.meter_event_summary"]] = ( + "billing.meter_event_summary" + ) aggregated_value: float """ Aggregated value of all the events within `start_time` (inclusive) and `end_time` (inclusive). The aggregation strategy is defined on meter via `default_aggregation`. diff --git a/stripe/billing_portal/_configuration.py b/stripe/billing_portal/_configuration.py index 39e28a3e6..90bc5fbd2 100644 --- a/stripe/billing_portal/_configuration.py +++ b/stripe/billing_portal/_configuration.py @@ -30,9 +30,9 @@ class Configuration( A portal configuration describes the functionality and behavior of a portal session. """ - OBJECT_NAME: ClassVar[ - Literal["billing_portal.configuration"] - ] = "billing_portal.configuration" + OBJECT_NAME: ClassVar[Literal["billing_portal.configuration"]] = ( + "billing_portal.configuration" + ) class BusinessProfile(StripeObject): headline: Optional[str] @@ -656,7 +656,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -677,7 +676,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/billing_portal/_session.py b/stripe/billing_portal/_session.py index 12cacac9d..608d06d04 100644 --- a/stripe/billing_portal/_session.py +++ b/stripe/billing_portal/_session.py @@ -35,9 +35,9 @@ class Session(CreateableAPIResource["Session"]): Learn more in the [integration guide](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal). """ - OBJECT_NAME: ClassVar[ - Literal["billing_portal.session"] - ] = "billing_portal.session" + OBJECT_NAME: ClassVar[Literal["billing_portal.session"]] = ( + "billing_portal.session" + ) class Flow(StripeObject): class AfterCompletion(StripeObject): diff --git a/stripe/capital/_financing_offer.py b/stripe/capital/_financing_offer.py index 98deb5eaf..a97807b27 100644 --- a/stripe/capital/_financing_offer.py +++ b/stripe/capital/_financing_offer.py @@ -15,9 +15,9 @@ class FinancingOffer(ListableAPIResource["FinancingOffer"]): Stripe Capital to a Connect subaccount. """ - OBJECT_NAME: ClassVar[ - Literal["capital.financing_offer"] - ] = "capital.financing_offer" + OBJECT_NAME: ClassVar[Literal["capital.financing_offer"]] = ( + "capital.financing_offer" + ) class AcceptedTerms(StripeObject): advance_amount: int @@ -240,7 +240,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -261,7 +260,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -273,7 +271,7 @@ async def list_async( def _cls_mark_delivered( cls, financing_offer: str, - **params: Unpack["FinancingOffer.MarkDeliveredParams"] + **params: Unpack["FinancingOffer.MarkDeliveredParams"], ) -> "FinancingOffer": """ Acknowledges that platform has received and delivered the financing_offer to @@ -294,7 +292,7 @@ def _cls_mark_delivered( @staticmethod def mark_delivered( financing_offer: str, - **params: Unpack["FinancingOffer.MarkDeliveredParams"] + **params: Unpack["FinancingOffer.MarkDeliveredParams"], ) -> "FinancingOffer": """ Acknowledges that platform has received and delivered the financing_offer to @@ -335,7 +333,7 @@ def mark_delivered( # pyright: ignore[reportGeneralTypeIssues] async def _cls_mark_delivered_async( cls, financing_offer: str, - **params: Unpack["FinancingOffer.MarkDeliveredParams"] + **params: Unpack["FinancingOffer.MarkDeliveredParams"], ) -> "FinancingOffer": """ Acknowledges that platform has received and delivered the financing_offer to @@ -356,7 +354,7 @@ async def _cls_mark_delivered_async( @staticmethod async def mark_delivered_async( financing_offer: str, - **params: Unpack["FinancingOffer.MarkDeliveredParams"] + **params: Unpack["FinancingOffer.MarkDeliveredParams"], ) -> "FinancingOffer": """ Acknowledges that platform has received and delivered the financing_offer to diff --git a/stripe/capital/_financing_summary.py b/stripe/capital/_financing_summary.py index cd0da89a0..1c720017a 100644 --- a/stripe/capital/_financing_summary.py +++ b/stripe/capital/_financing_summary.py @@ -13,9 +13,9 @@ class FinancingSummary(SingletonAPIResource["FinancingSummary"]): platforms to read the state of Capital offered to their connected accounts. """ - OBJECT_NAME: ClassVar[ - Literal["capital.financing_summary"] - ] = "capital.financing_summary" + OBJECT_NAME: ClassVar[Literal["capital.financing_summary"]] = ( + "capital.financing_summary" + ) class Details(StripeObject): class CurrentRepaymentInterval(StripeObject): diff --git a/stripe/capital/_financing_transaction.py b/stripe/capital/_financing_transaction.py index 16b048807..d28a26098 100644 --- a/stripe/capital/_financing_transaction.py +++ b/stripe/capital/_financing_transaction.py @@ -13,9 +13,9 @@ class FinancingTransaction(ListableAPIResource["FinancingTransaction"]): This is an object representing the details of a transaction on a Capital financing object. """ - OBJECT_NAME: ClassVar[ - Literal["capital.financing_transaction"] - ] = "capital.financing_transaction" + OBJECT_NAME: ClassVar[Literal["capital.financing_transaction"]] = ( + "capital.financing_transaction" + ) class Details(StripeObject): class Transaction(StripeObject): @@ -171,7 +171,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -193,7 +192,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/checkout/_session.py b/stripe/checkout/_session.py index 8581d58cf..ec572cb1c 100644 --- a/stripe/checkout/_session.py +++ b/stripe/checkout/_session.py @@ -3642,7 +3642,9 @@ class CreateParamsSubscriptionDataTransferData(TypedDict): """ class CreateParamsSubscriptionDataTrialSettings(TypedDict): - end_behavior: "Session.CreateParamsSubscriptionDataTrialSettingsEndBehavior" + end_behavior: ( + "Session.CreateParamsSubscriptionDataTrialSettingsEndBehavior" + ) """ Defines how the subscription should behave when the user's free trial ends. """ @@ -4197,7 +4199,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -4218,7 +4219,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/climate/_order.py b/stripe/climate/_order.py index 1fdf62de0..1a51fc668 100644 --- a/stripe/climate/_order.py +++ b/stripe/climate/_order.py @@ -435,7 +435,6 @@ def list(cls, **params: Unpack["Order.ListParams"]) -> ListObject["Order"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -457,7 +456,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/climate/_product.py b/stripe/climate/_product.py index 8117c7aa5..fbe5c4d16 100644 --- a/stripe/climate/_product.py +++ b/stripe/climate/_product.py @@ -109,7 +109,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -130,7 +129,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/climate/_supplier.py b/stripe/climate/_supplier.py index 9b4c61f0f..78b76bbc0 100644 --- a/stripe/climate/_supplier.py +++ b/stripe/climate/_supplier.py @@ -107,7 +107,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -128,7 +127,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/entitlements/_active_entitlement.py b/stripe/entitlements/_active_entitlement.py index 7fa4f76f8..51d324d5c 100644 --- a/stripe/entitlements/_active_entitlement.py +++ b/stripe/entitlements/_active_entitlement.py @@ -16,9 +16,9 @@ class ActiveEntitlement(ListableAPIResource["ActiveEntitlement"]): An active entitlement describes access to a feature for a customer. """ - OBJECT_NAME: ClassVar[ - Literal["entitlements.active_entitlement"] - ] = "entitlements.active_entitlement" + OBJECT_NAME: ClassVar[Literal["entitlements.active_entitlement"]] = ( + "entitlements.active_entitlement" + ) class ListParams(RequestOptions): customer: str @@ -82,7 +82,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -103,7 +102,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/entitlements/_feature.py b/stripe/entitlements/_feature.py index 3c6249681..99162f70a 100644 --- a/stripe/entitlements/_feature.py +++ b/stripe/entitlements/_feature.py @@ -20,9 +20,9 @@ class Feature( Features can be assigned to products, and when those products are purchased, Stripe will create an entitlement to the feature for the purchasing customer. """ - OBJECT_NAME: ClassVar[ - Literal["entitlements.feature"] - ] = "entitlements.feature" + OBJECT_NAME: ClassVar[Literal["entitlements.feature"]] = ( + "entitlements.feature" + ) class CreateParams(RequestOptions): expand: NotRequired[List[str]] @@ -156,7 +156,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -177,7 +176,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/financial_connections/_account.py b/stripe/financial_connections/_account.py index 32470e2b4..f292a278a 100644 --- a/stripe/financial_connections/_account.py +++ b/stripe/financial_connections/_account.py @@ -34,9 +34,9 @@ class Account(ListableAPIResource["Account"]): A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access. """ - OBJECT_NAME: ClassVar[ - Literal["financial_connections.account"] - ] = "financial_connections.account" + OBJECT_NAME: ClassVar[Literal["financial_connections.account"]] = ( + "financial_connections.account" + ) class AccountHolder(StripeObject): account: Optional[ExpandableField["AccountResource"]] @@ -503,7 +503,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -524,7 +523,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -998,7 +996,7 @@ async def unsubscribe_async( # pyright: ignore[reportGeneralTypeIssues] def list_inferred_balances( cls, account: str, - **params: Unpack["Account.ListInferredBalancesParams"] + **params: Unpack["Account.ListInferredBalancesParams"], ) -> ListObject["AccountInferredBalance"]: """ Lists the recorded inferred balances for a Financial Connections Account. @@ -1018,7 +1016,7 @@ def list_inferred_balances( async def list_inferred_balances_async( cls, account: str, - **params: Unpack["Account.ListInferredBalancesParams"] + **params: Unpack["Account.ListInferredBalancesParams"], ) -> ListObject["AccountInferredBalance"]: """ Lists the recorded inferred balances for a Financial Connections Account. diff --git a/stripe/financial_connections/_account_owner.py b/stripe/financial_connections/_account_owner.py index bada8d828..86e2a5c87 100644 --- a/stripe/financial_connections/_account_owner.py +++ b/stripe/financial_connections/_account_owner.py @@ -10,9 +10,9 @@ class AccountOwner(StripeObject): Describes an owner of an account. """ - OBJECT_NAME: ClassVar[ - Literal["financial_connections.account_owner"] - ] = "financial_connections.account_owner" + OBJECT_NAME: ClassVar[Literal["financial_connections.account_owner"]] = ( + "financial_connections.account_owner" + ) email: Optional[str] """ The email address of the owner. diff --git a/stripe/financial_connections/_session.py b/stripe/financial_connections/_session.py index 7c64c79c9..c5ff98361 100644 --- a/stripe/financial_connections/_session.py +++ b/stripe/financial_connections/_session.py @@ -27,9 +27,9 @@ class Session(CreateableAPIResource["Session"]): A Financial Connections Session is the secure way to programmatically launch the client-side Stripe.js modal that lets your users link their accounts. """ - OBJECT_NAME: ClassVar[ - Literal["financial_connections.session"] - ] = "financial_connections.session" + OBJECT_NAME: ClassVar[Literal["financial_connections.session"]] = ( + "financial_connections.session" + ) class AccountHolder(StripeObject): account: Optional[ExpandableField["AccountResource"]] diff --git a/stripe/financial_connections/_transaction.py b/stripe/financial_connections/_transaction.py index 70b6ce9bb..1874a2b52 100644 --- a/stripe/financial_connections/_transaction.py +++ b/stripe/financial_connections/_transaction.py @@ -13,9 +13,9 @@ class Transaction(ListableAPIResource["Transaction"]): A Transaction represents a real transaction that affects a Financial Connections Account balance. """ - OBJECT_NAME: ClassVar[ - Literal["financial_connections.transaction"] - ] = "financial_connections.transaction" + OBJECT_NAME: ClassVar[Literal["financial_connections.transaction"]] = ( + "financial_connections.transaction" + ) class StatusTransitions(StripeObject): posted_at: Optional[int] @@ -148,7 +148,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -169,7 +168,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/forwarding/_request.py b/stripe/forwarding/_request.py index 084c647cb..f371f380c 100644 --- a/stripe/forwarding/_request.py +++ b/stripe/forwarding/_request.py @@ -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__) @@ -292,7 +291,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/gift_cards/_card.py b/stripe/gift_cards/_card.py index 2af9ac9f8..c97d013d9 100644 --- a/stripe/gift_cards/_card.py +++ b/stripe/gift_cards/_card.py @@ -252,7 +252,6 @@ def list(cls, **params: Unpack["Card.ListParams"]) -> ListObject["Card"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -273,7 +272,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/gift_cards/_transaction.py b/stripe/gift_cards/_transaction.py index 14986cde7..1e1bf8a2b 100644 --- a/stripe/gift_cards/_transaction.py +++ b/stripe/gift_cards/_transaction.py @@ -25,9 +25,9 @@ class Transaction( A `canceled` transaction has no effect on a gift card's balance. """ - OBJECT_NAME: ClassVar[ - Literal["gift_cards.transaction"] - ] = "gift_cards.transaction" + OBJECT_NAME: ClassVar[Literal["gift_cards.transaction"]] = ( + "gift_cards.transaction" + ) class CreatedBy(StripeObject): class Checkout(StripeObject): @@ -495,7 +495,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -516,7 +515,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/identity/_verification_report.py b/stripe/identity/_verification_report.py index 0bbf39b37..a8e721ac7 100644 --- a/stripe/identity/_verification_report.py +++ b/stripe/identity/_verification_report.py @@ -23,9 +23,9 @@ class VerificationReport(ListableAPIResource["VerificationReport"]): Related guides: [Accessing verification results](https://stripe.com/docs/identity/verification-sessions#results). """ - OBJECT_NAME: ClassVar[ - Literal["identity.verification_report"] - ] = "identity.verification_report" + OBJECT_NAME: ClassVar[Literal["identity.verification_report"]] = ( + "identity.verification_report" + ) class Document(StripeObject): class Address(StripeObject): @@ -476,7 +476,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -497,7 +496,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/identity/_verification_session.py b/stripe/identity/_verification_session.py index 333126995..277141df8 100644 --- a/stripe/identity/_verification_session.py +++ b/stripe/identity/_verification_session.py @@ -40,9 +40,9 @@ class VerificationSession( Related guide: [The Verification Sessions API](https://stripe.com/docs/identity/verification-sessions) """ - OBJECT_NAME: ClassVar[ - Literal["identity.verification_session"] - ] = "identity.verification_session" + OBJECT_NAME: ClassVar[Literal["identity.verification_session"]] = ( + "identity.verification_session" + ) class LastError(StripeObject): code: Optional[ @@ -670,7 +670,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -691,7 +690,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/issuing/_authorization.py b/stripe/issuing/_authorization.py index 529120e10..1ad54228d 100644 --- a/stripe/issuing/_authorization.py +++ b/stripe/issuing/_authorization.py @@ -38,9 +38,9 @@ class Authorization( Related guide: [Issued card authorizations](https://stripe.com/docs/issuing/purchases/authorizations) """ - OBJECT_NAME: ClassVar[ - Literal["issuing.authorization"] - ] = "issuing.authorization" + OBJECT_NAME: ClassVar[Literal["issuing.authorization"]] = ( + "issuing.authorization" + ) class AmountDetails(StripeObject): atm_fee: Optional[int] @@ -1109,7 +1109,7 @@ class ReverseParams(RequestOptions): def _cls_approve( cls, authorization: str, - **params: Unpack["Authorization.ApproveParams"] + **params: Unpack["Authorization.ApproveParams"], ) -> "Authorization": """ [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. @@ -1170,7 +1170,7 @@ def approve( # pyright: ignore[reportGeneralTypeIssues] async def _cls_approve_async( cls, authorization: str, - **params: Unpack["Authorization.ApproveParams"] + **params: Unpack["Authorization.ApproveParams"], ) -> "Authorization": """ [Deprecated] Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. @@ -1231,7 +1231,7 @@ async def approve_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_decline( cls, authorization: str, - **params: Unpack["Authorization.DeclineParams"] + **params: Unpack["Authorization.DeclineParams"], ) -> "Authorization": """ [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. @@ -1292,7 +1292,7 @@ def decline( # pyright: ignore[reportGeneralTypeIssues] async def _cls_decline_async( cls, authorization: str, - **params: Unpack["Authorization.DeclineParams"] + **params: Unpack["Authorization.DeclineParams"], ) -> "Authorization": """ [Deprecated] Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. @@ -1362,7 +1362,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1383,7 +1382,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1454,7 +1452,7 @@ class TestHelpers(APIResourceTestHelpers["Authorization"]): def _cls_capture( cls, authorization: str, - **params: Unpack["Authorization.CaptureParams"] + **params: Unpack["Authorization.CaptureParams"], ) -> "Authorization": """ Capture a test-mode authorization. @@ -1511,7 +1509,7 @@ def capture( # pyright: ignore[reportGeneralTypeIssues] async def _cls_capture_async( cls, authorization: str, - **params: Unpack["Authorization.CaptureParams"] + **params: Unpack["Authorization.CaptureParams"], ) -> "Authorization": """ Capture a test-mode authorization. @@ -1600,7 +1598,7 @@ async def create_async( def _cls_expire( cls, authorization: str, - **params: Unpack["Authorization.ExpireParams"] + **params: Unpack["Authorization.ExpireParams"], ) -> "Authorization": """ Expire a test-mode Authorization. @@ -1657,7 +1655,7 @@ def expire( # pyright: ignore[reportGeneralTypeIssues] async def _cls_expire_async( cls, authorization: str, - **params: Unpack["Authorization.ExpireParams"] + **params: Unpack["Authorization.ExpireParams"], ) -> "Authorization": """ Expire a test-mode Authorization. @@ -1714,7 +1712,7 @@ async def expire_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_increment( cls, authorization: str, - **params: Unpack["Authorization.IncrementParams"] + **params: Unpack["Authorization.IncrementParams"], ) -> "Authorization": """ Increment a test-mode Authorization. @@ -1734,7 +1732,7 @@ def _cls_increment( @staticmethod def increment( authorization: str, - **params: Unpack["Authorization.IncrementParams"] + **params: Unpack["Authorization.IncrementParams"], ) -> "Authorization": """ Increment a test-mode Authorization. @@ -1772,7 +1770,7 @@ def increment( # pyright: ignore[reportGeneralTypeIssues] async def _cls_increment_async( cls, authorization: str, - **params: Unpack["Authorization.IncrementParams"] + **params: Unpack["Authorization.IncrementParams"], ) -> "Authorization": """ Increment a test-mode Authorization. @@ -1792,7 +1790,7 @@ async def _cls_increment_async( @staticmethod async def increment_async( authorization: str, - **params: Unpack["Authorization.IncrementParams"] + **params: Unpack["Authorization.IncrementParams"], ) -> "Authorization": """ Increment a test-mode Authorization. @@ -1830,7 +1828,7 @@ async def increment_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_reverse( cls, authorization: str, - **params: Unpack["Authorization.ReverseParams"] + **params: Unpack["Authorization.ReverseParams"], ) -> "Authorization": """ Reverse a test-mode Authorization. @@ -1887,7 +1885,7 @@ def reverse( # pyright: ignore[reportGeneralTypeIssues] async def _cls_reverse_async( cls, authorization: str, - **params: Unpack["Authorization.ReverseParams"] + **params: Unpack["Authorization.ReverseParams"], ) -> "Authorization": """ Reverse a test-mode Authorization. diff --git a/stripe/issuing/_card.py b/stripe/issuing/_card.py index be6af8d9e..f4c190958 100644 --- a/stripe/issuing/_card.py +++ b/stripe/issuing/_card.py @@ -3548,7 +3548,6 @@ def list(cls, **params: Unpack["Card.ListParams"]) -> ListObject["Card"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -3569,7 +3568,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/issuing/_cardholder.py b/stripe/issuing/_cardholder.py index 9c566319e..7c700b666 100644 --- a/stripe/issuing/_cardholder.py +++ b/stripe/issuing/_cardholder.py @@ -3532,7 +3532,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -3553,7 +3552,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/issuing/_credit_underwriting_record.py b/stripe/issuing/_credit_underwriting_record.py index 51987a218..16a6aa043 100644 --- a/stripe/issuing/_credit_underwriting_record.py +++ b/stripe/issuing/_credit_underwriting_record.py @@ -18,9 +18,9 @@ class CreditUnderwritingRecord( [Follow the guide](https://stripe.com/docs/issuing/credit/report-credit-decisions-and-manage-aans) to learn about your requirements as a platform. """ - OBJECT_NAME: ClassVar[ - Literal["issuing.credit_underwriting_record"] - ] = "issuing.credit_underwriting_record" + OBJECT_NAME: ClassVar[Literal["issuing.credit_underwriting_record"]] = ( + "issuing.credit_underwriting_record" + ) class Application(StripeObject): application_method: Literal["in_person", "mail", "online", "phone"] @@ -743,11 +743,15 @@ class CorrectParamsUnderwritingException(TypedDict): """ class CreateFromApplicationParams(RequestOptions): - application: "CreditUnderwritingRecord.CreateFromApplicationParamsApplication" + application: ( + "CreditUnderwritingRecord.CreateFromApplicationParamsApplication" + ) """ Details about the application submission. """ - credit_user: "CreditUnderwritingRecord.CreateFromApplicationParamsCreditUser" + credit_user: ( + "CreditUnderwritingRecord.CreateFromApplicationParamsCreditUser" + ) """ Information about the company or person applying or holding the account. """ @@ -795,7 +799,9 @@ class CreateFromProactiveReviewParams(RequestOptions): """ Date when a decision was made. """ - decision: "CreditUnderwritingRecord.CreateFromProactiveReviewParamsDecision" + decision: ( + "CreditUnderwritingRecord.CreateFromProactiveReviewParamsDecision" + ) """ Details about the decision. """ @@ -1286,7 +1292,7 @@ class RetrieveParams(RequestOptions): def _cls_correct( cls, credit_underwriting_record: str, - **params: Unpack["CreditUnderwritingRecord.CorrectParams"] + **params: Unpack["CreditUnderwritingRecord.CorrectParams"], ) -> "CreditUnderwritingRecord": """ Update a CreditUnderwritingRecord object to correct mistakes. @@ -1308,7 +1314,7 @@ def _cls_correct( @staticmethod def correct( credit_underwriting_record: str, - **params: Unpack["CreditUnderwritingRecord.CorrectParams"] + **params: Unpack["CreditUnderwritingRecord.CorrectParams"], ) -> "CreditUnderwritingRecord": """ Update a CreditUnderwritingRecord object to correct mistakes. @@ -1346,7 +1352,7 @@ def correct( # pyright: ignore[reportGeneralTypeIssues] async def _cls_correct_async( cls, credit_underwriting_record: str, - **params: Unpack["CreditUnderwritingRecord.CorrectParams"] + **params: Unpack["CreditUnderwritingRecord.CorrectParams"], ) -> "CreditUnderwritingRecord": """ Update a CreditUnderwritingRecord object to correct mistakes. @@ -1368,7 +1374,7 @@ async def _cls_correct_async( @staticmethod async def correct_async( credit_underwriting_record: str, - **params: Unpack["CreditUnderwritingRecord.CorrectParams"] + **params: Unpack["CreditUnderwritingRecord.CorrectParams"], ) -> "CreditUnderwritingRecord": """ Update a CreditUnderwritingRecord object to correct mistakes. @@ -1407,7 +1413,7 @@ def create_from_application( cls, **params: Unpack[ "CreditUnderwritingRecord.CreateFromApplicationParams" - ] + ], ) -> "CreditUnderwritingRecord": """ Creates a CreditUnderwritingRecord object with information about a credit application submission. @@ -1426,7 +1432,7 @@ async def create_from_application_async( cls, **params: Unpack[ "CreditUnderwritingRecord.CreateFromApplicationParams" - ] + ], ) -> "CreditUnderwritingRecord": """ Creates a CreditUnderwritingRecord object with information about a credit application submission. @@ -1445,7 +1451,7 @@ def create_from_proactive_review( cls, **params: Unpack[ "CreditUnderwritingRecord.CreateFromProactiveReviewParams" - ] + ], ) -> "CreditUnderwritingRecord": """ Creates a CreditUnderwritingRecord object from an underwriting decision coming from a proactive review of an existing accountholder. @@ -1464,7 +1470,7 @@ async def create_from_proactive_review_async( cls, **params: Unpack[ "CreditUnderwritingRecord.CreateFromProactiveReviewParams" - ] + ], ) -> "CreditUnderwritingRecord": """ Creates a CreditUnderwritingRecord object from an underwriting decision coming from a proactive review of an existing accountholder. @@ -1491,7 +1497,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1512,7 +1517,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1524,7 +1528,7 @@ async def list_async( def _cls_report_decision( cls, credit_underwriting_record: str, - **params: Unpack["CreditUnderwritingRecord.ReportDecisionParams"] + **params: Unpack["CreditUnderwritingRecord.ReportDecisionParams"], ) -> "CreditUnderwritingRecord": """ Update a CreditUnderwritingRecord object from a decision made on a credit application. @@ -1546,7 +1550,7 @@ def _cls_report_decision( @staticmethod def report_decision( credit_underwriting_record: str, - **params: Unpack["CreditUnderwritingRecord.ReportDecisionParams"] + **params: Unpack["CreditUnderwritingRecord.ReportDecisionParams"], ) -> "CreditUnderwritingRecord": """ Update a CreditUnderwritingRecord object from a decision made on a credit application. @@ -1584,7 +1588,7 @@ def report_decision( # pyright: ignore[reportGeneralTypeIssues] async def _cls_report_decision_async( cls, credit_underwriting_record: str, - **params: Unpack["CreditUnderwritingRecord.ReportDecisionParams"] + **params: Unpack["CreditUnderwritingRecord.ReportDecisionParams"], ) -> "CreditUnderwritingRecord": """ Update a CreditUnderwritingRecord object from a decision made on a credit application. @@ -1606,7 +1610,7 @@ async def _cls_report_decision_async( @staticmethod async def report_decision_async( credit_underwriting_record: str, - **params: Unpack["CreditUnderwritingRecord.ReportDecisionParams"] + **params: Unpack["CreditUnderwritingRecord.ReportDecisionParams"], ) -> "CreditUnderwritingRecord": """ Update a CreditUnderwritingRecord object from a decision made on a credit application. @@ -1644,7 +1648,7 @@ async def report_decision_async( # pyright: ignore[reportGeneralTypeIssues] def retrieve( cls, id: str, - **params: Unpack["CreditUnderwritingRecord.RetrieveParams"] + **params: Unpack["CreditUnderwritingRecord.RetrieveParams"], ) -> "CreditUnderwritingRecord": """ Retrieves a CreditUnderwritingRecord object. @@ -1657,7 +1661,7 @@ def retrieve( async def retrieve_async( cls, id: str, - **params: Unpack["CreditUnderwritingRecord.RetrieveParams"] + **params: Unpack["CreditUnderwritingRecord.RetrieveParams"], ) -> "CreditUnderwritingRecord": """ Retrieves a CreditUnderwritingRecord object. diff --git a/stripe/issuing/_credit_underwriting_record_service.py b/stripe/issuing/_credit_underwriting_record_service.py index aff6f97f1..1f84297a4 100644 --- a/stripe/issuing/_credit_underwriting_record_service.py +++ b/stripe/issuing/_credit_underwriting_record_service.py @@ -734,7 +734,9 @@ class ReportDecisionParams(TypedDict): """ Date when a decision was made. """ - decision: "CreditUnderwritingRecordService.ReportDecisionParamsDecision" + decision: ( + "CreditUnderwritingRecordService.ReportDecisionParamsDecision" + ) """ Details about the decision. """ diff --git a/stripe/issuing/_dispute.py b/stripe/issuing/_dispute.py index 32c735376..9102bcf07 100644 --- a/stripe/issuing/_dispute.py +++ b/stripe/issuing/_dispute.py @@ -911,7 +911,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -932,7 +931,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/issuing/_personalization_design.py b/stripe/issuing/_personalization_design.py index 16b2aaa9d..c8520e8ee 100644 --- a/stripe/issuing/_personalization_design.py +++ b/stripe/issuing/_personalization_design.py @@ -33,9 +33,9 @@ class PersonalizationDesign( A Personalization Design is a logical grouping of a Physical Bundle, card logo, and carrier text that represents a product line. """ - OBJECT_NAME: ClassVar[ - Literal["issuing.personalization_design"] - ] = "issuing.personalization_design" + OBJECT_NAME: ClassVar[Literal["issuing.personalization_design"]] = ( + "issuing.personalization_design" + ) class CarrierText(StripeObject): footer_body: Optional[str] @@ -429,7 +429,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -450,7 +449,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -521,7 +519,7 @@ class TestHelpers(APIResourceTestHelpers["PersonalizationDesign"]): def _cls_activate( cls, personalization_design: str, - **params: Unpack["PersonalizationDesign.ActivateParams"] + **params: Unpack["PersonalizationDesign.ActivateParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to active. @@ -543,7 +541,7 @@ def _cls_activate( @staticmethod def activate( personalization_design: str, - **params: Unpack["PersonalizationDesign.ActivateParams"] + **params: Unpack["PersonalizationDesign.ActivateParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to active. @@ -583,7 +581,7 @@ def activate( # pyright: ignore[reportGeneralTypeIssues] async def _cls_activate_async( cls, personalization_design: str, - **params: Unpack["PersonalizationDesign.ActivateParams"] + **params: Unpack["PersonalizationDesign.ActivateParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to active. @@ -605,7 +603,7 @@ async def _cls_activate_async( @staticmethod async def activate_async( personalization_design: str, - **params: Unpack["PersonalizationDesign.ActivateParams"] + **params: Unpack["PersonalizationDesign.ActivateParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to active. @@ -645,7 +643,7 @@ async def activate_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_deactivate( cls, personalization_design: str, - **params: Unpack["PersonalizationDesign.DeactivateParams"] + **params: Unpack["PersonalizationDesign.DeactivateParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to inactive. @@ -667,7 +665,7 @@ def _cls_deactivate( @staticmethod def deactivate( personalization_design: str, - **params: Unpack["PersonalizationDesign.DeactivateParams"] + **params: Unpack["PersonalizationDesign.DeactivateParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to inactive. @@ -707,7 +705,7 @@ def deactivate( # pyright: ignore[reportGeneralTypeIssues] async def _cls_deactivate_async( cls, personalization_design: str, - **params: Unpack["PersonalizationDesign.DeactivateParams"] + **params: Unpack["PersonalizationDesign.DeactivateParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to inactive. @@ -729,7 +727,7 @@ async def _cls_deactivate_async( @staticmethod async def deactivate_async( personalization_design: str, - **params: Unpack["PersonalizationDesign.DeactivateParams"] + **params: Unpack["PersonalizationDesign.DeactivateParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to inactive. @@ -769,7 +767,7 @@ async def deactivate_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_reject( cls, personalization_design: str, - **params: Unpack["PersonalizationDesign.RejectParams"] + **params: Unpack["PersonalizationDesign.RejectParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to rejected. @@ -791,7 +789,7 @@ def _cls_reject( @staticmethod def reject( personalization_design: str, - **params: Unpack["PersonalizationDesign.RejectParams"] + **params: Unpack["PersonalizationDesign.RejectParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to rejected. @@ -831,7 +829,7 @@ def reject( # pyright: ignore[reportGeneralTypeIssues] async def _cls_reject_async( cls, personalization_design: str, - **params: Unpack["PersonalizationDesign.RejectParams"] + **params: Unpack["PersonalizationDesign.RejectParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to rejected. @@ -853,7 +851,7 @@ async def _cls_reject_async( @staticmethod async def reject_async( personalization_design: str, - **params: Unpack["PersonalizationDesign.RejectParams"] + **params: Unpack["PersonalizationDesign.RejectParams"], ) -> "PersonalizationDesign": """ Updates the status of the specified testmode personalization design object to rejected. diff --git a/stripe/issuing/_physical_bundle.py b/stripe/issuing/_physical_bundle.py index c5c5d0c82..45b959c11 100644 --- a/stripe/issuing/_physical_bundle.py +++ b/stripe/issuing/_physical_bundle.py @@ -13,9 +13,9 @@ class PhysicalBundle(ListableAPIResource["PhysicalBundle"]): A Physical Bundle represents the bundle of physical items - card stock, carrier letter, and envelope - that is shipped to a cardholder when you create a physical card. """ - OBJECT_NAME: ClassVar[ - Literal["issuing.physical_bundle"] - ] = "issuing.physical_bundle" + OBJECT_NAME: ClassVar[Literal["issuing.physical_bundle"]] = ( + "issuing.physical_bundle" + ) class Features(StripeObject): card_logo: Literal["optional", "required", "unsupported"] @@ -102,7 +102,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -123,7 +122,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/issuing/_token.py b/stripe/issuing/_token.py index cd22e21f6..214976671 100644 --- a/stripe/issuing/_token.py +++ b/stripe/issuing/_token.py @@ -317,7 +317,6 @@ def list(cls, **params: Unpack["Token.ListParams"]) -> ListObject["Token"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -338,7 +337,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/issuing/_transaction.py b/stripe/issuing/_transaction.py index 8609f87de..c61ce560c 100644 --- a/stripe/issuing/_transaction.py +++ b/stripe/issuing/_transaction.py @@ -39,9 +39,9 @@ class Transaction( Related guide: [Issued card transactions](https://stripe.com/docs/issuing/purchases/transactions) """ - OBJECT_NAME: ClassVar[ - Literal["issuing.transaction"] - ] = "issuing.transaction" + OBJECT_NAME: ClassVar[Literal["issuing.transaction"]] = ( + "issuing.transaction" + ) class AmountDetails(StripeObject): atm_fee: Optional[int] @@ -1399,7 +1399,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1420,7 +1419,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/radar/_early_fraud_warning.py b/stripe/radar/_early_fraud_warning.py index 5a6c54658..77d1ab156 100644 --- a/stripe/radar/_early_fraud_warning.py +++ b/stripe/radar/_early_fraud_warning.py @@ -26,9 +26,9 @@ class EarlyFraudWarning(ListableAPIResource["EarlyFraudWarning"]): Related guide: [Early fraud warnings](https://stripe.com/docs/disputes/measuring#early-fraud-warnings) """ - OBJECT_NAME: ClassVar[ - Literal["radar.early_fraud_warning"] - ] = "radar.early_fraud_warning" + OBJECT_NAME: ClassVar[Literal["radar.early_fraud_warning"]] = ( + "radar.early_fraud_warning" + ) class ListParams(RequestOptions): charge: NotRequired[str] @@ -130,7 +130,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -151,7 +150,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/radar/_value_list.py b/stripe/radar/_value_list.py index 158494dac..c4c41f808 100644 --- a/stripe/radar/_value_list.py +++ b/stripe/radar/_value_list.py @@ -341,7 +341,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -362,7 +361,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/radar/_value_list_item.py b/stripe/radar/_value_list_item.py index b48d9d542..36c42a870 100644 --- a/stripe/radar/_value_list_item.py +++ b/stripe/radar/_value_list_item.py @@ -21,9 +21,9 @@ class ValueListItem( Related guide: [Managing list items](https://stripe.com/docs/radar/lists#managing-list-items) """ - OBJECT_NAME: ClassVar[ - Literal["radar.value_list_item"] - ] = "radar.value_list_item" + OBJECT_NAME: ClassVar[Literal["radar.value_list_item"]] = ( + "radar.value_list_item" + ) class CreateParams(RequestOptions): expand: NotRequired[List[str]] @@ -272,7 +272,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -293,7 +292,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/reporting/_report_run.py b/stripe/reporting/_report_run.py index 4ca96087c..3a610d51b 100644 --- a/stripe/reporting/_report_run.py +++ b/stripe/reporting/_report_run.py @@ -33,9 +33,9 @@ class ReportRun( data), and will error when queried without a [live-mode API key](https://stripe.com/docs/keys#test-live-modes). """ - OBJECT_NAME: ClassVar[ - Literal["reporting.report_run"] - ] = "reporting.report_run" + OBJECT_NAME: ClassVar[Literal["reporting.report_run"]] = ( + "reporting.report_run" + ) class Parameters(StripeObject): columns: Optional[List[str]] @@ -892,7 +892,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -913,7 +912,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/reporting/_report_type.py b/stripe/reporting/_report_type.py index b6e476595..af722ea57 100644 --- a/stripe/reporting/_report_type.py +++ b/stripe/reporting/_report_type.py @@ -19,9 +19,9 @@ class ReportType(ListableAPIResource["ReportType"]): data), and will error when queried without a [live-mode API key](https://stripe.com/docs/keys#test-live-modes). """ - OBJECT_NAME: ClassVar[ - Literal["reporting.report_type"] - ] = "reporting.report_type" + OBJECT_NAME: ClassVar[Literal["reporting.report_type"]] = ( + "reporting.report_type" + ) class ListParams(RequestOptions): expand: NotRequired[List[str]] @@ -85,7 +85,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -106,7 +105,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/sigma/_scheduled_query_run.py b/stripe/sigma/_scheduled_query_run.py index aef65a5d0..f3c2b855e 100644 --- a/stripe/sigma/_scheduled_query_run.py +++ b/stripe/sigma/_scheduled_query_run.py @@ -19,9 +19,9 @@ class ScheduledQueryRun(ListableAPIResource["ScheduledQueryRun"]): retrieve the query results. """ - OBJECT_NAME: ClassVar[ - Literal["scheduled_query_run"] - ] = "scheduled_query_run" + OBJECT_NAME: ClassVar[Literal["scheduled_query_run"]] = ( + "scheduled_query_run" + ) class Error(StripeObject): message: str @@ -108,7 +108,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -129,7 +128,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/tax/_calculation.py b/stripe/tax/_calculation.py index acdddf026..a91f55871 100644 --- a/stripe/tax/_calculation.py +++ b/stripe/tax/_calculation.py @@ -740,7 +740,7 @@ async def create_async( def _cls_list_line_items( cls, calculation: str, - **params: Unpack["Calculation.ListLineItemsParams"] + **params: Unpack["Calculation.ListLineItemsParams"], ) -> ListObject["CalculationLineItem"]: """ Retrieves the line items of a persisted tax calculation as a collection. @@ -797,7 +797,7 @@ def list_line_items( # pyright: ignore[reportGeneralTypeIssues] async def _cls_list_line_items_async( cls, calculation: str, - **params: Unpack["Calculation.ListLineItemsParams"] + **params: Unpack["Calculation.ListLineItemsParams"], ) -> ListObject["CalculationLineItem"]: """ Retrieves the line items of a persisted tax calculation as a collection. diff --git a/stripe/tax/_calculation_line_item.py b/stripe/tax/_calculation_line_item.py index e33257168..376dd7a36 100644 --- a/stripe/tax/_calculation_line_item.py +++ b/stripe/tax/_calculation_line_item.py @@ -6,9 +6,9 @@ class CalculationLineItem(StripeObject): - OBJECT_NAME: ClassVar[ - Literal["tax.calculation_line_item"] - ] = "tax.calculation_line_item" + OBJECT_NAME: ClassVar[Literal["tax.calculation_line_item"]] = ( + "tax.calculation_line_item" + ) class TaxBreakdown(StripeObject): class Jurisdiction(StripeObject): diff --git a/stripe/tax/_form.py b/stripe/tax/_form.py index 96e638205..e8c81dbdf 100644 --- a/stripe/tax/_form.py +++ b/stripe/tax/_form.py @@ -174,7 +174,6 @@ def list(cls, **params: Unpack["Form.ListParams"]) -> ListObject["Form"]: params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -195,7 +194,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/tax/_registration.py b/stripe/tax/_registration.py index d4e243bae..807558ad0 100644 --- a/stripe/tax/_registration.py +++ b/stripe/tax/_registration.py @@ -1805,7 +1805,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1826,7 +1825,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/tax/_transaction.py b/stripe/tax/_transaction.py index de586844c..011726e0a 100644 --- a/stripe/tax/_transaction.py +++ b/stripe/tax/_transaction.py @@ -556,7 +556,7 @@ async def create_reversal_async( def _cls_list_line_items( cls, transaction: str, - **params: Unpack["Transaction.ListLineItemsParams"] + **params: Unpack["Transaction.ListLineItemsParams"], ) -> ListObject["TransactionLineItem"]: """ Retrieves the line items of a committed standalone transaction as a collection. @@ -613,7 +613,7 @@ def list_line_items( # pyright: ignore[reportGeneralTypeIssues] async def _cls_list_line_items_async( cls, transaction: str, - **params: Unpack["Transaction.ListLineItemsParams"] + **params: Unpack["Transaction.ListLineItemsParams"], ) -> ListObject["TransactionLineItem"]: """ Retrieves the line items of a committed standalone transaction as a collection. diff --git a/stripe/tax/_transaction_line_item.py b/stripe/tax/_transaction_line_item.py index 659ae9423..87c817b36 100644 --- a/stripe/tax/_transaction_line_item.py +++ b/stripe/tax/_transaction_line_item.py @@ -6,9 +6,9 @@ class TransactionLineItem(StripeObject): - OBJECT_NAME: ClassVar[ - Literal["tax.transaction_line_item"] - ] = "tax.transaction_line_item" + OBJECT_NAME: ClassVar[Literal["tax.transaction_line_item"]] = ( + "tax.transaction_line_item" + ) class Reversal(StripeObject): original_line_item: str diff --git a/stripe/terminal/_configuration.py b/stripe/terminal/_configuration.py index 786a5f0ba..14a7e1e7f 100644 --- a/stripe/terminal/_configuration.py +++ b/stripe/terminal/_configuration.py @@ -32,9 +32,9 @@ class Configuration( A Configurations object represents how features should be configured for terminal readers. """ - OBJECT_NAME: ClassVar[ - Literal["terminal.configuration"] - ] = "terminal.configuration" + OBJECT_NAME: ClassVar[Literal["terminal.configuration"]] = ( + "terminal.configuration" + ) class BbposWiseposE(StripeObject): splashscreen: Optional[ExpandableField["File"]] @@ -1085,7 +1085,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1106,7 +1105,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/terminal/_connection_token.py b/stripe/terminal/_connection_token.py index 294eb02b7..a454b68dc 100644 --- a/stripe/terminal/_connection_token.py +++ b/stripe/terminal/_connection_token.py @@ -13,9 +13,9 @@ class ConnectionToken(CreateableAPIResource["ConnectionToken"]): Related guide: [Fleet management](https://stripe.com/docs/terminal/fleet/locations) """ - OBJECT_NAME: ClassVar[ - Literal["terminal.connection_token"] - ] = "terminal.connection_token" + OBJECT_NAME: ClassVar[Literal["terminal.connection_token"]] = ( + "terminal.connection_token" + ) class CreateParams(RequestOptions): expand: NotRequired[List[str]] diff --git a/stripe/terminal/_location.py b/stripe/terminal/_location.py index fe38a4c11..98f3feb17 100644 --- a/stripe/terminal/_location.py +++ b/stripe/terminal/_location.py @@ -346,7 +346,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -367,7 +366,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/terminal/_reader.py b/stripe/terminal/_reader.py index f9eced1cc..b00a15dfa 100644 --- a/stripe/terminal/_reader.py +++ b/stripe/terminal/_reader.py @@ -1518,7 +1518,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1539,7 +1538,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -2050,7 +2048,7 @@ class TestHelpers(APIResourceTestHelpers["Reader"]): def _cls_present_payment_method( cls, reader: str, - **params: Unpack["Reader.PresentPaymentMethodParams"] + **params: Unpack["Reader.PresentPaymentMethodParams"], ) -> "Reader": """ Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction. @@ -2107,7 +2105,7 @@ def present_payment_method( # pyright: ignore[reportGeneralTypeIssues] async def _cls_present_payment_method_async( cls, reader: str, - **params: Unpack["Reader.PresentPaymentMethodParams"] + **params: Unpack["Reader.PresentPaymentMethodParams"], ) -> "Reader": """ Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction. diff --git a/stripe/test_helpers/_confirmation_token_service.py b/stripe/test_helpers/_confirmation_token_service.py index 9c297c318..d1b9ef64b 100644 --- a/stripe/test_helpers/_confirmation_token_service.py +++ b/stripe/test_helpers/_confirmation_token_service.py @@ -658,7 +658,9 @@ class CreateParamsPaymentMethodDataRadarOptions(TypedDict): """ class CreateParamsPaymentMethodDataRechnung(TypedDict): - dob: "ConfirmationTokenService.CreateParamsPaymentMethodDataRechnungDob" + dob: ( + "ConfirmationTokenService.CreateParamsPaymentMethodDataRechnungDob" + ) """ Customer's date of birth """ diff --git a/stripe/test_helpers/_test_clock.py b/stripe/test_helpers/_test_clock.py index 97996fe29..b73b93ed9 100644 --- a/stripe/test_helpers/_test_clock.py +++ b/stripe/test_helpers/_test_clock.py @@ -21,9 +21,9 @@ class TestClock( you can either validate the current state of your scenario (and test your assumptions), change the current state of your scenario (and test more complex scenarios), or keep advancing forward in time. """ - OBJECT_NAME: ClassVar[ - Literal["test_helpers.test_clock"] - ] = "test_helpers.test_clock" + OBJECT_NAME: ClassVar[Literal["test_helpers.test_clock"]] = ( + "test_helpers.test_clock" + ) class AdvanceParams(RequestOptions): expand: NotRequired[List[str]] @@ -364,7 +364,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -385,7 +384,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/test_helpers/issuing/_personalization_design_service.py b/stripe/test_helpers/issuing/_personalization_design_service.py index 18823b094..671952b57 100644 --- a/stripe/test_helpers/issuing/_personalization_design_service.py +++ b/stripe/test_helpers/issuing/_personalization_design_service.py @@ -26,7 +26,9 @@ class RejectParams(TypedDict): """ Specifies which fields in the response should be expanded. """ - rejection_reasons: "PersonalizationDesignService.RejectParamsRejectionReasons" + rejection_reasons: ( + "PersonalizationDesignService.RejectParamsRejectionReasons" + ) """ The reason(s) the personalization design was rejected. """ diff --git a/stripe/treasury/_credit_reversal.py b/stripe/treasury/_credit_reversal.py index 1318c3d53..f8d64de25 100644 --- a/stripe/treasury/_credit_reversal.py +++ b/stripe/treasury/_credit_reversal.py @@ -21,9 +21,9 @@ class CreditReversal( You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.credit_reversal"] - ] = "treasury.credit_reversal" + OBJECT_NAME: ClassVar[Literal["treasury.credit_reversal"]] = ( + "treasury.credit_reversal" + ) class StatusTransitions(StripeObject): posted_at: Optional[int] @@ -180,7 +180,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -201,7 +200,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/treasury/_debit_reversal.py b/stripe/treasury/_debit_reversal.py index 6c1ec1c0c..dbc042bd1 100644 --- a/stripe/treasury/_debit_reversal.py +++ b/stripe/treasury/_debit_reversal.py @@ -21,9 +21,9 @@ class DebitReversal( You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.debit_reversal"] - ] = "treasury.debit_reversal" + OBJECT_NAME: ClassVar[Literal["treasury.debit_reversal"]] = ( + "treasury.debit_reversal" + ) class LinkedFlows(StripeObject): issuing_dispute: Optional[str] @@ -194,7 +194,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -215,7 +214,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/treasury/_financial_account.py b/stripe/treasury/_financial_account.py index 3cbd88346..52299c702 100644 --- a/stripe/treasury/_financial_account.py +++ b/stripe/treasury/_financial_account.py @@ -32,9 +32,9 @@ class FinancialAccount( FinancialAccounts serve as the source and destination of Treasury's money movement APIs. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.financial_account"] - ] = "treasury.financial_account" + OBJECT_NAME: ClassVar[Literal["treasury.financial_account"]] = ( + "treasury.financial_account" + ) class Balance(StripeObject): cash: Dict[str, int] @@ -811,7 +811,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -832,7 +831,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -900,7 +898,7 @@ async def retrieve_async( def _cls_retrieve_features( cls, financial_account: str, - **params: Unpack["FinancialAccount.RetrieveFeaturesParams"] + **params: Unpack["FinancialAccount.RetrieveFeaturesParams"], ) -> "FinancialAccountFeatures": """ Retrieves Features information associated with the FinancialAccount. @@ -920,7 +918,7 @@ def _cls_retrieve_features( @staticmethod def retrieve_features( financial_account: str, - **params: Unpack["FinancialAccount.RetrieveFeaturesParams"] + **params: Unpack["FinancialAccount.RetrieveFeaturesParams"], ) -> "FinancialAccountFeatures": """ Retrieves Features information associated with the FinancialAccount. @@ -958,7 +956,7 @@ def retrieve_features( # pyright: ignore[reportGeneralTypeIssues] async def _cls_retrieve_features_async( cls, financial_account: str, - **params: Unpack["FinancialAccount.RetrieveFeaturesParams"] + **params: Unpack["FinancialAccount.RetrieveFeaturesParams"], ) -> "FinancialAccountFeatures": """ Retrieves Features information associated with the FinancialAccount. @@ -978,7 +976,7 @@ async def _cls_retrieve_features_async( @staticmethod async def retrieve_features_async( financial_account: str, - **params: Unpack["FinancialAccount.RetrieveFeaturesParams"] + **params: Unpack["FinancialAccount.RetrieveFeaturesParams"], ) -> "FinancialAccountFeatures": """ Retrieves Features information associated with the FinancialAccount. @@ -1016,7 +1014,7 @@ async def retrieve_features_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_update_features( cls, financial_account: str, - **params: Unpack["FinancialAccount.UpdateFeaturesParams"] + **params: Unpack["FinancialAccount.UpdateFeaturesParams"], ) -> "FinancialAccountFeatures": """ Updates the Features associated with a FinancialAccount. @@ -1036,7 +1034,7 @@ def _cls_update_features( @staticmethod def update_features( financial_account: str, - **params: Unpack["FinancialAccount.UpdateFeaturesParams"] + **params: Unpack["FinancialAccount.UpdateFeaturesParams"], ) -> "FinancialAccountFeatures": """ Updates the Features associated with a FinancialAccount. @@ -1074,7 +1072,7 @@ def update_features( # pyright: ignore[reportGeneralTypeIssues] async def _cls_update_features_async( cls, financial_account: str, - **params: Unpack["FinancialAccount.UpdateFeaturesParams"] + **params: Unpack["FinancialAccount.UpdateFeaturesParams"], ) -> "FinancialAccountFeatures": """ Updates the Features associated with a FinancialAccount. @@ -1094,7 +1092,7 @@ async def _cls_update_features_async( @staticmethod async def update_features_async( financial_account: str, - **params: Unpack["FinancialAccount.UpdateFeaturesParams"] + **params: Unpack["FinancialAccount.UpdateFeaturesParams"], ) -> "FinancialAccountFeatures": """ Updates the Features associated with a FinancialAccount. diff --git a/stripe/treasury/_financial_account_features.py b/stripe/treasury/_financial_account_features.py index dd44af71d..60c378efe 100644 --- a/stripe/treasury/_financial_account_features.py +++ b/stripe/treasury/_financial_account_features.py @@ -11,9 +11,9 @@ class FinancialAccountFeatures(StripeObject): Stripe or the platform can control Features via the requested field. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.financial_account_features"] - ] = "treasury.financial_account_features" + OBJECT_NAME: ClassVar[Literal["treasury.financial_account_features"]] = ( + "treasury.financial_account_features" + ) class CardIssuing(StripeObject): class StatusDetail(StripeObject): diff --git a/stripe/treasury/_inbound_transfer.py b/stripe/treasury/_inbound_transfer.py index ec921ddac..d23b01a94 100644 --- a/stripe/treasury/_inbound_transfer.py +++ b/stripe/treasury/_inbound_transfer.py @@ -31,9 +31,9 @@ class InboundTransfer( Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.inbound_transfer"] - ] = "treasury.inbound_transfer" + OBJECT_NAME: ClassVar[Literal["treasury.inbound_transfer"]] = ( + "treasury.inbound_transfer" + ) class FailureDetails(StripeObject): code: Literal[ @@ -358,7 +358,7 @@ class SucceedParams(RequestOptions): def _cls_cancel( cls, inbound_transfer: str, - **params: Unpack["InboundTransfer.CancelParams"] + **params: Unpack["InboundTransfer.CancelParams"], ) -> "InboundTransfer": """ Cancels an InboundTransfer. @@ -415,7 +415,7 @@ def cancel( # pyright: ignore[reportGeneralTypeIssues] async def _cls_cancel_async( cls, inbound_transfer: str, - **params: Unpack["InboundTransfer.CancelParams"] + **params: Unpack["InboundTransfer.CancelParams"], ) -> "InboundTransfer": """ Cancels an InboundTransfer. @@ -513,7 +513,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -534,7 +533,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -681,7 +679,7 @@ async def fail_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_return_inbound_transfer( cls, id: str, - **params: Unpack["InboundTransfer.ReturnInboundTransferParams"] + **params: Unpack["InboundTransfer.ReturnInboundTransferParams"], ) -> "InboundTransfer": """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. @@ -701,7 +699,7 @@ def _cls_return_inbound_transfer( @staticmethod def return_inbound_transfer( id: str, - **params: Unpack["InboundTransfer.ReturnInboundTransferParams"] + **params: Unpack["InboundTransfer.ReturnInboundTransferParams"], ) -> "InboundTransfer": """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. @@ -711,7 +709,7 @@ def return_inbound_transfer( @overload def return_inbound_transfer( self, - **params: Unpack["InboundTransfer.ReturnInboundTransferParams"] + **params: Unpack["InboundTransfer.ReturnInboundTransferParams"], ) -> "InboundTransfer": """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. @@ -721,7 +719,7 @@ def return_inbound_transfer( @class_method_variant("_cls_return_inbound_transfer") def return_inbound_transfer( # pyright: ignore[reportGeneralTypeIssues] self, - **params: Unpack["InboundTransfer.ReturnInboundTransferParams"] + **params: Unpack["InboundTransfer.ReturnInboundTransferParams"], ) -> "InboundTransfer": """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. @@ -741,7 +739,7 @@ def return_inbound_transfer( # pyright: ignore[reportGeneralTypeIssues] async def _cls_return_inbound_transfer_async( cls, id: str, - **params: Unpack["InboundTransfer.ReturnInboundTransferParams"] + **params: Unpack["InboundTransfer.ReturnInboundTransferParams"], ) -> "InboundTransfer": """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. @@ -761,7 +759,7 @@ async def _cls_return_inbound_transfer_async( @staticmethod async def return_inbound_transfer_async( id: str, - **params: Unpack["InboundTransfer.ReturnInboundTransferParams"] + **params: Unpack["InboundTransfer.ReturnInboundTransferParams"], ) -> "InboundTransfer": """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. @@ -771,7 +769,7 @@ async def return_inbound_transfer_async( @overload async def return_inbound_transfer_async( self, - **params: Unpack["InboundTransfer.ReturnInboundTransferParams"] + **params: Unpack["InboundTransfer.ReturnInboundTransferParams"], ) -> "InboundTransfer": """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. @@ -781,7 +779,7 @@ async def return_inbound_transfer_async( @class_method_variant("_cls_return_inbound_transfer_async") async def return_inbound_transfer_async( # pyright: ignore[reportGeneralTypeIssues] self, - **params: Unpack["InboundTransfer.ReturnInboundTransferParams"] + **params: Unpack["InboundTransfer.ReturnInboundTransferParams"], ) -> "InboundTransfer": """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. diff --git a/stripe/treasury/_outbound_payment.py b/stripe/treasury/_outbound_payment.py index 7ad22009c..36d468169 100644 --- a/stripe/treasury/_outbound_payment.py +++ b/stripe/treasury/_outbound_payment.py @@ -33,9 +33,9 @@ class OutboundPayment( Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.outbound_payment"] - ] = "treasury.outbound_payment" + OBJECT_NAME: ClassVar[Literal["treasury.outbound_payment"]] = ( + "treasury.outbound_payment" + ) class DestinationPaymentMethodDetails(StripeObject): class BillingDetails(StripeObject): @@ -777,7 +777,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -798,7 +797,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -1055,7 +1053,7 @@ async def post_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_return_outbound_payment( cls, id: str, - **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"] + **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"], ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. @@ -1075,7 +1073,7 @@ def _cls_return_outbound_payment( @staticmethod def return_outbound_payment( id: str, - **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"] + **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"], ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. @@ -1085,7 +1083,7 @@ def return_outbound_payment( @overload def return_outbound_payment( self, - **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"] + **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"], ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. @@ -1095,7 +1093,7 @@ def return_outbound_payment( @class_method_variant("_cls_return_outbound_payment") def return_outbound_payment( # pyright: ignore[reportGeneralTypeIssues] self, - **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"] + **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"], ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. @@ -1115,7 +1113,7 @@ def return_outbound_payment( # pyright: ignore[reportGeneralTypeIssues] async def _cls_return_outbound_payment_async( cls, id: str, - **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"] + **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"], ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. @@ -1135,7 +1133,7 @@ async def _cls_return_outbound_payment_async( @staticmethod async def return_outbound_payment_async( id: str, - **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"] + **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"], ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. @@ -1145,7 +1143,7 @@ async def return_outbound_payment_async( @overload async def return_outbound_payment_async( self, - **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"] + **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"], ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. @@ -1155,7 +1153,7 @@ async def return_outbound_payment_async( @class_method_variant("_cls_return_outbound_payment_async") async def return_outbound_payment_async( # pyright: ignore[reportGeneralTypeIssues] self, - **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"] + **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"], ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. diff --git a/stripe/treasury/_outbound_transfer.py b/stripe/treasury/_outbound_transfer.py index 4a046933d..cf76600ac 100644 --- a/stripe/treasury/_outbound_transfer.py +++ b/stripe/treasury/_outbound_transfer.py @@ -33,9 +33,9 @@ class OutboundTransfer( Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.outbound_transfer"] - ] = "treasury.outbound_transfer" + OBJECT_NAME: ClassVar[Literal["treasury.outbound_transfer"]] = ( + "treasury.outbound_transfer" + ) class DestinationPaymentMethodDetails(StripeObject): class BillingDetails(StripeObject): @@ -486,7 +486,7 @@ class UpdateParamsTrackingDetailsUsDomesticWire(TypedDict): def _cls_cancel( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.CancelParams"] + **params: Unpack["OutboundTransfer.CancelParams"], ) -> "OutboundTransfer": """ An OutboundTransfer can be canceled if the funds have not yet been paid out. @@ -506,7 +506,7 @@ def _cls_cancel( @staticmethod def cancel( outbound_transfer: str, - **params: Unpack["OutboundTransfer.CancelParams"] + **params: Unpack["OutboundTransfer.CancelParams"], ) -> "OutboundTransfer": """ An OutboundTransfer can be canceled if the funds have not yet been paid out. @@ -544,7 +544,7 @@ def cancel( # pyright: ignore[reportGeneralTypeIssues] async def _cls_cancel_async( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.CancelParams"] + **params: Unpack["OutboundTransfer.CancelParams"], ) -> "OutboundTransfer": """ An OutboundTransfer can be canceled if the funds have not yet been paid out. @@ -564,7 +564,7 @@ async def _cls_cancel_async( @staticmethod async def cancel_async( outbound_transfer: str, - **params: Unpack["OutboundTransfer.CancelParams"] + **params: Unpack["OutboundTransfer.CancelParams"], ) -> "OutboundTransfer": """ An OutboundTransfer can be canceled if the funds have not yet been paid out. @@ -643,7 +643,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -664,7 +663,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -701,7 +699,7 @@ class TestHelpers(APIResourceTestHelpers["OutboundTransfer"]): def _cls_fail( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.FailParams"] + **params: Unpack["OutboundTransfer.FailParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. @@ -721,7 +719,7 @@ def _cls_fail( @staticmethod def fail( outbound_transfer: str, - **params: Unpack["OutboundTransfer.FailParams"] + **params: Unpack["OutboundTransfer.FailParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. @@ -759,7 +757,7 @@ def fail( # pyright: ignore[reportGeneralTypeIssues] async def _cls_fail_async( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.FailParams"] + **params: Unpack["OutboundTransfer.FailParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. @@ -779,7 +777,7 @@ async def _cls_fail_async( @staticmethod async def fail_async( outbound_transfer: str, - **params: Unpack["OutboundTransfer.FailParams"] + **params: Unpack["OutboundTransfer.FailParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. @@ -817,7 +815,7 @@ async def fail_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_post( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.PostParams"] + **params: Unpack["OutboundTransfer.PostParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. @@ -837,7 +835,7 @@ def _cls_post( @staticmethod def post( outbound_transfer: str, - **params: Unpack["OutboundTransfer.PostParams"] + **params: Unpack["OutboundTransfer.PostParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. @@ -875,7 +873,7 @@ def post( # pyright: ignore[reportGeneralTypeIssues] async def _cls_post_async( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.PostParams"] + **params: Unpack["OutboundTransfer.PostParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. @@ -895,7 +893,7 @@ async def _cls_post_async( @staticmethod async def post_async( outbound_transfer: str, - **params: Unpack["OutboundTransfer.PostParams"] + **params: Unpack["OutboundTransfer.PostParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. @@ -933,7 +931,7 @@ async def post_async( # pyright: ignore[reportGeneralTypeIssues] def _cls_return_outbound_transfer( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"] + **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. @@ -953,7 +951,7 @@ def _cls_return_outbound_transfer( @staticmethod def return_outbound_transfer( outbound_transfer: str, - **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"] + **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. @@ -963,7 +961,7 @@ def return_outbound_transfer( @overload def return_outbound_transfer( self, - **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"] + **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. @@ -973,7 +971,7 @@ def return_outbound_transfer( @class_method_variant("_cls_return_outbound_transfer") def return_outbound_transfer( # pyright: ignore[reportGeneralTypeIssues] self, - **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"] + **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. @@ -993,7 +991,7 @@ def return_outbound_transfer( # pyright: ignore[reportGeneralTypeIssues] async def _cls_return_outbound_transfer_async( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"] + **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. @@ -1013,7 +1011,7 @@ async def _cls_return_outbound_transfer_async( @staticmethod async def return_outbound_transfer_async( outbound_transfer: str, - **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"] + **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. @@ -1023,7 +1021,7 @@ async def return_outbound_transfer_async( @overload async def return_outbound_transfer_async( self, - **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"] + **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. @@ -1033,7 +1031,7 @@ async def return_outbound_transfer_async( @class_method_variant("_cls_return_outbound_transfer_async") async def return_outbound_transfer_async( # pyright: ignore[reportGeneralTypeIssues] self, - **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"] + **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. @@ -1053,7 +1051,7 @@ async def return_outbound_transfer_async( # pyright: ignore[reportGeneralTypeIs def _cls_update( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.UpdateParams"] + **params: Unpack["OutboundTransfer.UpdateParams"], ) -> "OutboundTransfer": """ Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. @@ -1073,7 +1071,7 @@ def _cls_update( @staticmethod def update( outbound_transfer: str, - **params: Unpack["OutboundTransfer.UpdateParams"] + **params: Unpack["OutboundTransfer.UpdateParams"], ) -> "OutboundTransfer": """ Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. @@ -1111,7 +1109,7 @@ def update( # pyright: ignore[reportGeneralTypeIssues] async def _cls_update_async( cls, outbound_transfer: str, - **params: Unpack["OutboundTransfer.UpdateParams"] + **params: Unpack["OutboundTransfer.UpdateParams"], ) -> "OutboundTransfer": """ Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. @@ -1131,7 +1129,7 @@ async def _cls_update_async( @staticmethod async def update_async( outbound_transfer: str, - **params: Unpack["OutboundTransfer.UpdateParams"] + **params: Unpack["OutboundTransfer.UpdateParams"], ) -> "OutboundTransfer": """ Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. diff --git a/stripe/treasury/_received_credit.py b/stripe/treasury/_received_credit.py index 9a8d3d177..d029c7927 100644 --- a/stripe/treasury/_received_credit.py +++ b/stripe/treasury/_received_credit.py @@ -28,9 +28,9 @@ class ReceivedCredit(ListableAPIResource["ReceivedCredit"]): ReceivedCredits represent funds sent to a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) (for example, via ACH or wire). These money movements are not initiated from the FinancialAccount. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.received_credit"] - ] = "treasury.received_credit" + OBJECT_NAME: ClassVar[Literal["treasury.received_credit"]] = ( + "treasury.received_credit" + ) class InitiatingPaymentMethodDetails(StripeObject): class BillingDetails(StripeObject): @@ -415,7 +415,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -436,7 +435,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/treasury/_received_debit.py b/stripe/treasury/_received_debit.py index 51476ca3d..2bdb2dea9 100644 --- a/stripe/treasury/_received_debit.py +++ b/stripe/treasury/_received_debit.py @@ -25,9 +25,9 @@ class ReceivedDebit(ListableAPIResource["ReceivedDebit"]): ReceivedDebits represent funds pulled from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts). These are not initiated from the FinancialAccount. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.received_debit"] - ] = "treasury.received_debit" + OBJECT_NAME: ClassVar[Literal["treasury.received_debit"]] = ( + "treasury.received_debit" + ) class InitiatingPaymentMethodDetails(StripeObject): class BillingDetails(StripeObject): @@ -372,7 +372,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -393,7 +392,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/treasury/_transaction.py b/stripe/treasury/_transaction.py index 146739365..a8d220526 100644 --- a/stripe/treasury/_transaction.py +++ b/stripe/treasury/_transaction.py @@ -30,9 +30,9 @@ class Transaction(ListableAPIResource["Transaction"]): Transactions represent changes to a [FinancialAccount's](https://stripe.com/docs/api#financial_accounts) balance. """ - OBJECT_NAME: ClassVar[ - Literal["treasury.transaction"] - ] = "treasury.transaction" + OBJECT_NAME: ClassVar[Literal["treasury.transaction"]] = ( + "treasury.transaction" + ) class BalanceImpact(StripeObject): cash: int @@ -285,7 +285,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -306,7 +305,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/stripe/treasury/_transaction_entry.py b/stripe/treasury/_transaction_entry.py index 18ebfe248..6633d2785 100644 --- a/stripe/treasury/_transaction_entry.py +++ b/stripe/treasury/_transaction_entry.py @@ -31,9 +31,9 @@ class TransactionEntry(ListableAPIResource["TransactionEntry"]): TransactionEntries represent individual units of money movements within a single [Transaction](https://stripe.com/docs/api#transactions). """ - OBJECT_NAME: ClassVar[ - Literal["treasury.transaction_entry"] - ] = "treasury.transaction_entry" + OBJECT_NAME: ClassVar[Literal["treasury.transaction_entry"]] = ( + "treasury.transaction_entry" + ) class BalanceImpact(StripeObject): cash: int @@ -279,7 +279,6 @@ def list( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) @@ -300,7 +299,6 @@ async def list_async( params=params, ) if not isinstance(result, ListObject): - raise TypeError( "Expected list object from API, got %s" % (type(result).__name__) diff --git a/tests/test_api_requestor.py b/tests/test_api_requestor.py index c25f7e27a..41a5daf44 100644 --- a/tests/test_api_requestor.py +++ b/tests/test_api_requestor.py @@ -861,7 +861,7 @@ def test_extract_error_from_stream_request_for_response( def test_raw_request_with_file_param(self, requestor, http_client_mock): test_file = tempfile.NamedTemporaryFile() - test_file.write("\u263A".encode("utf-16")) + test_file.write("\u263a".encode("utf-16")) test_file.seek(0) meth = "post" path = "/v1/files" diff --git a/tests/test_exports.py b/tests/test_exports.py index ebdb2499c..307529e85 100644 --- a/tests/test_exports.py +++ b/tests/test_exports.py @@ -23,20 +23,25 @@ def assert_output(code: str, expected: str) -> None: def test_can_import_stripe_object() -> None: + # fmt: off from stripe.stripe_object import StripeObject as StripeObjectFromStripeStripeObject # type: ignore + # fmt: on from stripe import ( StripeObject as StripeObjectFromStripe, ) - assert ( - stripe.stripe_object.StripeObject is StripeObjectFromStripeStripeObject # type: ignore - ) + # fmt: off + assert stripe.stripe_object.StripeObject is StripeObjectFromStripeStripeObject # type: ignore + # fmt: on assert stripe.StripeObject is StripeObjectFromStripeStripeObject assert StripeObjectFromStripe is StripeObjectFromStripeStripeObject def test_can_import_request_options() -> None: + # fmt: off from stripe.request_options import RequestOptions as RequestOptionsStripeRequestOptions # type: ignore + # fmt: on + from stripe import ( RequestOptions as RequestOptionsFromStripe, ) @@ -47,10 +52,13 @@ def test_can_import_request_options() -> None: def test_can_import_http_client() -> None: from stripe.http_client import HTTPClient as HTTPClientFromStripeHTTPClient # type: ignore + + # fmt: off from stripe.http_client import PycurlClient as PycurlClientFromStripeHTTPClient # type: ignore from stripe.http_client import RequestsClient as RequestsClientFromStripeHTTPClient # type: ignore from stripe.http_client import UrlFetchClient as UrlFetchClientFromStripeHTTPClient # type: ignore from stripe.http_client import new_default_http_client as new_default_http_clientFromStripeHTTPClient # type: ignore + # fmt: on from stripe import ( HTTPClient as HTTPClientFromStripe, @@ -81,7 +89,10 @@ def test_can_import_http_client() -> None: def test_can_import_webhook_members() -> None: from stripe.webhook import Webhook as WebhookFromStripeWebhook # type: ignore + + # fmt: off from stripe.webhook import WebhookSignature as WebhookSignatureFromStripeWebhook # type: ignore + # fmt: on from stripe import ( Webhook, @@ -96,7 +107,6 @@ def test_can_import_webhook_members() -> None: def test_can_import_list_search_objects() -> None: - # This import has to be single line, mypy and pyright are producing errors # on different lines of multiline import # fmt: off @@ -128,8 +138,11 @@ def test_can_import_misc_resources() -> None: ErrorObject as ErrorObjectFromStripe, OAuthErrorObject as OAuthErrorObjectFromStripe, ) + + # fmt: off from stripe.api_resources.error_object import ErrorObject as ErrorObjectFromStripeApiResources # type: ignore from stripe.api_resources.error_object import OAuthErrorObject as OAuthErrorObjectFromStripeApiResources # type: ignore + # fmt: on # FileUpload is an old alias for File, time to hide it from stripe.api_resources import FileUpload as FileUploadFromApiResources # type: ignore @@ -245,9 +258,11 @@ def test_can_import_app_info() -> None: def test_can_import_stripe_response() -> None: + # fmt: off from stripe.stripe_response import StripeResponse as StripeResponseFromStripeResponse # type: ignore from stripe.stripe_response import StripeResponseBase as StripeResponseBaseFromStripeResponse # type: ignore from stripe.stripe_response import StripeStreamResponse as StripeStreamResponseFromStripeResponse # type: ignore + # fmt: on from stripe import ( StripeResponse as StripeResponseFromStripe, @@ -288,7 +303,10 @@ def test_can_import_oauth_members() -> None: def test_can_import_util() -> None: + # fmt: off from stripe.util import convert_to_stripe_object as convert_to_stripe_objectFromStripeUtil # type: ignore + # fmt: on + from stripe import ( convert_to_stripe_object as convert_to_stripe_objectFromStripe, ) @@ -383,7 +401,9 @@ def test_can_import_namespaced_resource() -> None: # This import has to be single line, mypy and pyright are producing errors # on different lines of multiline import + # fmt: off from stripe.api_resources.tax.calculation import Calculation as CalcFromModule # type: ignore + # fmt: on assert stripe.tax is TaxPackage assert stripe.tax.Calculation is CalculationFromStripe diff --git a/tests/test_generated_examples.py b/tests/test_generated_examples.py index b3b35e0d6..f733c0c2d 100644 --- a/tests/test_generated_examples.py +++ b/tests/test_generated_examples.py @@ -27069,8 +27069,10 @@ async def test_test_helpers_issuing_personalization_designs_activate_post_servic http_client=http_client_mock.get_mock_http_client(), ) - await client.test_helpers.issuing.personalization_designs.activate_async( - "pd_xyz" + await ( + client.test_helpers.issuing.personalization_designs.activate_async( + "pd_xyz" + ) ) http_client_mock.assert_requested( "post", @@ -27115,8 +27117,10 @@ def test_test_helpers_issuing_personalization_designs_deactivate_post_service( async def test_test_helpers_issuing_personalization_designs_deactivate_post_async( self, http_client_mock: HTTPClientMock ) -> None: - await stripe.issuing.PersonalizationDesign.TestHelpers.deactivate_async( - "pd_xyz", + await ( + stripe.issuing.PersonalizationDesign.TestHelpers.deactivate_async( + "pd_xyz", + ) ) http_client_mock.assert_requested( "post", @@ -27359,54 +27363,56 @@ def test_test_helpers_issuing_transactions_create_force_capture_post_service( async def test_test_helpers_issuing_transactions_create_force_capture_post_async( self, http_client_mock: HTTPClientMock ) -> None: - await stripe.issuing.Transaction.TestHelpers.create_force_capture_async( - amount=100, - card="foo", - currency="usd", - merchant_data={ - "category": "ac_refrigeration_repair", - "city": "foo", - "country": "US", - "name": "foo", - "network_id": "bar", - "postal_code": "10001", - "state": "NY", - "terminal_id": "foo", - }, - purchase_details={ - "flight": { - "departure_at": 1633651200, - "passenger_name": "John Doe", - "refundable": True, - "segments": [ + await ( + stripe.issuing.Transaction.TestHelpers.create_force_capture_async( + amount=100, + card="foo", + currency="usd", + merchant_data={ + "category": "ac_refrigeration_repair", + "city": "foo", + "country": "US", + "name": "foo", + "network_id": "bar", + "postal_code": "10001", + "state": "NY", + "terminal_id": "foo", + }, + purchase_details={ + "flight": { + "departure_at": 1633651200, + "passenger_name": "John Doe", + "refundable": True, + "segments": [ + { + "arrival_airport_code": "SFO", + "carrier": "Delta", + "departure_airport_code": "LAX", + "flight_number": "DL100", + "service_class": "Economy", + "stopover_allowed": True, + }, + ], + "travel_agency": "Orbitz", + }, + "fuel": { + "type": "diesel", + "unit": "liter", + "unit_cost_decimal": "3.5", + "volume_decimal": "10", + }, + "lodging": {"check_in_at": 1533651200, "nights": 2}, + "receipt": [ { - "arrival_airport_code": "SFO", - "carrier": "Delta", - "departure_airport_code": "LAX", - "flight_number": "DL100", - "service_class": "Economy", - "stopover_allowed": True, + "description": "Room charge", + "quantity": "1", + "total": 200, + "unit_cost": 200, }, ], - "travel_agency": "Orbitz", - }, - "fuel": { - "type": "diesel", - "unit": "liter", - "unit_cost_decimal": "3.5", - "volume_decimal": "10", + "reference": "foo", }, - "lodging": {"check_in_at": 1533651200, "nights": 2}, - "receipt": [ - { - "description": "Room charge", - "quantity": "1", - "total": 200, - "unit_cost": 200, - }, - ], - "reference": "foo", - }, + ) ) http_client_mock.assert_requested( "post", diff --git a/tests/test_http_client.py b/tests/test_http_client.py index 3b8292188..d6cbbbdf5 100644 --- a/tests/test_http_client.py +++ b/tests/test_http_client.py @@ -467,9 +467,9 @@ def __eq__(self, other): class TestRequestsClient(StripeClientTestCase, ClientTestBase): - REQUEST_CLIENT: Type[ + REQUEST_CLIENT: Type[_http_client.RequestsClient] = ( _http_client.RequestsClient - ] = _http_client.RequestsClient + ) @pytest.fixture def session(self, mocker, request_mocks): @@ -834,9 +834,9 @@ def check_call( class TestUrllib2Client(StripeClientTestCase, ClientTestBase): - REQUEST_CLIENT: Type[ + REQUEST_CLIENT: Type[_http_client.Urllib2Client] = ( _http_client.Urllib2Client - ] = _http_client.Urllib2Client + ) request_object: Any @@ -1254,7 +1254,6 @@ async def make_request_stream_async( async def test_request_async( self, request_mock, mock_response, check_call_async ): - mock_response(request_mock, '{"foo": "baz"}', 200) for method in VALID_API_METHODS: @@ -1549,9 +1548,9 @@ def test_timeout_async(self): class TestAIOHTTPClient(StripeClientTestCase, ClientTestBase): - REQUEST_CLIENT: Type[ + REQUEST_CLIENT: Type[_http_client.AIOHTTPClient] = ( _http_client.AIOHTTPClient - ] = _http_client.AIOHTTPClient + ) @pytest.fixture def mock_response(self, mocker, request_mock): @@ -1559,9 +1558,11 @@ def mock_response(mock, body={}, code=200): class Content: def __aiter__(self): async def chunk(): - yield bytes(body, "utf-8") if isinstance( - body, str - ) else body + yield ( + bytes(body, "utf-8") + if isinstance(body, str) + else body + ) return chunk() @@ -1683,7 +1684,6 @@ def test_request_stream(self): async def test_request_async( self, request_mock, mock_response, check_call_async ): - mock_response(request_mock, '{"foo": "baz"}', 200) for method in VALID_API_METHODS: