diff options
author | David Brownman <109395161+xavdid-stripe@users.noreply.github.com> | 2025-09-29 12:55:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-29 19:55:10 +0000 |
commit | 20df48f2822770cd4e8df9f4df945b52705b5482 (patch) | |
tree | 7b2dc56b0de78ce87a937f99665cb8e99bd92025 | |
parent | 6c9ffe903c87fd8b33108d4097dd052106672df0 (diff) |
⚠️ Remove deprecated compatibility exports (#1603)
* remove many deprecated backcompat exports * replace comments for mypy * update some examples * fix typecheck * fix typecheck for real
224 files changed, 348 insertions, 4754 deletions
@@ -14,7 +14,7 @@ extend-select = per-file-ignores = */__init__.py: IMP100, E402, F401 # we test various import patterns - tests/test_exports.py: IMP100, IMP101, IMP102 + tests/test_exports.py: IMP100, IMP101, IMP102, F401 tests/*: IMP101, IMP102, BAN100, ASY100 # backcompat with outdated import patterns stripe/api_resources/*: IMP100, E402, F401 @@ -114,10 +114,10 @@ You can configure your `StripeClient` to use `urlfetch`, `requests`, `pycurl`, o `urllib` with the `http_client` option: ```python -client = StripeClient("sk_test_...", http_client=stripe.http_client.UrlFetchClient()) -client = StripeClient("sk_test_...", http_client=stripe.http_client.RequestsClient()) -client = StripeClient("sk_test_...", http_client=stripe.http_client.PycurlClient()) -client = StripeClient("sk_test_...", http_client=stripe.http_client.UrllibClient()) +client = StripeClient("sk_test_...", http_client=stripe.UrlFetchClient()) +client = StripeClient("sk_test_...", http_client=stripe.RequestsClient()) +client = StripeClient("sk_test_...", http_client=stripe.PycurlClient()) +client = StripeClient("sk_test_...", http_client=stripe.UrllibClient()) ``` Without a configured client, by default the library will attempt to load diff --git a/examples/charge.py b/examples/charge.py deleted file mode 100644 index 0bb8230c..00000000 --- a/examples/charge.py +++ /dev/null @@ -1,17 +0,0 @@ -import os - -import stripe - - -stripe.api_key = os.environ.get("STRIPE_SECRET_KEY") - -print("Attempting charge...") - -resp = stripe.Charge.create( - amount=200, - currency="usd", - card="tok_visa", - description="customer@gmail.com", -) - -print("Success: %r" % (resp)) diff --git a/examples/oauth.py b/examples/oauth.py index 1d2ad31c..b37b92aa 100644 --- a/examples/oauth.py +++ b/examples/oauth.py @@ -1,11 +1,15 @@ import os -import stripe +from stripe import StripeClient +from stripe.oauth_error import OAuthError + from flask import Flask, request, redirect -stripe.api_key = os.environ.get("STRIPE_SECRET_KEY") -stripe.client_id = os.environ.get("STRIPE_CLIENT_ID") +client = StripeClient( + api_key=os.environ["STRIPE_SECRET_KEY"], + client_id=os.environ.get("STRIPE_CLIENT_ID"), +) app = Flask(__name__) @@ -17,7 +21,7 @@ def index(): @app.route("/authorize") def authorize(): - url = stripe.OAuth.authorize_url(scope="read_only") + url = client.oauth.authorize_url(scope="read_only") return redirect(url) @@ -25,8 +29,10 @@ def authorize(): def callback(): code = request.args.get("code") try: - resp = stripe.OAuth.token(grant_type="authorization_code", code=code) - except stripe.oauth_error.OAuthError as e: + resp = client.oauth.token( + params={"grant_type": "authorization_code", "code": code} + ) + except OAuthError as e: return "Error: " + str(e) return """ @@ -40,8 +46,8 @@ disconnect the account.</p> def deauthorize(): stripe_user_id = request.args.get("stripe_user_id") try: - stripe.OAuth.deauthorize(stripe_user_id=stripe_user_id) - except stripe.oauth_error.OAuthError as e: + client.oauth.deauthorize(params={"stripe_user_id": stripe_user_id}) + except OAuthError as e: return "Error: " + str(e) return """ diff --git a/examples/proxy.py b/examples/proxy.py index a85214f1..9b5dde00 100644 --- a/examples/proxy.py +++ b/examples/proxy.py @@ -1,35 +1,39 @@ import os -import stripe - - -stripe.api_key = os.environ.get("STRIPE_SECRET_KEY") +from stripe import ( + StripeClient, + RequestsClient, + HTTPClient, + UrllibClient, + verify_ssl_certs, + PycurlClient, +) print("Attempting charge...") -proxy = { +proxy: HTTPClient._Proxy = { "http": "http://<user>:<pass>@<proxy>:<port>", "https": "http://<user>:<pass>@<proxy>:<port>", } -clients = ( - stripe.http_client.RequestsClient( - verify_ssl_certs=stripe.verify_ssl_certs, proxy=proxy - ), - stripe.http_client.PycurlClient( - verify_ssl_certs=stripe.verify_ssl_certs, proxy=proxy - ), - stripe.http_client.UrllibClient( - verify_ssl_certs=stripe.verify_ssl_certs, proxy=proxy - ), +http_clients = ( + RequestsClient(verify_ssl_certs=verify_ssl_certs, proxy=proxy), + PycurlClient(verify_ssl_certs=verify_ssl_certs, proxy=proxy), + UrllibClient(verify_ssl_certs=verify_ssl_certs, proxy=proxy), ) -for c in clients: - stripe.default_http_client = c - resp = stripe.Charge.create( - amount=200, - currency="usd", - card="tok_visa", - description="customer@gmail.com", +for http_client in http_clients: + client_with_proxy = StripeClient( + api_key=os.environ["STRIPE_SECRET_KEY"], + http_client=http_client, ) - print("Success: %s, %r" % (c.name, resp)) + + resp = client_with_proxy.v1.charges.create( + params={ + "amount": 200, + "currency": "usd", + "description": "customer@example.com", + } + ) + + print("Success: %s, %r" % (http_client.name, resp)) diff --git a/examples/webhooks.py b/examples/webhooks.py index 23ea538b..8dcf308c 100644 --- a/examples/webhooks.py +++ b/examples/webhooks.py @@ -1,10 +1,15 @@ import os -import stripe +from stripe import StripeClient, Webhook, SignatureVerificationError + from flask import Flask, request -stripe.api_key = os.environ.get("STRIPE_SECRET_KEY") +client = StripeClient( + api_key=os.environ["STRIPE_SECRET_KEY"], + client_id=os.environ.get("STRIPE_CLIENT_ID"), +) + webhook_secret = os.environ.get("WEBHOOK_SECRET") app = Flask(__name__) @@ -16,13 +21,11 @@ def webhooks(): received_sig = request.headers.get("Stripe-Signature", None) try: - event = stripe.Webhook.construct_event( - payload, received_sig, webhook_secret - ) + event = Webhook.construct_event(payload, received_sig, webhook_secret) except ValueError: print("Error while decoding event!") return "Bad payload", 400 - except stripe.error.SignatureVerificationError: + except SignatureVerificationError: print("Invalid signature!") return "Bad signature", 400 diff --git a/stripe/__init__.py b/stripe/__init__.py index 4388cc9c..3adcb028 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -15,10 +15,7 @@ import warnings from stripe._api_version import _ApiVersion from stripe._api_requestor import _APIRequestor -# We must import the app_info module early to populate it into -# `sys.modules`; otherwise doing `import stripe.app_info` will end up -# importing that module, and not the global `AppInfo` name from below. -import stripe.app_info + from stripe._app_info import AppInfo as AppInfo from stripe._version import VERSION as VERSION @@ -203,52 +200,13 @@ from stripe._http_client import ( UrlFetchClient as UrlFetchClient, HTTPXClient as HTTPXClient, AIOHTTPClient as AIOHTTPClient, + UrllibClient as UrllibClient, new_default_http_client as new_default_http_client, ) # Util from stripe._util import convert_to_stripe_object as convert_to_stripe_object -# Backwards compatibility re-exports -if not TYPE_CHECKING: - from stripe import _stripe_response as stripe_response - from stripe import _stripe_object as stripe_object - from stripe import _error_object as error_object - from stripe import _error as error - from stripe import _http_client as http_client - from stripe import _util as util - from stripe import _oauth as oauth - from stripe import _webhook as webhook - from stripe import _multipart_data_generator as multipart_data_generator - from stripe import _request_metrics as request_metrics - from stripe._file import File as FileUpload - - # Python 3.7+ supports module level __getattr__ that allows us to lazy load deprecated modules - # this matters because if we pre-load all modules from api_resources while suppressing warning - # users will never see those warnings - if _sys.version_info[:2] >= (3, 7): - - def __getattr__(name): - if name == "abstract": - import stripe.api_resources.abstract as _abstract - - return _abstract - if name == "api_resources": - import stripe.api_resources as _api_resources - - return _api_resources - raise AttributeError( - f"module {__name__!r} has no attribute {name!r}" - ) - - else: - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - - import stripe.api_resources.abstract as abstract - import stripe.api_resources as api_resources - - # API resources # The beginning of the section generated from our OpenAPI spec diff --git a/stripe/_http_client.py b/stripe/_http_client.py index 06c88c64..62fae3eb 100644 --- a/stripe/_http_client.py +++ b/stripe/_http_client.py @@ -123,6 +123,10 @@ def new_http_client_async_fallback(*args: Any, **kwargs: Any) -> "HTTPClient": class HTTPClient(object): + """ + Base HTTP client that custom clients can inherit from. + """ + name: ClassVar[str] class _Proxy(TypedDict): @@ -860,7 +864,7 @@ class UrlFetchClient(HTTPClient): if is_streaming: # This doesn't really stream. - content = _util.io.BytesIO(str.encode(result.content)) + content = BytesIO(str.encode(result.content)) else: content = result.content @@ -991,8 +995,8 @@ class PycurlClient(HTTPClient): post_data, is_streaming, ) -> Tuple[Union[str, BytesIO], int, Mapping[str, str]]: - b = _util.io.BytesIO() - rheaders = _util.io.BytesIO() + b = BytesIO() + rheaders = BytesIO() # Pycurl's design is a little weird: although we set per-request # options on this object, it's also capable of maintaining established diff --git a/stripe/_util.py b/stripe/_util.py index 95395899..2405a151 100644 --- a/stripe/_util.py +++ b/stripe/_util.py @@ -1,6 +1,5 @@ import functools import hmac -import io # noqa: F401 import logging import sys import os diff --git a/stripe/api_resources/__init__.py b/stripe/api_resources/__init__.py deleted file mode 100644 index 4bc76839..00000000 --- a/stripe/api_resources/__init__.py +++ /dev/null @@ -1,145 +0,0 @@ -# The beginning of the section generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources import ... - To: - from stripe import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources import ( - abstract, - apps, - billing, - billing_portal, - checkout, - climate, - entitlements, - financial_connections, - forwarding, - identity, - issuing, - radar, - reporting, - sigma, - tax, - terminal, - test_helpers, - treasury, - ) - from stripe.api_resources.account import Account - from stripe.api_resources.account_link import AccountLink - from stripe.api_resources.account_session import AccountSession - from stripe.api_resources.apple_pay_domain import ApplePayDomain - from stripe.api_resources.application import Application - from stripe.api_resources.application_fee import ApplicationFee - from stripe.api_resources.application_fee_refund import ( - ApplicationFeeRefund, - ) - from stripe.api_resources.balance import Balance - from stripe.api_resources.balance_settings import BalanceSettings - from stripe.api_resources.balance_transaction import BalanceTransaction - from stripe.api_resources.bank_account import BankAccount - from stripe.api_resources.capability import Capability - from stripe.api_resources.card import Card - from stripe.api_resources.cash_balance import CashBalance - from stripe.api_resources.charge import Charge - from stripe.api_resources.confirmation_token import ConfirmationToken - from stripe.api_resources.connect_collection_transfer import ( - ConnectCollectionTransfer, - ) - from stripe.api_resources.country_spec import CountrySpec - from stripe.api_resources.coupon import Coupon - from stripe.api_resources.credit_note import CreditNote - from stripe.api_resources.credit_note_line_item import CreditNoteLineItem - from stripe.api_resources.customer import Customer - from stripe.api_resources.customer_balance_transaction import ( - CustomerBalanceTransaction, - ) - from stripe.api_resources.customer_cash_balance_transaction import ( - CustomerCashBalanceTransaction, - ) - from stripe.api_resources.customer_session import CustomerSession - from stripe.api_resources.discount import Discount - from stripe.api_resources.dispute import Dispute - from stripe.api_resources.ephemeral_key import EphemeralKey - from stripe.api_resources.event import Event - from stripe.api_resources.exchange_rate import ExchangeRate - from stripe.api_resources.file import File - from stripe.api_resources.file_link import FileLink - from stripe.api_resources.funding_instructions import FundingInstructions - from stripe.api_resources.invoice import Invoice - from stripe.api_resources.invoice_item import InvoiceItem - from stripe.api_resources.invoice_line_item import InvoiceLineItem - from stripe.api_resources.invoice_payment import InvoicePayment - from stripe.api_resources.invoice_rendering_template import ( - InvoiceRenderingTemplate, - ) - from stripe.api_resources.line_item import LineItem - from stripe.api_resources.list_object import ListObject - from stripe.api_resources.login_link import LoginLink - from stripe.api_resources.mandate import Mandate - from stripe.api_resources.payment_intent import PaymentIntent - from stripe.api_resources.payment_link import PaymentLink - from stripe.api_resources.payment_method import PaymentMethod - from stripe.api_resources.payment_method_configuration import ( - PaymentMethodConfiguration, - ) - from stripe.api_resources.payment_method_domain import PaymentMethodDomain - from stripe.api_resources.payout import Payout - from stripe.api_resources.person import Person - from stripe.api_resources.plan import Plan - from stripe.api_resources.price import Price - from stripe.api_resources.product import Product - from stripe.api_resources.product_feature import ProductFeature - from stripe.api_resources.promotion_code import PromotionCode - from stripe.api_resources.quote import Quote - from stripe.api_resources.refund import Refund - from stripe.api_resources.reserve_transaction import ReserveTransaction - from stripe.api_resources.reversal import Reversal - from stripe.api_resources.review import Review - from stripe.api_resources.search_result_object import SearchResultObject - from stripe.api_resources.setup_attempt import SetupAttempt - from stripe.api_resources.setup_intent import SetupIntent - from stripe.api_resources.shipping_rate import ShippingRate - from stripe.api_resources.source import Source - from stripe.api_resources.source_mandate_notification import ( - SourceMandateNotification, - ) - from stripe.api_resources.source_transaction import SourceTransaction - from stripe.api_resources.subscription import Subscription - from stripe.api_resources.subscription_item import SubscriptionItem - from stripe.api_resources.subscription_schedule import SubscriptionSchedule - from stripe.api_resources.tax_code import TaxCode - from stripe.api_resources.tax_deducted_at_source import TaxDeductedAtSource - from stripe.api_resources.tax_id import TaxId - from stripe.api_resources.tax_rate import TaxRate - from stripe.api_resources.token import Token - from stripe.api_resources.topup import Topup - from stripe.api_resources.transfer import Transfer - from stripe.api_resources.webhook_endpoint import WebhookEndpoint - -# The end of the section generated from our OpenAPI spec - -# These two exports are "special" and can't be handled by the generator. -# - error_object exports two symbols -# - File is renamed to FileUpload on export -# - RecipientTransfer is a manually maintained deprecated class -if not TYPE_CHECKING: - from stripe.api_resources.error_object import ErrorObject - from stripe.api_resources.error_object import ( - OAuthErrorObject, - ) - from stripe.api_resources.file import ( - File as FileUpload, - ) - - from stripe.api_resources.recipient_transfer import RecipientTransfer diff --git a/stripe/api_resources/abstract/__init__.py b/stripe/api_resources/abstract/__init__.py deleted file mode 100644 index 42e74e3b..00000000 --- a/stripe/api_resources/abstract/__init__.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.abstract package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.abstract import ... - To: - from stripe import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.abstract.api_resource import APIResource - from stripe.api_resources.abstract.createable_api_resource import ( - CreateableAPIResource, - ) - from stripe.api_resources.abstract.custom_method import custom_method - from stripe.api_resources.abstract.deletable_api_resource import ( - DeletableAPIResource, - ) - from stripe.api_resources.abstract.listable_api_resource import ( - ListableAPIResource, - ) - from stripe.api_resources.abstract.nested_resource_class_methods import ( - nested_resource_class_methods, - ) - from stripe.api_resources.abstract.searchable_api_resource import ( - SearchableAPIResource, - ) - from stripe.api_resources.abstract.singleton_api_resource import ( - SingletonAPIResource, - ) - from stripe.api_resources.abstract.test_helpers import ( - APIResourceTestHelpers, - ) - from stripe.api_resources.abstract.updateable_api_resource import ( - UpdateableAPIResource, - ) - from stripe.api_resources.abstract.verify_mixin import VerifyMixin diff --git a/stripe/api_resources/abstract/api_resource.py b/stripe/api_resources/abstract/api_resource.py deleted file mode 100644 index fe1e1c77..00000000 --- a/stripe/api_resources/abstract/api_resource.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.api_resource package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.api_resource import APIResource - To: - from stripe import APIResource - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._api_resource import ( # noqa - APIResource, - ) diff --git a/stripe/api_resources/abstract/createable_api_resource.py b/stripe/api_resources/abstract/createable_api_resource.py deleted file mode 100644 index 71ae8cff..00000000 --- a/stripe/api_resources/abstract/createable_api_resource.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.createable_api_resource package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.createable_api_resource import CreateableAPIResource - To: - from stripe import CreateableAPIResource - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._createable_api_resource import ( # noqa - CreateableAPIResource, - ) diff --git a/stripe/api_resources/abstract/custom_method.py b/stripe/api_resources/abstract/custom_method.py deleted file mode 100644 index 442c6266..00000000 --- a/stripe/api_resources/abstract/custom_method.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.custom_method package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.custom_method import custom_method - To: - from stripe import custom_method - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._custom_method import ( # noqa - custom_method, - ) diff --git a/stripe/api_resources/abstract/deletable_api_resource.py b/stripe/api_resources/abstract/deletable_api_resource.py deleted file mode 100644 index 21c07380..00000000 --- a/stripe/api_resources/abstract/deletable_api_resource.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.deletable_api_resource package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.deletable_api_resource import DeletableAPIResource - To: - from stripe import DeletableAPIResource - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._deletable_api_resource import ( # noqa - DeletableAPIResource, - ) diff --git a/stripe/api_resources/abstract/listable_api_resource.py b/stripe/api_resources/abstract/listable_api_resource.py deleted file mode 100644 index 2a8897e2..00000000 --- a/stripe/api_resources/abstract/listable_api_resource.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.listable_api_resource package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.listable_api_resource import ListableAPIResource - To: - from stripe import ListableAPIResource - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._listable_api_resource import ( # noqa - ListableAPIResource, - ) diff --git a/stripe/api_resources/abstract/nested_resource_class_methods.py b/stripe/api_resources/abstract/nested_resource_class_methods.py deleted file mode 100644 index 288c22c5..00000000 --- a/stripe/api_resources/abstract/nested_resource_class_methods.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.nested_resource_class_methods package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.nested_resource_class_methods import nested_resource_class_methods - To: - from stripe import nested_resource_class_methods - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._nested_resource_class_methods import ( # noqa - nested_resource_class_methods, - ) diff --git a/stripe/api_resources/abstract/searchable_api_resource.py b/stripe/api_resources/abstract/searchable_api_resource.py deleted file mode 100644 index 0f9f2597..00000000 --- a/stripe/api_resources/abstract/searchable_api_resource.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.searchable_api_resource package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.searchable_api_resource import SearchableAPIResource - To: - from stripe import SearchableAPIResource - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._searchable_api_resource import ( # noqa - SearchableAPIResource, - ) diff --git a/stripe/api_resources/abstract/singleton_api_resource.py b/stripe/api_resources/abstract/singleton_api_resource.py deleted file mode 100644 index 15325a43..00000000 --- a/stripe/api_resources/abstract/singleton_api_resource.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.singleton_api_resource package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.singleton_api_resource import SingletonAPIResource - To: - from stripe import SingletonAPIResource - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._singleton_api_resource import ( # noqa - SingletonAPIResource, - ) diff --git a/stripe/api_resources/abstract/test_helpers.py b/stripe/api_resources/abstract/test_helpers.py deleted file mode 100644 index 1a2133a6..00000000 --- a/stripe/api_resources/abstract/test_helpers.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.test_helpers package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.test_helpers import APIResourceTestHelpers - To: - from stripe import APIResourceTestHelpers - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._test_helpers import ( # noqa - APIResourceTestHelpers, - ) diff --git a/stripe/api_resources/abstract/updateable_api_resource.py b/stripe/api_resources/abstract/updateable_api_resource.py deleted file mode 100644 index a6820bac..00000000 --- a/stripe/api_resources/abstract/updateable_api_resource.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.updateable_api_resource package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.updateable_api_resource import UpdateableAPIResource - To: - from stripe import UpdateableAPIResource - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._updateable_api_resource import ( # noqa - UpdateableAPIResource, - ) diff --git a/stripe/api_resources/abstract/verify_mixin.py b/stripe/api_resources/abstract/verify_mixin.py deleted file mode 100644 index 799bb4b6..00000000 --- a/stripe/api_resources/abstract/verify_mixin.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.verify_mixin package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.verify_mixin import VerifyMixin - To: - from stripe import VerifyMixin - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._verify_mixin import ( # noqa - VerifyMixin, - ) diff --git a/stripe/api_resources/account.py b/stripe/api_resources/account.py deleted file mode 100644 index 4da265a7..00000000 --- a/stripe/api_resources/account.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.account package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.account import Account - To: - from stripe import Account - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._account import ( # noqa - Account, - ) diff --git a/stripe/api_resources/account_link.py b/stripe/api_resources/account_link.py deleted file mode 100644 index 85b4a775..00000000 --- a/stripe/api_resources/account_link.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.account_link package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.account_link import AccountLink - To: - from stripe import AccountLink - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._account_link import ( # noqa - AccountLink, - ) diff --git a/stripe/api_resources/account_session.py b/stripe/api_resources/account_session.py deleted file mode 100644 index e6735e1a..00000000 --- a/stripe/api_resources/account_session.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.account_session package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.account_session import AccountSession - To: - from stripe import AccountSession - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._account_session import ( # noqa - AccountSession, - ) diff --git a/stripe/api_resources/apple_pay_domain.py b/stripe/api_resources/apple_pay_domain.py deleted file mode 100644 index 809d2ff5..00000000 --- a/stripe/api_resources/apple_pay_domain.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.apple_pay_domain package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.apple_pay_domain import ApplePayDomain - To: - from stripe import ApplePayDomain - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._apple_pay_domain import ( # noqa - ApplePayDomain, - ) diff --git a/stripe/api_resources/application.py b/stripe/api_resources/application.py deleted file mode 100644 index 23202490..00000000 --- a/stripe/api_resources/application.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.application package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.application import Application - To: - from stripe import Application - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._application import ( # noqa - Application, - ) diff --git a/stripe/api_resources/application_fee.py b/stripe/api_resources/application_fee.py deleted file mode 100644 index 89f07d58..00000000 --- a/stripe/api_resources/application_fee.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.application_fee package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.application_fee import ApplicationFee - To: - from stripe import ApplicationFee - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._application_fee import ( # noqa - ApplicationFee, - ) diff --git a/stripe/api_resources/application_fee_refund.py b/stripe/api_resources/application_fee_refund.py deleted file mode 100644 index aeb95c63..00000000 --- a/stripe/api_resources/application_fee_refund.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.application_fee_refund package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.application_fee_refund import ApplicationFeeRefund - To: - from stripe import ApplicationFeeRefund - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._application_fee_refund import ( # noqa - ApplicationFeeRefund, - ) diff --git a/stripe/api_resources/apps/__init__.py b/stripe/api_resources/apps/__init__.py deleted file mode 100644 index d949fe0e..00000000 --- a/stripe/api_resources/apps/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.apps package is deprecated, please change your - imports to import from stripe.apps directly. - From: - from stripe.api_resources.apps import ... - To: - from stripe.apps import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.apps.secret import Secret diff --git a/stripe/api_resources/apps/secret.py b/stripe/api_resources/apps/secret.py deleted file mode 100644 index 86046a5f..00000000 --- a/stripe/api_resources/apps/secret.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.apps.secret package is deprecated, please change your - imports to import from stripe.apps directly. - From: - from stripe.api_resources.apps.secret import Secret - To: - from stripe.apps import Secret - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.apps._secret import ( # noqa - Secret, - ) diff --git a/stripe/api_resources/balance.py b/stripe/api_resources/balance.py deleted file mode 100644 index 230e2b0c..00000000 --- a/stripe/api_resources/balance.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.balance package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.balance import Balance - To: - from stripe import Balance - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._balance import ( # noqa - Balance, - ) diff --git a/stripe/api_resources/balance_settings.py b/stripe/api_resources/balance_settings.py deleted file mode 100644 index 8a0fa031..00000000 --- a/stripe/api_resources/balance_settings.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.balance_settings package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.balance_settings import BalanceSettings - To: - from stripe import BalanceSettings - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._balance_settings import ( # noqa - BalanceSettings, - ) diff --git a/stripe/api_resources/balance_transaction.py b/stripe/api_resources/balance_transaction.py deleted file mode 100644 index 3121fbe4..00000000 --- a/stripe/api_resources/balance_transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.balance_transaction package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.balance_transaction import BalanceTransaction - To: - from stripe import BalanceTransaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._balance_transaction import ( # noqa - BalanceTransaction, - ) diff --git a/stripe/api_resources/bank_account.py b/stripe/api_resources/bank_account.py deleted file mode 100644 index 524ce6a6..00000000 --- a/stripe/api_resources/bank_account.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.bank_account package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.bank_account import BankAccount - To: - from stripe import BankAccount - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._bank_account import ( # noqa - BankAccount, - ) diff --git a/stripe/api_resources/billing/__init__.py b/stripe/api_resources/billing/__init__.py deleted file mode 100644 index 3375658a..00000000 --- a/stripe/api_resources/billing/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing import ... - To: - from stripe.billing import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.billing.alert import Alert - from stripe.api_resources.billing.alert_triggered import AlertTriggered - from stripe.api_resources.billing.credit_balance_summary import ( - CreditBalanceSummary, - ) - from stripe.api_resources.billing.credit_balance_transaction import ( - CreditBalanceTransaction, - ) - from stripe.api_resources.billing.credit_grant import CreditGrant - from stripe.api_resources.billing.meter import Meter - from stripe.api_resources.billing.meter_event import MeterEvent - from stripe.api_resources.billing.meter_event_adjustment import ( - MeterEventAdjustment, - ) - from stripe.api_resources.billing.meter_event_summary import ( - MeterEventSummary, - ) diff --git a/stripe/api_resources/billing/alert.py b/stripe/api_resources/billing/alert.py deleted file mode 100644 index 09ccecff..00000000 --- a/stripe/api_resources/billing/alert.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing.alert package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing.alert import Alert - To: - from stripe.billing import Alert - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing._alert import ( # noqa - Alert, - ) diff --git a/stripe/api_resources/billing/alert_triggered.py b/stripe/api_resources/billing/alert_triggered.py deleted file mode 100644 index c967783e..00000000 --- a/stripe/api_resources/billing/alert_triggered.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing.alert_triggered package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing.alert_triggered import AlertTriggered - To: - from stripe.billing import AlertTriggered - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing._alert_triggered import ( # noqa - AlertTriggered, - ) diff --git a/stripe/api_resources/billing/credit_balance_summary.py b/stripe/api_resources/billing/credit_balance_summary.py deleted file mode 100644 index 48e8754c..00000000 --- a/stripe/api_resources/billing/credit_balance_summary.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing.credit_balance_summary package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing.credit_balance_summary import CreditBalanceSummary - To: - from stripe.billing import CreditBalanceSummary - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing._credit_balance_summary import ( # noqa - CreditBalanceSummary, - ) diff --git a/stripe/api_resources/billing/credit_balance_transaction.py b/stripe/api_resources/billing/credit_balance_transaction.py deleted file mode 100644 index 8797820a..00000000 --- a/stripe/api_resources/billing/credit_balance_transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing.credit_balance_transaction package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing.credit_balance_transaction import CreditBalanceTransaction - To: - from stripe.billing import CreditBalanceTransaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing._credit_balance_transaction import ( # noqa - CreditBalanceTransaction, - ) diff --git a/stripe/api_resources/billing/credit_grant.py b/stripe/api_resources/billing/credit_grant.py deleted file mode 100644 index 4d50815d..00000000 --- a/stripe/api_resources/billing/credit_grant.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing.credit_grant package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing.credit_grant import CreditGrant - To: - from stripe.billing import CreditGrant - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing._credit_grant import ( # noqa - CreditGrant, - ) diff --git a/stripe/api_resources/billing/meter.py b/stripe/api_resources/billing/meter.py deleted file mode 100644 index c750e21c..00000000 --- a/stripe/api_resources/billing/meter.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing.meter package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing.meter import Meter - To: - from stripe.billing import Meter - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing._meter import ( # noqa - Meter, - ) diff --git a/stripe/api_resources/billing/meter_event.py b/stripe/api_resources/billing/meter_event.py deleted file mode 100644 index 85e1f22f..00000000 --- a/stripe/api_resources/billing/meter_event.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing.meter_event package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing.meter_event import MeterEvent - To: - from stripe.billing import MeterEvent - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing._meter_event import ( # noqa - MeterEvent, - ) diff --git a/stripe/api_resources/billing/meter_event_adjustment.py b/stripe/api_resources/billing/meter_event_adjustment.py deleted file mode 100644 index b2be2e01..00000000 --- a/stripe/api_resources/billing/meter_event_adjustment.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing.meter_event_adjustment package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing.meter_event_adjustment import MeterEventAdjustment - To: - from stripe.billing import MeterEventAdjustment - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing._meter_event_adjustment import ( # noqa - MeterEventAdjustment, - ) diff --git a/stripe/api_resources/billing/meter_event_summary.py b/stripe/api_resources/billing/meter_event_summary.py deleted file mode 100644 index 8cf6ee4c..00000000 --- a/stripe/api_resources/billing/meter_event_summary.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing.meter_event_summary package is deprecated, please change your - imports to import from stripe.billing directly. - From: - from stripe.api_resources.billing.meter_event_summary import MeterEventSummary - To: - from stripe.billing import MeterEventSummary - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing._meter_event_summary import ( # noqa - MeterEventSummary, - ) diff --git a/stripe/api_resources/billing_portal/__init__.py b/stripe/api_resources/billing_portal/__init__.py deleted file mode 100644 index 258111d1..00000000 --- a/stripe/api_resources/billing_portal/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing_portal package is deprecated, please change your - imports to import from stripe.billing_portal directly. - From: - from stripe.api_resources.billing_portal import ... - To: - from stripe.billing_portal import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.billing_portal.configuration import Configuration - from stripe.api_resources.billing_portal.session import Session diff --git a/stripe/api_resources/billing_portal/configuration.py b/stripe/api_resources/billing_portal/configuration.py deleted file mode 100644 index fc0a4ab2..00000000 --- a/stripe/api_resources/billing_portal/configuration.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing_portal.configuration package is deprecated, please change your - imports to import from stripe.billing_portal directly. - From: - from stripe.api_resources.billing_portal.configuration import Configuration - To: - from stripe.billing_portal import Configuration - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing_portal._configuration import ( # noqa - Configuration, - ) diff --git a/stripe/api_resources/billing_portal/session.py b/stripe/api_resources/billing_portal/session.py deleted file mode 100644 index faf6f41b..00000000 --- a/stripe/api_resources/billing_portal/session.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.billing_portal.session package is deprecated, please change your - imports to import from stripe.billing_portal directly. - From: - from stripe.api_resources.billing_portal.session import Session - To: - from stripe.billing_portal import Session - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.billing_portal._session import ( # noqa - Session, - ) diff --git a/stripe/api_resources/capability.py b/stripe/api_resources/capability.py deleted file mode 100644 index 3d3d1c52..00000000 --- a/stripe/api_resources/capability.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.capability package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.capability import Capability - To: - from stripe import Capability - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._capability import ( # noqa - Capability, - ) diff --git a/stripe/api_resources/card.py b/stripe/api_resources/card.py deleted file mode 100644 index 3476fed4..00000000 --- a/stripe/api_resources/card.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.card package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.card import Card - To: - from stripe import Card - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._card import ( # noqa - Card, - ) diff --git a/stripe/api_resources/cash_balance.py b/stripe/api_resources/cash_balance.py deleted file mode 100644 index 7a2200d8..00000000 --- a/stripe/api_resources/cash_balance.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.cash_balance package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.cash_balance import CashBalance - To: - from stripe import CashBalance - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._cash_balance import ( # noqa - CashBalance, - ) diff --git a/stripe/api_resources/charge.py b/stripe/api_resources/charge.py deleted file mode 100644 index 80b19216..00000000 --- a/stripe/api_resources/charge.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.charge package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.charge import Charge - To: - from stripe import Charge - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._charge import ( # noqa - Charge, - ) diff --git a/stripe/api_resources/checkout/__init__.py b/stripe/api_resources/checkout/__init__.py deleted file mode 100644 index eaa05251..00000000 --- a/stripe/api_resources/checkout/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.checkout package is deprecated, please change your - imports to import from stripe.checkout directly. - From: - from stripe.api_resources.checkout import ... - To: - from stripe.checkout import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.checkout.session import Session diff --git a/stripe/api_resources/checkout/session.py b/stripe/api_resources/checkout/session.py deleted file mode 100644 index 65d7dd46..00000000 --- a/stripe/api_resources/checkout/session.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.checkout.session package is deprecated, please change your - imports to import from stripe.checkout directly. - From: - from stripe.api_resources.checkout.session import Session - To: - from stripe.checkout import Session - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.checkout._session import ( # noqa - Session, - ) diff --git a/stripe/api_resources/climate/__init__.py b/stripe/api_resources/climate/__init__.py deleted file mode 100644 index 0bedec1e..00000000 --- a/stripe/api_resources/climate/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.climate package is deprecated, please change your - imports to import from stripe.climate directly. - From: - from stripe.api_resources.climate import ... - To: - from stripe.climate import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.climate.order import Order - from stripe.api_resources.climate.product import Product - from stripe.api_resources.climate.supplier import Supplier diff --git a/stripe/api_resources/climate/order.py b/stripe/api_resources/climate/order.py deleted file mode 100644 index 2e84727a..00000000 --- a/stripe/api_resources/climate/order.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.climate.order package is deprecated, please change your - imports to import from stripe.climate directly. - From: - from stripe.api_resources.climate.order import Order - To: - from stripe.climate import Order - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.climate._order import ( # noqa - Order, - ) diff --git a/stripe/api_resources/climate/product.py b/stripe/api_resources/climate/product.py deleted file mode 100644 index c535a594..00000000 --- a/stripe/api_resources/climate/product.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.climate.product package is deprecated, please change your - imports to import from stripe.climate directly. - From: - from stripe.api_resources.climate.product import Product - To: - from stripe.climate import Product - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.climate._product import ( # noqa - Product, - ) diff --git a/stripe/api_resources/climate/supplier.py b/stripe/api_resources/climate/supplier.py deleted file mode 100644 index 6ab96f82..00000000 --- a/stripe/api_resources/climate/supplier.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.climate.supplier package is deprecated, please change your - imports to import from stripe.climate directly. - From: - from stripe.api_resources.climate.supplier import Supplier - To: - from stripe.climate import Supplier - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.climate._supplier import ( # noqa - Supplier, - ) diff --git a/stripe/api_resources/confirmation_token.py b/stripe/api_resources/confirmation_token.py deleted file mode 100644 index 3f0fe344..00000000 --- a/stripe/api_resources/confirmation_token.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.confirmation_token package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.confirmation_token import ConfirmationToken - To: - from stripe import ConfirmationToken - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._confirmation_token import ( # noqa - ConfirmationToken, - ) diff --git a/stripe/api_resources/connect_collection_transfer.py b/stripe/api_resources/connect_collection_transfer.py deleted file mode 100644 index 532f626e..00000000 --- a/stripe/api_resources/connect_collection_transfer.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.connect_collection_transfer package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.connect_collection_transfer import ConnectCollectionTransfer - To: - from stripe import ConnectCollectionTransfer - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._connect_collection_transfer import ( # noqa - ConnectCollectionTransfer, - ) diff --git a/stripe/api_resources/country_spec.py b/stripe/api_resources/country_spec.py deleted file mode 100644 index 1a03f507..00000000 --- a/stripe/api_resources/country_spec.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.country_spec package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.country_spec import CountrySpec - To: - from stripe import CountrySpec - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._country_spec import ( # noqa - CountrySpec, - ) diff --git a/stripe/api_resources/coupon.py b/stripe/api_resources/coupon.py deleted file mode 100644 index ccbc82a0..00000000 --- a/stripe/api_resources/coupon.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.coupon package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.coupon import Coupon - To: - from stripe import Coupon - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._coupon import ( # noqa - Coupon, - ) diff --git a/stripe/api_resources/credit_note.py b/stripe/api_resources/credit_note.py deleted file mode 100644 index e20ecc92..00000000 --- a/stripe/api_resources/credit_note.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.credit_note package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.credit_note import CreditNote - To: - from stripe import CreditNote - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._credit_note import ( # noqa - CreditNote, - ) diff --git a/stripe/api_resources/credit_note_line_item.py b/stripe/api_resources/credit_note_line_item.py deleted file mode 100644 index c6a82988..00000000 --- a/stripe/api_resources/credit_note_line_item.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.credit_note_line_item package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.credit_note_line_item import CreditNoteLineItem - To: - from stripe import CreditNoteLineItem - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._credit_note_line_item import ( # noqa - CreditNoteLineItem, - ) diff --git a/stripe/api_resources/customer.py b/stripe/api_resources/customer.py deleted file mode 100644 index dfbde2f1..00000000 --- a/stripe/api_resources/customer.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.customer package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.customer import Customer - To: - from stripe import Customer - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._customer import ( # noqa - Customer, - ) diff --git a/stripe/api_resources/customer_balance_transaction.py b/stripe/api_resources/customer_balance_transaction.py deleted file mode 100644 index 9bf45b2b..00000000 --- a/stripe/api_resources/customer_balance_transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.customer_balance_transaction package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.customer_balance_transaction import CustomerBalanceTransaction - To: - from stripe import CustomerBalanceTransaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._customer_balance_transaction import ( # noqa - CustomerBalanceTransaction, - ) diff --git a/stripe/api_resources/customer_cash_balance_transaction.py b/stripe/api_resources/customer_cash_balance_transaction.py deleted file mode 100644 index ba1e940b..00000000 --- a/stripe/api_resources/customer_cash_balance_transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.customer_cash_balance_transaction package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.customer_cash_balance_transaction import CustomerCashBalanceTransaction - To: - from stripe import CustomerCashBalanceTransaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._customer_cash_balance_transaction import ( # noqa - CustomerCashBalanceTransaction, - ) diff --git a/stripe/api_resources/customer_session.py b/stripe/api_resources/customer_session.py deleted file mode 100644 index 0d37b4ff..00000000 --- a/stripe/api_resources/customer_session.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.customer_session package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.customer_session import CustomerSession - To: - from stripe import CustomerSession - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._customer_session import ( # noqa - CustomerSession, - ) diff --git a/stripe/api_resources/discount.py b/stripe/api_resources/discount.py deleted file mode 100644 index 02fda429..00000000 --- a/stripe/api_resources/discount.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.discount package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.discount import Discount - To: - from stripe import Discount - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._discount import ( # noqa - Discount, - ) diff --git a/stripe/api_resources/dispute.py b/stripe/api_resources/dispute.py deleted file mode 100644 index 2c77da0a..00000000 --- a/stripe/api_resources/dispute.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.dispute package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.dispute import Dispute - To: - from stripe import Dispute - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._dispute import ( # noqa - Dispute, - ) diff --git a/stripe/api_resources/entitlements/__init__.py b/stripe/api_resources/entitlements/__init__.py deleted file mode 100644 index 133ae14d..00000000 --- a/stripe/api_resources/entitlements/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.entitlements package is deprecated, please change your - imports to import from stripe.entitlements directly. - From: - from stripe.api_resources.entitlements import ... - To: - from stripe.entitlements import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.entitlements.active_entitlement import ( - ActiveEntitlement, - ) - from stripe.api_resources.entitlements.active_entitlement_summary import ( - ActiveEntitlementSummary, - ) - from stripe.api_resources.entitlements.feature import Feature diff --git a/stripe/api_resources/entitlements/active_entitlement.py b/stripe/api_resources/entitlements/active_entitlement.py deleted file mode 100644 index 3e5321be..00000000 --- a/stripe/api_resources/entitlements/active_entitlement.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.entitlements.active_entitlement package is deprecated, please change your - imports to import from stripe.entitlements directly. - From: - from stripe.api_resources.entitlements.active_entitlement import ActiveEntitlement - To: - from stripe.entitlements import ActiveEntitlement - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.entitlements._active_entitlement import ( # noqa - ActiveEntitlement, - ) diff --git a/stripe/api_resources/entitlements/active_entitlement_summary.py b/stripe/api_resources/entitlements/active_entitlement_summary.py deleted file mode 100644 index ad981e56..00000000 --- a/stripe/api_resources/entitlements/active_entitlement_summary.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.entitlements.active_entitlement_summary package is deprecated, please change your - imports to import from stripe.entitlements directly. - From: - from stripe.api_resources.entitlements.active_entitlement_summary import ActiveEntitlementSummary - To: - from stripe.entitlements import ActiveEntitlementSummary - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.entitlements._active_entitlement_summary import ( # noqa - ActiveEntitlementSummary, - ) diff --git a/stripe/api_resources/entitlements/feature.py b/stripe/api_resources/entitlements/feature.py deleted file mode 100644 index 888e561d..00000000 --- a/stripe/api_resources/entitlements/feature.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.entitlements.feature package is deprecated, please change your - imports to import from stripe.entitlements directly. - From: - from stripe.api_resources.entitlements.feature import Feature - To: - from stripe.entitlements import Feature - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.entitlements._feature import ( # noqa - Feature, - ) diff --git a/stripe/api_resources/ephemeral_key.py b/stripe/api_resources/ephemeral_key.py deleted file mode 100644 index eca3b349..00000000 --- a/stripe/api_resources/ephemeral_key.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.ephemeral_key package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.ephemeral_key import EphemeralKey - To: - from stripe import EphemeralKey - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._ephemeral_key import ( # noqa - EphemeralKey, - ) diff --git a/stripe/api_resources/error_object.py b/stripe/api_resources/error_object.py deleted file mode 100644 index d1443e98..00000000 --- a/stripe/api_resources/error_object.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.error_object package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.error_object import ErrorObject - To: - from stripe import ErrorObject - """, - DeprecationWarning, -) -if not TYPE_CHECKING: - from stripe._error_object import ( # noqa - ErrorObject, - OAuthErrorObject, - ) diff --git a/stripe/api_resources/event.py b/stripe/api_resources/event.py deleted file mode 100644 index 85d2f48b..00000000 --- a/stripe/api_resources/event.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.event package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.event import Event - To: - from stripe import Event - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._event import ( # noqa - Event, - ) diff --git a/stripe/api_resources/exchange_rate.py b/stripe/api_resources/exchange_rate.py deleted file mode 100644 index 989b63d2..00000000 --- a/stripe/api_resources/exchange_rate.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.exchange_rate package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.exchange_rate import ExchangeRate - To: - from stripe import ExchangeRate - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._exchange_rate import ( # noqa - ExchangeRate, - ) diff --git a/stripe/api_resources/file.py b/stripe/api_resources/file.py deleted file mode 100644 index f335fc94..00000000 --- a/stripe/api_resources/file.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.file package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.file import File - To: - from stripe import File - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._file import ( # noqa - File, - ) diff --git a/stripe/api_resources/file_link.py b/stripe/api_resources/file_link.py deleted file mode 100644 index 026d2e86..00000000 --- a/stripe/api_resources/file_link.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.file_link package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.file_link import FileLink - To: - from stripe import FileLink - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._file_link import ( # noqa - FileLink, - ) diff --git a/stripe/api_resources/financial_connections/__init__.py b/stripe/api_resources/financial_connections/__init__.py deleted file mode 100644 index cb37648d..00000000 --- a/stripe/api_resources/financial_connections/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.financial_connections package is deprecated, please change your - imports to import from stripe.financial_connections directly. - From: - from stripe.api_resources.financial_connections import ... - To: - from stripe.financial_connections import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.financial_connections.account import Account - from stripe.api_resources.financial_connections.account_owner import ( - AccountOwner, - ) - from stripe.api_resources.financial_connections.account_ownership import ( - AccountOwnership, - ) - from stripe.api_resources.financial_connections.session import Session - from stripe.api_resources.financial_connections.transaction import ( - Transaction, - ) diff --git a/stripe/api_resources/financial_connections/account.py b/stripe/api_resources/financial_connections/account.py deleted file mode 100644 index 6da36233..00000000 --- a/stripe/api_resources/financial_connections/account.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.financial_connections.account package is deprecated, please change your - imports to import from stripe.financial_connections directly. - From: - from stripe.api_resources.financial_connections.account import Account - To: - from stripe.financial_connections import Account - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.financial_connections._account import ( # noqa - Account, - ) diff --git a/stripe/api_resources/financial_connections/account_owner.py b/stripe/api_resources/financial_connections/account_owner.py deleted file mode 100644 index b3539a12..00000000 --- a/stripe/api_resources/financial_connections/account_owner.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.financial_connections.account_owner package is deprecated, please change your - imports to import from stripe.financial_connections directly. - From: - from stripe.api_resources.financial_connections.account_owner import AccountOwner - To: - from stripe.financial_connections import AccountOwner - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.financial_connections._account_owner import ( # noqa - AccountOwner, - ) diff --git a/stripe/api_resources/financial_connections/account_ownership.py b/stripe/api_resources/financial_connections/account_ownership.py deleted file mode 100644 index ffa6dadb..00000000 --- a/stripe/api_resources/financial_connections/account_ownership.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.financial_connections.account_ownership package is deprecated, please change your - imports to import from stripe.financial_connections directly. - From: - from stripe.api_resources.financial_connections.account_ownership import AccountOwnership - To: - from stripe.financial_connections import AccountOwnership - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.financial_connections._account_ownership import ( # noqa - AccountOwnership, - ) diff --git a/stripe/api_resources/financial_connections/session.py b/stripe/api_resources/financial_connections/session.py deleted file mode 100644 index f8a7a440..00000000 --- a/stripe/api_resources/financial_connections/session.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.financial_connections.session package is deprecated, please change your - imports to import from stripe.financial_connections directly. - From: - from stripe.api_resources.financial_connections.session import Session - To: - from stripe.financial_connections import Session - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.financial_connections._session import ( # noqa - Session, - ) diff --git a/stripe/api_resources/financial_connections/transaction.py b/stripe/api_resources/financial_connections/transaction.py deleted file mode 100644 index 73c0e007..00000000 --- a/stripe/api_resources/financial_connections/transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.financial_connections.transaction package is deprecated, please change your - imports to import from stripe.financial_connections directly. - From: - from stripe.api_resources.financial_connections.transaction import Transaction - To: - from stripe.financial_connections import Transaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.financial_connections._transaction import ( # noqa - Transaction, - ) diff --git a/stripe/api_resources/forwarding/__init__.py b/stripe/api_resources/forwarding/__init__.py deleted file mode 100644 index 2ca62e37..00000000 --- a/stripe/api_resources/forwarding/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.forwarding package is deprecated, please change your - imports to import from stripe.forwarding directly. - From: - from stripe.api_resources.forwarding import ... - To: - from stripe.forwarding import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.forwarding.request import Request diff --git a/stripe/api_resources/forwarding/request.py b/stripe/api_resources/forwarding/request.py deleted file mode 100644 index 26e6969f..00000000 --- a/stripe/api_resources/forwarding/request.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.forwarding.request package is deprecated, please change your - imports to import from stripe.forwarding directly. - From: - from stripe.api_resources.forwarding.request import Request - To: - from stripe.forwarding import Request - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.forwarding._request import ( # noqa - Request, - ) diff --git a/stripe/api_resources/funding_instructions.py b/stripe/api_resources/funding_instructions.py deleted file mode 100644 index e4ed9dd0..00000000 --- a/stripe/api_resources/funding_instructions.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.funding_instructions package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.funding_instructions import FundingInstructions - To: - from stripe import FundingInstructions - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._funding_instructions import ( # noqa - FundingInstructions, - ) diff --git a/stripe/api_resources/identity/__init__.py b/stripe/api_resources/identity/__init__.py deleted file mode 100644 index a14d4442..00000000 --- a/stripe/api_resources/identity/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.identity package is deprecated, please change your - imports to import from stripe.identity directly. - From: - from stripe.api_resources.identity import ... - To: - from stripe.identity import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.identity.verification_report import ( - VerificationReport, - ) - from stripe.api_resources.identity.verification_session import ( - VerificationSession, - ) diff --git a/stripe/api_resources/identity/verification_report.py b/stripe/api_resources/identity/verification_report.py deleted file mode 100644 index a27b2023..00000000 --- a/stripe/api_resources/identity/verification_report.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.identity.verification_report package is deprecated, please change your - imports to import from stripe.identity directly. - From: - from stripe.api_resources.identity.verification_report import VerificationReport - To: - from stripe.identity import VerificationReport - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.identity._verification_report import ( # noqa - VerificationReport, - ) diff --git a/stripe/api_resources/identity/verification_session.py b/stripe/api_resources/identity/verification_session.py deleted file mode 100644 index 45493c09..00000000 --- a/stripe/api_resources/identity/verification_session.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.identity.verification_session package is deprecated, please change your - imports to import from stripe.identity directly. - From: - from stripe.api_resources.identity.verification_session import VerificationSession - To: - from stripe.identity import VerificationSession - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.identity._verification_session import ( # noqa - VerificationSession, - ) diff --git a/stripe/api_resources/invoice.py b/stripe/api_resources/invoice.py deleted file mode 100644 index 71c72939..00000000 --- a/stripe/api_resources/invoice.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.invoice package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.invoice import Invoice - To: - from stripe import Invoice - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._invoice import ( # noqa - Invoice, - ) diff --git a/stripe/api_resources/invoice_item.py b/stripe/api_resources/invoice_item.py deleted file mode 100644 index f97ac416..00000000 --- a/stripe/api_resources/invoice_item.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.invoice_item package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.invoice_item import InvoiceItem - To: - from stripe import InvoiceItem - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._invoice_item import ( # noqa - InvoiceItem, - ) diff --git a/stripe/api_resources/invoice_line_item.py b/stripe/api_resources/invoice_line_item.py deleted file mode 100644 index 0f4e8d9a..00000000 --- a/stripe/api_resources/invoice_line_item.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.invoice_line_item package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.invoice_line_item import InvoiceLineItem - To: - from stripe import InvoiceLineItem - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._invoice_line_item import ( # noqa - InvoiceLineItem, - ) diff --git a/stripe/api_resources/invoice_payment.py b/stripe/api_resources/invoice_payment.py deleted file mode 100644 index 48d80465..00000000 --- a/stripe/api_resources/invoice_payment.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.invoice_payment package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.invoice_payment import InvoicePayment - To: - from stripe import InvoicePayment - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._invoice_payment import ( # noqa - InvoicePayment, - ) diff --git a/stripe/api_resources/invoice_rendering_template.py b/stripe/api_resources/invoice_rendering_template.py deleted file mode 100644 index e0b96650..00000000 --- a/stripe/api_resources/invoice_rendering_template.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.invoice_rendering_template package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.invoice_rendering_template import InvoiceRenderingTemplate - To: - from stripe import InvoiceRenderingTemplate - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._invoice_rendering_template import ( # noqa - InvoiceRenderingTemplate, - ) diff --git a/stripe/api_resources/issuing/__init__.py b/stripe/api_resources/issuing/__init__.py deleted file mode 100644 index 33190567..00000000 --- a/stripe/api_resources/issuing/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.issuing package is deprecated, please change your - imports to import from stripe.issuing directly. - From: - from stripe.api_resources.issuing import ... - To: - from stripe.issuing import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.issuing.authorization import Authorization - from stripe.api_resources.issuing.card import Card - from stripe.api_resources.issuing.cardholder import Cardholder - from stripe.api_resources.issuing.dispute import Dispute - from stripe.api_resources.issuing.personalization_design import ( - PersonalizationDesign, - ) - from stripe.api_resources.issuing.physical_bundle import PhysicalBundle - from stripe.api_resources.issuing.token import Token - from stripe.api_resources.issuing.transaction import Transaction diff --git a/stripe/api_resources/issuing/authorization.py b/stripe/api_resources/issuing/authorization.py deleted file mode 100644 index 83eb3b07..00000000 --- a/stripe/api_resources/issuing/authorization.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.issuing.authorization package is deprecated, please change your - imports to import from stripe.issuing directly. - From: - from stripe.api_resources.issuing.authorization import Authorization - To: - from stripe.issuing import Authorization - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.issuing._authorization import ( # noqa - Authorization, - ) diff --git a/stripe/api_resources/issuing/card.py b/stripe/api_resources/issuing/card.py deleted file mode 100644 index eec21ad0..00000000 --- a/stripe/api_resources/issuing/card.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.issuing.card package is deprecated, please change your - imports to import from stripe.issuing directly. - From: - from stripe.api_resources.issuing.card import Card - To: - from stripe.issuing import Card - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.issuing._card import ( # noqa - Card, - ) diff --git a/stripe/api_resources/issuing/cardholder.py b/stripe/api_resources/issuing/cardholder.py deleted file mode 100644 index 67109914..00000000 --- a/stripe/api_resources/issuing/cardholder.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.issuing.cardholder package is deprecated, please change your - imports to import from stripe.issuing directly. - From: - from stripe.api_resources.issuing.cardholder import Cardholder - To: - from stripe.issuing import Cardholder - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.issuing._cardholder import ( # noqa - Cardholder, - ) diff --git a/stripe/api_resources/issuing/dispute.py b/stripe/api_resources/issuing/dispute.py deleted file mode 100644 index 571b0542..00000000 --- a/stripe/api_resources/issuing/dispute.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.issuing.dispute package is deprecated, please change your - imports to import from stripe.issuing directly. - From: - from stripe.api_resources.issuing.dispute import Dispute - To: - from stripe.issuing import Dispute - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.issuing._dispute import ( # noqa - Dispute, - ) diff --git a/stripe/api_resources/issuing/personalization_design.py b/stripe/api_resources/issuing/personalization_design.py deleted file mode 100644 index 2b65c1db..00000000 --- a/stripe/api_resources/issuing/personalization_design.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.issuing.personalization_design package is deprecated, please change your - imports to import from stripe.issuing directly. - From: - from stripe.api_resources.issuing.personalization_design import PersonalizationDesign - To: - from stripe.issuing import PersonalizationDesign - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.issuing._personalization_design import ( # noqa - PersonalizationDesign, - ) diff --git a/stripe/api_resources/issuing/physical_bundle.py b/stripe/api_resources/issuing/physical_bundle.py deleted file mode 100644 index ea29db06..00000000 --- a/stripe/api_resources/issuing/physical_bundle.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.issuing.physical_bundle package is deprecated, please change your - imports to import from stripe.issuing directly. - From: - from stripe.api_resources.issuing.physical_bundle import PhysicalBundle - To: - from stripe.issuing import PhysicalBundle - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.issuing._physical_bundle import ( # noqa - PhysicalBundle, - ) diff --git a/stripe/api_resources/issuing/token.py b/stripe/api_resources/issuing/token.py deleted file mode 100644 index 36675f4a..00000000 --- a/stripe/api_resources/issuing/token.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.issuing.token package is deprecated, please change your - imports to import from stripe.issuing directly. - From: - from stripe.api_resources.issuing.token import Token - To: - from stripe.issuing import Token - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.issuing._token import ( # noqa - Token, - ) diff --git a/stripe/api_resources/issuing/transaction.py b/stripe/api_resources/issuing/transaction.py deleted file mode 100644 index 897e5788..00000000 --- a/stripe/api_resources/issuing/transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.issuing.transaction package is deprecated, please change your - imports to import from stripe.issuing directly. - From: - from stripe.api_resources.issuing.transaction import Transaction - To: - from stripe.issuing import Transaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.issuing._transaction import ( # noqa - Transaction, - ) diff --git a/stripe/api_resources/line_item.py b/stripe/api_resources/line_item.py deleted file mode 100644 index be6f9225..00000000 --- a/stripe/api_resources/line_item.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.line_item package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.line_item import LineItem - To: - from stripe import LineItem - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._line_item import ( # noqa - LineItem, - ) diff --git a/stripe/api_resources/list_object.py b/stripe/api_resources/list_object.py deleted file mode 100644 index 6f5c80fb..00000000 --- a/stripe/api_resources/list_object.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.list_object package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.list_object import ListObject - To: - from stripe import ListObject - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._list_object import ( # noqa - ListObject, - ) diff --git a/stripe/api_resources/login_link.py b/stripe/api_resources/login_link.py deleted file mode 100644 index 612d73b4..00000000 --- a/stripe/api_resources/login_link.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.login_link package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.login_link import LoginLink - To: - from stripe import LoginLink - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._login_link import ( # noqa - LoginLink, - ) diff --git a/stripe/api_resources/mandate.py b/stripe/api_resources/mandate.py deleted file mode 100644 index 8b699b9e..00000000 --- a/stripe/api_resources/mandate.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.mandate package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.mandate import Mandate - To: - from stripe import Mandate - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._mandate import ( # noqa - Mandate, - ) diff --git a/stripe/api_resources/payment_intent.py b/stripe/api_resources/payment_intent.py deleted file mode 100644 index 6aa2110d..00000000 --- a/stripe/api_resources/payment_intent.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.payment_intent package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.payment_intent import PaymentIntent - To: - from stripe import PaymentIntent - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._payment_intent import ( # noqa - PaymentIntent, - ) diff --git a/stripe/api_resources/payment_link.py b/stripe/api_resources/payment_link.py deleted file mode 100644 index 61b6f592..00000000 --- a/stripe/api_resources/payment_link.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.payment_link package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.payment_link import PaymentLink - To: - from stripe import PaymentLink - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._payment_link import ( # noqa - PaymentLink, - ) diff --git a/stripe/api_resources/payment_method.py b/stripe/api_resources/payment_method.py deleted file mode 100644 index fda536ff..00000000 --- a/stripe/api_resources/payment_method.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.payment_method package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.payment_method import PaymentMethod - To: - from stripe import PaymentMethod - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._payment_method import ( # noqa - PaymentMethod, - ) diff --git a/stripe/api_resources/payment_method_configuration.py b/stripe/api_resources/payment_method_configuration.py deleted file mode 100644 index 8030fe3b..00000000 --- a/stripe/api_resources/payment_method_configuration.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.payment_method_configuration package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.payment_method_configuration import PaymentMethodConfiguration - To: - from stripe import PaymentMethodConfiguration - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._payment_method_configuration import ( # noqa - PaymentMethodConfiguration, - ) diff --git a/stripe/api_resources/payment_method_domain.py b/stripe/api_resources/payment_method_domain.py deleted file mode 100644 index eb0971a6..00000000 --- a/stripe/api_resources/payment_method_domain.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.payment_method_domain package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.payment_method_domain import PaymentMethodDomain - To: - from stripe import PaymentMethodDomain - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._payment_method_domain import ( # noqa - PaymentMethodDomain, - ) diff --git a/stripe/api_resources/payout.py b/stripe/api_resources/payout.py deleted file mode 100644 index f6fbc4b1..00000000 --- a/stripe/api_resources/payout.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.payout package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.payout import Payout - To: - from stripe import Payout - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._payout import ( # noqa - Payout, - ) diff --git a/stripe/api_resources/person.py b/stripe/api_resources/person.py deleted file mode 100644 index bb644f1f..00000000 --- a/stripe/api_resources/person.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.person package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.person import Person - To: - from stripe import Person - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._person import ( # noqa - Person, - ) diff --git a/stripe/api_resources/plan.py b/stripe/api_resources/plan.py deleted file mode 100644 index 53993749..00000000 --- a/stripe/api_resources/plan.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.plan package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.plan import Plan - To: - from stripe import Plan - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._plan import ( # noqa - Plan, - ) diff --git a/stripe/api_resources/price.py b/stripe/api_resources/price.py deleted file mode 100644 index 3f2c3754..00000000 --- a/stripe/api_resources/price.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.price package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.price import Price - To: - from stripe import Price - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._price import ( # noqa - Price, - ) diff --git a/stripe/api_resources/product.py b/stripe/api_resources/product.py deleted file mode 100644 index 2458af4b..00000000 --- a/stripe/api_resources/product.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.product package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.product import Product - To: - from stripe import Product - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._product import ( # noqa - Product, - ) diff --git a/stripe/api_resources/product_feature.py b/stripe/api_resources/product_feature.py deleted file mode 100644 index e01cf617..00000000 --- a/stripe/api_resources/product_feature.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.product_feature package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.product_feature import ProductFeature - To: - from stripe import ProductFeature - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._product_feature import ( # noqa - ProductFeature, - ) diff --git a/stripe/api_resources/promotion_code.py b/stripe/api_resources/promotion_code.py deleted file mode 100644 index d2ab9dfd..00000000 --- a/stripe/api_resources/promotion_code.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.promotion_code package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.promotion_code import PromotionCode - To: - from stripe import PromotionCode - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._promotion_code import ( # noqa - PromotionCode, - ) diff --git a/stripe/api_resources/quote.py b/stripe/api_resources/quote.py deleted file mode 100644 index 71ba4bbf..00000000 --- a/stripe/api_resources/quote.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.quote package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.quote import Quote - To: - from stripe import Quote - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._quote import ( # noqa - Quote, - ) diff --git a/stripe/api_resources/radar/__init__.py b/stripe/api_resources/radar/__init__.py deleted file mode 100644 index f9307cff..00000000 --- a/stripe/api_resources/radar/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.radar package is deprecated, please change your - imports to import from stripe.radar directly. - From: - from stripe.api_resources.radar import ... - To: - from stripe.radar import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.radar.early_fraud_warning import ( - EarlyFraudWarning, - ) - from stripe.api_resources.radar.value_list import ValueList - from stripe.api_resources.radar.value_list_item import ValueListItem diff --git a/stripe/api_resources/radar/early_fraud_warning.py b/stripe/api_resources/radar/early_fraud_warning.py deleted file mode 100644 index 2477ff1d..00000000 --- a/stripe/api_resources/radar/early_fraud_warning.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.radar.early_fraud_warning package is deprecated, please change your - imports to import from stripe.radar directly. - From: - from stripe.api_resources.radar.early_fraud_warning import EarlyFraudWarning - To: - from stripe.radar import EarlyFraudWarning - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.radar._early_fraud_warning import ( # noqa - EarlyFraudWarning, - ) diff --git a/stripe/api_resources/radar/value_list.py b/stripe/api_resources/radar/value_list.py deleted file mode 100644 index 6444e19b..00000000 --- a/stripe/api_resources/radar/value_list.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.radar.value_list package is deprecated, please change your - imports to import from stripe.radar directly. - From: - from stripe.api_resources.radar.value_list import ValueList - To: - from stripe.radar import ValueList - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.radar._value_list import ( # noqa - ValueList, - ) diff --git a/stripe/api_resources/radar/value_list_item.py b/stripe/api_resources/radar/value_list_item.py deleted file mode 100644 index 1340ca61..00000000 --- a/stripe/api_resources/radar/value_list_item.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.radar.value_list_item package is deprecated, please change your - imports to import from stripe.radar directly. - From: - from stripe.api_resources.radar.value_list_item import ValueListItem - To: - from stripe.radar import ValueListItem - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.radar._value_list_item import ( # noqa - ValueListItem, - ) diff --git a/stripe/api_resources/recipient_transfer.py b/stripe/api_resources/recipient_transfer.py deleted file mode 100644 index 1d7d8ec5..00000000 --- a/stripe/api_resources/recipient_transfer.py +++ /dev/null @@ -1,15 +0,0 @@ -from stripe._stripe_object import StripeObject - -from warnings import warn - -warn( - """ - The RecipientTransfer class is deprecated and will be removed in a future - """, - DeprecationWarning, - stacklevel=2, -) - - -class RecipientTransfer(StripeObject): - OBJECT_NAME = "recipient_transfer" diff --git a/stripe/api_resources/refund.py b/stripe/api_resources/refund.py deleted file mode 100644 index 8fb0bfd0..00000000 --- a/stripe/api_resources/refund.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.refund package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.refund import Refund - To: - from stripe import Refund - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._refund import ( # noqa - Refund, - ) diff --git a/stripe/api_resources/reporting/__init__.py b/stripe/api_resources/reporting/__init__.py deleted file mode 100644 index 641b9c60..00000000 --- a/stripe/api_resources/reporting/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.reporting package is deprecated, please change your - imports to import from stripe.reporting directly. - From: - from stripe.api_resources.reporting import ... - To: - from stripe.reporting import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.reporting.report_run import ReportRun - from stripe.api_resources.reporting.report_type import ReportType diff --git a/stripe/api_resources/reporting/report_run.py b/stripe/api_resources/reporting/report_run.py deleted file mode 100644 index b5668626..00000000 --- a/stripe/api_resources/reporting/report_run.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.reporting.report_run package is deprecated, please change your - imports to import from stripe.reporting directly. - From: - from stripe.api_resources.reporting.report_run import ReportRun - To: - from stripe.reporting import ReportRun - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.reporting._report_run import ( # noqa - ReportRun, - ) diff --git a/stripe/api_resources/reporting/report_type.py b/stripe/api_resources/reporting/report_type.py deleted file mode 100644 index d1e35695..00000000 --- a/stripe/api_resources/reporting/report_type.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.reporting.report_type package is deprecated, please change your - imports to import from stripe.reporting directly. - From: - from stripe.api_resources.reporting.report_type import ReportType - To: - from stripe.reporting import ReportType - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.reporting._report_type import ( # noqa - ReportType, - ) diff --git a/stripe/api_resources/reserve_transaction.py b/stripe/api_resources/reserve_transaction.py deleted file mode 100644 index da7eb01a..00000000 --- a/stripe/api_resources/reserve_transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.reserve_transaction package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.reserve_transaction import ReserveTransaction - To: - from stripe import ReserveTransaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._reserve_transaction import ( # noqa - ReserveTransaction, - ) diff --git a/stripe/api_resources/reversal.py b/stripe/api_resources/reversal.py deleted file mode 100644 index 2e80cf90..00000000 --- a/stripe/api_resources/reversal.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.reversal package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.reversal import Reversal - To: - from stripe import Reversal - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._reversal import ( # noqa - Reversal, - ) diff --git a/stripe/api_resources/review.py b/stripe/api_resources/review.py deleted file mode 100644 index b4b6bf12..00000000 --- a/stripe/api_resources/review.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.review package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.review import Review - To: - from stripe import Review - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._review import ( # noqa - Review, - ) diff --git a/stripe/api_resources/search_result_object.py b/stripe/api_resources/search_result_object.py deleted file mode 100644 index 46e0728e..00000000 --- a/stripe/api_resources/search_result_object.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.search_result_object package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.search_result_object import SearchResultObject - To: - from stripe import SearchResultObject - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._search_result_object import ( # noqa - SearchResultObject, - ) diff --git a/stripe/api_resources/setup_attempt.py b/stripe/api_resources/setup_attempt.py deleted file mode 100644 index 97bd829a..00000000 --- a/stripe/api_resources/setup_attempt.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.setup_attempt package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.setup_attempt import SetupAttempt - To: - from stripe import SetupAttempt - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._setup_attempt import ( # noqa - SetupAttempt, - ) diff --git a/stripe/api_resources/setup_intent.py b/stripe/api_resources/setup_intent.py deleted file mode 100644 index 9e0e3bce..00000000 --- a/stripe/api_resources/setup_intent.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.setup_intent package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.setup_intent import SetupIntent - To: - from stripe import SetupIntent - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._setup_intent import ( # noqa - SetupIntent, - ) diff --git a/stripe/api_resources/shipping_rate.py b/stripe/api_resources/shipping_rate.py deleted file mode 100644 index 61414949..00000000 --- a/stripe/api_resources/shipping_rate.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.shipping_rate package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.shipping_rate import ShippingRate - To: - from stripe import ShippingRate - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._shipping_rate import ( # noqa - ShippingRate, - ) diff --git a/stripe/api_resources/sigma/__init__.py b/stripe/api_resources/sigma/__init__.py deleted file mode 100644 index 36f3cb7f..00000000 --- a/stripe/api_resources/sigma/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.sigma package is deprecated, please change your - imports to import from stripe.sigma directly. - From: - from stripe.api_resources.sigma import ... - To: - from stripe.sigma import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.sigma.scheduled_query_run import ( - ScheduledQueryRun, - ) diff --git a/stripe/api_resources/sigma/scheduled_query_run.py b/stripe/api_resources/sigma/scheduled_query_run.py deleted file mode 100644 index c47938a1..00000000 --- a/stripe/api_resources/sigma/scheduled_query_run.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.sigma.scheduled_query_run package is deprecated, please change your - imports to import from stripe.sigma directly. - From: - from stripe.api_resources.sigma.scheduled_query_run import ScheduledQueryRun - To: - from stripe.sigma import ScheduledQueryRun - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.sigma._scheduled_query_run import ( # noqa - ScheduledQueryRun, - ) diff --git a/stripe/api_resources/source.py b/stripe/api_resources/source.py deleted file mode 100644 index 9bfca6d2..00000000 --- a/stripe/api_resources/source.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.source package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.source import Source - To: - from stripe import Source - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._source import ( # noqa - Source, - ) diff --git a/stripe/api_resources/source_mandate_notification.py b/stripe/api_resources/source_mandate_notification.py deleted file mode 100644 index 09b2d589..00000000 --- a/stripe/api_resources/source_mandate_notification.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.source_mandate_notification package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.source_mandate_notification import SourceMandateNotification - To: - from stripe import SourceMandateNotification - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._source_mandate_notification import ( # noqa - SourceMandateNotification, - ) diff --git a/stripe/api_resources/source_transaction.py b/stripe/api_resources/source_transaction.py deleted file mode 100644 index 99b4faed..00000000 --- a/stripe/api_resources/source_transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.source_transaction package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.source_transaction import SourceTransaction - To: - from stripe import SourceTransaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._source_transaction import ( # noqa - SourceTransaction, - ) diff --git a/stripe/api_resources/subscription.py b/stripe/api_resources/subscription.py deleted file mode 100644 index e5fbe7db..00000000 --- a/stripe/api_resources/subscription.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.subscription package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.subscription import Subscription - To: - from stripe import Subscription - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._subscription import ( # noqa - Subscription, - ) diff --git a/stripe/api_resources/subscription_item.py b/stripe/api_resources/subscription_item.py deleted file mode 100644 index 4ee30b2b..00000000 --- a/stripe/api_resources/subscription_item.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.subscription_item package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.subscription_item import SubscriptionItem - To: - from stripe import SubscriptionItem - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._subscription_item import ( # noqa - SubscriptionItem, - ) diff --git a/stripe/api_resources/subscription_schedule.py b/stripe/api_resources/subscription_schedule.py deleted file mode 100644 index ebc54b5a..00000000 --- a/stripe/api_resources/subscription_schedule.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.subscription_schedule package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.subscription_schedule import SubscriptionSchedule - To: - from stripe import SubscriptionSchedule - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._subscription_schedule import ( # noqa - SubscriptionSchedule, - ) diff --git a/stripe/api_resources/tax/__init__.py b/stripe/api_resources/tax/__init__.py deleted file mode 100644 index aba7ea02..00000000 --- a/stripe/api_resources/tax/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax package is deprecated, please change your - imports to import from stripe.tax directly. - From: - from stripe.api_resources.tax import ... - To: - from stripe.tax import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.tax.calculation import Calculation - from stripe.api_resources.tax.calculation_line_item import ( - CalculationLineItem, - ) - from stripe.api_resources.tax.registration import Registration - from stripe.api_resources.tax.settings import Settings - from stripe.api_resources.tax.transaction import Transaction - from stripe.api_resources.tax.transaction_line_item import ( - TransactionLineItem, - ) diff --git a/stripe/api_resources/tax/calculation.py b/stripe/api_resources/tax/calculation.py deleted file mode 100644 index afa7cb7a..00000000 --- a/stripe/api_resources/tax/calculation.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax.calculation package is deprecated, please change your - imports to import from stripe.tax directly. - From: - from stripe.api_resources.tax.calculation import Calculation - To: - from stripe.tax import Calculation - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.tax._calculation import ( # noqa - Calculation, - ) diff --git a/stripe/api_resources/tax/calculation_line_item.py b/stripe/api_resources/tax/calculation_line_item.py deleted file mode 100644 index feed190b..00000000 --- a/stripe/api_resources/tax/calculation_line_item.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax.calculation_line_item package is deprecated, please change your - imports to import from stripe.tax directly. - From: - from stripe.api_resources.tax.calculation_line_item import CalculationLineItem - To: - from stripe.tax import CalculationLineItem - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.tax._calculation_line_item import ( # noqa - CalculationLineItem, - ) diff --git a/stripe/api_resources/tax/registration.py b/stripe/api_resources/tax/registration.py deleted file mode 100644 index 05762f0b..00000000 --- a/stripe/api_resources/tax/registration.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax.registration package is deprecated, please change your - imports to import from stripe.tax directly. - From: - from stripe.api_resources.tax.registration import Registration - To: - from stripe.tax import Registration - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.tax._registration import ( # noqa - Registration, - ) diff --git a/stripe/api_resources/tax/settings.py b/stripe/api_resources/tax/settings.py deleted file mode 100644 index 7402ce4a..00000000 --- a/stripe/api_resources/tax/settings.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax.settings package is deprecated, please change your - imports to import from stripe.tax directly. - From: - from stripe.api_resources.tax.settings import Settings - To: - from stripe.tax import Settings - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.tax._settings import ( # noqa - Settings, - ) diff --git a/stripe/api_resources/tax/transaction.py b/stripe/api_resources/tax/transaction.py deleted file mode 100644 index 54fe3110..00000000 --- a/stripe/api_resources/tax/transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax.transaction package is deprecated, please change your - imports to import from stripe.tax directly. - From: - from stripe.api_resources.tax.transaction import Transaction - To: - from stripe.tax import Transaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.tax._transaction import ( # noqa - Transaction, - ) diff --git a/stripe/api_resources/tax/transaction_line_item.py b/stripe/api_resources/tax/transaction_line_item.py deleted file mode 100644 index 69399886..00000000 --- a/stripe/api_resources/tax/transaction_line_item.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax.transaction_line_item package is deprecated, please change your - imports to import from stripe.tax directly. - From: - from stripe.api_resources.tax.transaction_line_item import TransactionLineItem - To: - from stripe.tax import TransactionLineItem - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.tax._transaction_line_item import ( # noqa - TransactionLineItem, - ) diff --git a/stripe/api_resources/tax_code.py b/stripe/api_resources/tax_code.py deleted file mode 100644 index d3a48f2c..00000000 --- a/stripe/api_resources/tax_code.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax_code package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.tax_code import TaxCode - To: - from stripe import TaxCode - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._tax_code import ( # noqa - TaxCode, - ) diff --git a/stripe/api_resources/tax_deducted_at_source.py b/stripe/api_resources/tax_deducted_at_source.py deleted file mode 100644 index d85343a6..00000000 --- a/stripe/api_resources/tax_deducted_at_source.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax_deducted_at_source package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.tax_deducted_at_source import TaxDeductedAtSource - To: - from stripe import TaxDeductedAtSource - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._tax_deducted_at_source import ( # noqa - TaxDeductedAtSource, - ) diff --git a/stripe/api_resources/tax_id.py b/stripe/api_resources/tax_id.py deleted file mode 100644 index 539c0f9b..00000000 --- a/stripe/api_resources/tax_id.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax_id package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.tax_id import TaxId - To: - from stripe import TaxId - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._tax_id import ( # noqa - TaxId, - ) diff --git a/stripe/api_resources/tax_rate.py b/stripe/api_resources/tax_rate.py deleted file mode 100644 index 47c1532b..00000000 --- a/stripe/api_resources/tax_rate.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.tax_rate package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.tax_rate import TaxRate - To: - from stripe import TaxRate - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._tax_rate import ( # noqa - TaxRate, - ) diff --git a/stripe/api_resources/terminal/__init__.py b/stripe/api_resources/terminal/__init__.py deleted file mode 100644 index 7e4cab63..00000000 --- a/stripe/api_resources/terminal/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.terminal package is deprecated, please change your - imports to import from stripe.terminal directly. - From: - from stripe.api_resources.terminal import ... - To: - from stripe.terminal import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.terminal.configuration import Configuration - from stripe.api_resources.terminal.connection_token import ConnectionToken - from stripe.api_resources.terminal.location import Location - from stripe.api_resources.terminal.reader import Reader diff --git a/stripe/api_resources/terminal/configuration.py b/stripe/api_resources/terminal/configuration.py deleted file mode 100644 index d4f90883..00000000 --- a/stripe/api_resources/terminal/configuration.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.terminal.configuration package is deprecated, please change your - imports to import from stripe.terminal directly. - From: - from stripe.api_resources.terminal.configuration import Configuration - To: - from stripe.terminal import Configuration - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.terminal._configuration import ( # noqa - Configuration, - ) diff --git a/stripe/api_resources/terminal/connection_token.py b/stripe/api_resources/terminal/connection_token.py deleted file mode 100644 index e1ed827c..00000000 --- a/stripe/api_resources/terminal/connection_token.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.terminal.connection_token package is deprecated, please change your - imports to import from stripe.terminal directly. - From: - from stripe.api_resources.terminal.connection_token import ConnectionToken - To: - from stripe.terminal import ConnectionToken - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.terminal._connection_token import ( # noqa - ConnectionToken, - ) diff --git a/stripe/api_resources/terminal/location.py b/stripe/api_resources/terminal/location.py deleted file mode 100644 index c23d104a..00000000 --- a/stripe/api_resources/terminal/location.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.terminal.location package is deprecated, please change your - imports to import from stripe.terminal directly. - From: - from stripe.api_resources.terminal.location import Location - To: - from stripe.terminal import Location - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.terminal._location import ( # noqa - Location, - ) diff --git a/stripe/api_resources/terminal/reader.py b/stripe/api_resources/terminal/reader.py deleted file mode 100644 index aa17e46d..00000000 --- a/stripe/api_resources/terminal/reader.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.terminal.reader package is deprecated, please change your - imports to import from stripe.terminal directly. - From: - from stripe.api_resources.terminal.reader import Reader - To: - from stripe.terminal import Reader - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.terminal._reader import ( # noqa - Reader, - ) diff --git a/stripe/api_resources/test_helpers/__init__.py b/stripe/api_resources/test_helpers/__init__.py deleted file mode 100644 index fa9a3548..00000000 --- a/stripe/api_resources/test_helpers/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.test_helpers package is deprecated, please change your - imports to import from stripe.test_helpers directly. - From: - from stripe.api_resources.test_helpers import ... - To: - from stripe.test_helpers import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.test_helpers.test_clock import TestClock diff --git a/stripe/api_resources/test_helpers/test_clock.py b/stripe/api_resources/test_helpers/test_clock.py deleted file mode 100644 index 0483cd76..00000000 --- a/stripe/api_resources/test_helpers/test_clock.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.test_helpers.test_clock package is deprecated, please change your - imports to import from stripe.test_helpers directly. - From: - from stripe.api_resources.test_helpers.test_clock import TestClock - To: - from stripe.test_helpers import TestClock - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.test_helpers._test_clock import ( # noqa - TestClock, - ) diff --git a/stripe/api_resources/token.py b/stripe/api_resources/token.py deleted file mode 100644 index 28ec1a7d..00000000 --- a/stripe/api_resources/token.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.token package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.token import Token - To: - from stripe import Token - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._token import ( # noqa - Token, - ) diff --git a/stripe/api_resources/topup.py b/stripe/api_resources/topup.py deleted file mode 100644 index a456adff..00000000 --- a/stripe/api_resources/topup.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.topup package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.topup import Topup - To: - from stripe import Topup - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._topup import ( # noqa - Topup, - ) diff --git a/stripe/api_resources/transfer.py b/stripe/api_resources/transfer.py deleted file mode 100644 index 8893f9a8..00000000 --- a/stripe/api_resources/transfer.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.transfer package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.transfer import Transfer - To: - from stripe import Transfer - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._transfer import ( # noqa - Transfer, - ) diff --git a/stripe/api_resources/treasury/__init__.py b/stripe/api_resources/treasury/__init__.py deleted file mode 100644 index 499cdb8f..00000000 --- a/stripe/api_resources/treasury/__init__.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury import ... - To: - from stripe.treasury import ... - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.api_resources.treasury.credit_reversal import CreditReversal - from stripe.api_resources.treasury.debit_reversal import DebitReversal - from stripe.api_resources.treasury.financial_account import ( - FinancialAccount, - ) - from stripe.api_resources.treasury.financial_account_features import ( - FinancialAccountFeatures, - ) - from stripe.api_resources.treasury.inbound_transfer import InboundTransfer - from stripe.api_resources.treasury.outbound_payment import OutboundPayment - from stripe.api_resources.treasury.outbound_transfer import ( - OutboundTransfer, - ) - from stripe.api_resources.treasury.received_credit import ReceivedCredit - from stripe.api_resources.treasury.received_debit import ReceivedDebit - from stripe.api_resources.treasury.transaction import Transaction - from stripe.api_resources.treasury.transaction_entry import ( - TransactionEntry, - ) diff --git a/stripe/api_resources/treasury/credit_reversal.py b/stripe/api_resources/treasury/credit_reversal.py deleted file mode 100644 index 9a94b977..00000000 --- a/stripe/api_resources/treasury/credit_reversal.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.credit_reversal package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.credit_reversal import CreditReversal - To: - from stripe.treasury import CreditReversal - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._credit_reversal import ( # noqa - CreditReversal, - ) diff --git a/stripe/api_resources/treasury/debit_reversal.py b/stripe/api_resources/treasury/debit_reversal.py deleted file mode 100644 index d6cf966a..00000000 --- a/stripe/api_resources/treasury/debit_reversal.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.debit_reversal package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.debit_reversal import DebitReversal - To: - from stripe.treasury import DebitReversal - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._debit_reversal import ( # noqa - DebitReversal, - ) diff --git a/stripe/api_resources/treasury/financial_account.py b/stripe/api_resources/treasury/financial_account.py deleted file mode 100644 index cd4f7168..00000000 --- a/stripe/api_resources/treasury/financial_account.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.financial_account package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.financial_account import FinancialAccount - To: - from stripe.treasury import FinancialAccount - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._financial_account import ( # noqa - FinancialAccount, - ) diff --git a/stripe/api_resources/treasury/financial_account_features.py b/stripe/api_resources/treasury/financial_account_features.py deleted file mode 100644 index 1dcbe6c7..00000000 --- a/stripe/api_resources/treasury/financial_account_features.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.financial_account_features package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.financial_account_features import FinancialAccountFeatures - To: - from stripe.treasury import FinancialAccountFeatures - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._financial_account_features import ( # noqa - FinancialAccountFeatures, - ) diff --git a/stripe/api_resources/treasury/inbound_transfer.py b/stripe/api_resources/treasury/inbound_transfer.py deleted file mode 100644 index b94f5fea..00000000 --- a/stripe/api_resources/treasury/inbound_transfer.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.inbound_transfer package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.inbound_transfer import InboundTransfer - To: - from stripe.treasury import InboundTransfer - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._inbound_transfer import ( # noqa - InboundTransfer, - ) diff --git a/stripe/api_resources/treasury/outbound_payment.py b/stripe/api_resources/treasury/outbound_payment.py deleted file mode 100644 index fbd1831a..00000000 --- a/stripe/api_resources/treasury/outbound_payment.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.outbound_payment package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.outbound_payment import OutboundPayment - To: - from stripe.treasury import OutboundPayment - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._outbound_payment import ( # noqa - OutboundPayment, - ) diff --git a/stripe/api_resources/treasury/outbound_transfer.py b/stripe/api_resources/treasury/outbound_transfer.py deleted file mode 100644 index 9f988dfa..00000000 --- a/stripe/api_resources/treasury/outbound_transfer.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.outbound_transfer package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.outbound_transfer import OutboundTransfer - To: - from stripe.treasury import OutboundTransfer - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._outbound_transfer import ( # noqa - OutboundTransfer, - ) diff --git a/stripe/api_resources/treasury/received_credit.py b/stripe/api_resources/treasury/received_credit.py deleted file mode 100644 index 29b2bc84..00000000 --- a/stripe/api_resources/treasury/received_credit.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.received_credit package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.received_credit import ReceivedCredit - To: - from stripe.treasury import ReceivedCredit - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._received_credit import ( # noqa - ReceivedCredit, - ) diff --git a/stripe/api_resources/treasury/received_debit.py b/stripe/api_resources/treasury/received_debit.py deleted file mode 100644 index 68ab29c7..00000000 --- a/stripe/api_resources/treasury/received_debit.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.received_debit package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.received_debit import ReceivedDebit - To: - from stripe.treasury import ReceivedDebit - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._received_debit import ( # noqa - ReceivedDebit, - ) diff --git a/stripe/api_resources/treasury/transaction.py b/stripe/api_resources/treasury/transaction.py deleted file mode 100644 index 4b8d242d..00000000 --- a/stripe/api_resources/treasury/transaction.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.transaction package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.transaction import Transaction - To: - from stripe.treasury import Transaction - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._transaction import ( # noqa - Transaction, - ) diff --git a/stripe/api_resources/treasury/transaction_entry.py b/stripe/api_resources/treasury/transaction_entry.py deleted file mode 100644 index d87a9a6e..00000000 --- a/stripe/api_resources/treasury/transaction_entry.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.treasury.transaction_entry package is deprecated, please change your - imports to import from stripe.treasury directly. - From: - from stripe.api_resources.treasury.transaction_entry import TransactionEntry - To: - from stripe.treasury import TransactionEntry - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe.treasury._transaction_entry import ( # noqa - TransactionEntry, - ) diff --git a/stripe/api_resources/webhook_endpoint.py b/stripe/api_resources/webhook_endpoint.py deleted file mode 100644 index 175e1387..00000000 --- a/stripe/api_resources/webhook_endpoint.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# File generated from our OpenAPI spec -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.webhook_endpoint package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.webhook_endpoint import WebhookEndpoint - To: - from stripe import WebhookEndpoint - """, - DeprecationWarning, - stacklevel=2, -) -if not TYPE_CHECKING: - from stripe._webhook_endpoint import ( # noqa - WebhookEndpoint, - ) diff --git a/stripe/api_version.py b/stripe/api_version.py deleted file mode 100644 index e1ca6074..00000000 --- a/stripe/api_version.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_version package is deprecated and will become internal in the future. - """, - DeprecationWarning, -) - -if not TYPE_CHECKING: - from stripe._api_version import ( # noqa - _ApiVersion, - ) diff --git a/stripe/app_info.py b/stripe/app_info.py deleted file mode 100644 index b4be7cad..00000000 --- a/stripe/app_info.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -""" -The stripe.app_info package is deprecated, please change your -imports to import from stripe directly. -From: - from stripe.app_info import AppInfo -To: - from stripe import AppInfo -""" - -from typing_extensions import TYPE_CHECKING - -# No deprecation warning is raised here, because it would happen -# on every import of `stripe/__init__.py` otherwise. Since that -# module declares its own `app_info` name, this module becomes -# practically impossible to import anyway. - -if not TYPE_CHECKING: - from stripe._app_info import ( # noqa - AppInfo, - ) diff --git a/stripe/error.py b/stripe/error.py deleted file mode 100644 index 470567e5..00000000 --- a/stripe/error.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.api_resources.error_object package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.api_resources.error_object import ErrorObject - To: - from stripe import ErrorObject - """, - DeprecationWarning, -) - -if not TYPE_CHECKING: - from stripe._error import StripeError # noqa - from stripe._error import APIError # noqa - from stripe._error import APIConnectionError # noqa - from stripe._error import StripeErrorWithParamCode # noqa - from stripe._error import CardError # noqa - from stripe._error import IdempotencyError # noqa - from stripe._error import InvalidRequestError # noqa - from stripe._error import AuthenticationError # noqa - from stripe._error import PermissionError # noqa - from stripe._error import RateLimitError # noqa - from stripe._error import SignatureVerificationError # noqa diff --git a/stripe/http_client.py b/stripe/http_client.py deleted file mode 100644 index 954c3e04..00000000 --- a/stripe/http_client.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.http_client package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.http_client import HTTPClient - To: - from stripe import HTTPClient - """, - DeprecationWarning, - stacklevel=2, -) - -if not TYPE_CHECKING: - from stripe._http_client import * # noqa diff --git a/stripe/multipart_data_generator.py b/stripe/multipart_data_generator.py deleted file mode 100644 index 511029ee..00000000 --- a/stripe/multipart_data_generator.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.multipart_data_generator package is deprecated and will become internal in the future. - """, - DeprecationWarning, -) - -if not TYPE_CHECKING: - from stripe._multipart_data_generator import ( # noqa - MultipartDataGenerator, - ) diff --git a/stripe/oauth.py b/stripe/oauth.py deleted file mode 100644 index 5dd01e0f..00000000 --- a/stripe/oauth.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.oauth package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.oauth import OAuth - To: - from stripe import OAuth - """, - DeprecationWarning, - stacklevel=2, -) - -if not TYPE_CHECKING: - from stripe._oauth import ( # noqa - OAuth, - ) diff --git a/stripe/oauth_error.py b/stripe/oauth_error.py index baad5088..14f75c2a 100644 --- a/stripe/oauth_error.py +++ b/stripe/oauth_error.py @@ -1,6 +1,5 @@ -# Used for global variables -import stripe # noqa: IMP101 from stripe._error import StripeError +from stripe._error_object import OAuthErrorObject class OAuthError(StripeError): @@ -21,9 +20,11 @@ class OAuthError(StripeError): if self.json_body is None: return None - return stripe.error_object.OAuthErrorObject._construct_from( # pyright: ignore - values=self.json_body, - requestor=stripe._APIRequestor._global_instance(), + from stripe._api_requestor import _APIRequestor + + return OAuthErrorObject._construct_from( + values=self.json_body, # type: ignore + requestor=_APIRequestor._global_instance(), api_mode="V1", ) diff --git a/stripe/request_metrics.py b/stripe/request_metrics.py deleted file mode 100644 index f97a4dec..00000000 --- a/stripe/request_metrics.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.request_metrics package is deprecated and will become internal in the future. - """, - DeprecationWarning, -) - -if not TYPE_CHECKING: - from stripe._request_metrics import ( # noqa - RequestMetrics, - ) diff --git a/stripe/request_options.py b/stripe/request_options.py deleted file mode 100644 index cae0fe34..00000000 --- a/stripe/request_options.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.request_options package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.request_options import RequestOptions - To: - from stripe import RequestOptions - """, - DeprecationWarning, -) -__deprecated__ = ["RequestOptions"] -if not TYPE_CHECKING: - from stripe._request_options import RequestOptions # noqa diff --git a/stripe/stripe_object.py b/stripe/stripe_object.py deleted file mode 100644 index 1d0c70b8..00000000 --- a/stripe/stripe_object.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.stripe_object package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.stripe_object import StripeObject - To: - from stripe import StripeObject - """, - DeprecationWarning, - stacklevel=2, -) - -if not TYPE_CHECKING: - from stripe._stripe_object import ( # noqa - StripeObject, - ) diff --git a/stripe/stripe_response.py b/stripe/stripe_response.py deleted file mode 100644 index da3dc438..00000000 --- a/stripe/stripe_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.stripe_response package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.stripe_response import StripeResponse - To: - from stripe import StripeResponse - """, - DeprecationWarning, -) - -if not TYPE_CHECKING: - from stripe._stripe_response import StripeResponse # noqa: F401 - from stripe._stripe_response import StripeResponseBase # noqa: F401 - from stripe._stripe_response import StripeStreamResponse # noqa: F401 diff --git a/stripe/util.py b/stripe/util.py deleted file mode 100644 index d2ea8ccf..00000000 --- a/stripe/util.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.util package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.util import convert_to_stripe_object - To: - from stripe import convert_to_stripe_object - """, - DeprecationWarning, - stacklevel=2, -) - -if not TYPE_CHECKING: - from stripe._util import * # noqa diff --git a/stripe/version.py b/stripe/version.py deleted file mode 100644 index 68df71d9..00000000 --- a/stripe/version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.version package is deprecated and will become internal in the future. - Pleasse access the version via stripe.VERSION. - """, - DeprecationWarning, -) - -if not TYPE_CHECKING: - from stripe._version import ( # noqa - VERSION, - ) diff --git a/stripe/webhook.py b/stripe/webhook.py deleted file mode 100644 index 3cd41ebe..00000000 --- a/stripe/webhook.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -from typing_extensions import TYPE_CHECKING -from warnings import warn - -warn( - """ - The stripe.webhook package is deprecated, please change your - imports to import from stripe directly. - From: - from stripe.webhook import Webhook - To: - from stripe import Webhook - """, - DeprecationWarning, - stacklevel=2, -) - -if not TYPE_CHECKING: - from stripe._webhook import ( # noqa - Webhook, - WebhookSignature, - ) diff --git a/tests/api_resources/abstract/test_api_resource.py b/tests/api_resources/abstract/test_api_resource.py index 005309f2..ef64f4af 100644 --- a/tests/api_resources/abstract/test_api_resource.py +++ b/tests/api_resources/abstract/test_api_resource.py @@ -1,6 +1,9 @@ import pytest import stripe +from stripe._util import convert_to_stripe_object +from stripe._stripe_object import StripeObject +from stripe._error import InvalidRequestError class TestAPIResource(object): @@ -94,12 +97,12 @@ class TestAPIResource(object): "alist": [{"object": "customer", "name": "chilango"}], } - converted = stripe.util.convert_to_stripe_object( + converted = convert_to_stripe_object( sample, "akey", None, None, api_mode="V1" ) # Types - assert isinstance(converted, stripe.stripe_object.StripeObject) + assert isinstance(converted, StripeObject) assert isinstance(converted.adict, stripe.Charge) assert len(converted.alist) == 1 assert isinstance(converted.alist[0], stripe.Customer) @@ -115,7 +118,7 @@ class TestAPIResource(object): def test_raise_on_incorrect_id_type(self): for obj in [None, 1, 3.14, dict(), list(), set(), tuple(), object()]: - with pytest.raises(stripe.error.InvalidRequestError): + with pytest.raises(InvalidRequestError): self.MyResource.retrieve(obj) def test_class_methods_use_global_options(self, http_client_mock): diff --git a/tests/api_resources/abstract/test_createable_api_resource.py b/tests/api_resources/abstract/test_createable_api_resource.py index db58810c..1affefa7 100644 --- a/tests/api_resources/abstract/test_createable_api_resource.py +++ b/tests/api_resources/abstract/test_createable_api_resource.py @@ -1,8 +1,9 @@ -import stripe +from stripe._createable_api_resource import CreateableAPIResource +from stripe._charge import Charge class TestCreateableAPIResource(object): - class MyCreatable(stripe.api_resources.abstract.CreateableAPIResource): + class MyCreatable(CreateableAPIResource): OBJECT_NAME = "mycreatable" def test_create(self, http_client_mock): @@ -18,7 +19,7 @@ class TestCreateableAPIResource(object): http_client_mock.assert_requested( "post", path="/v1/mycreatables", post_data="" ) - assert isinstance(res, stripe.Charge) + assert isinstance(res, Charge) assert res.foo == "bar" assert res.last_response is not None @@ -40,5 +41,5 @@ class TestCreateableAPIResource(object): post_data="", idempotency_key="foo", ) - assert isinstance(res, stripe.Charge) + assert isinstance(res, Charge) assert res.foo == "bar" diff --git a/tests/api_resources/abstract/test_custom_method.py b/tests/api_resources/abstract/test_custom_method.py index 01aa8435..71fc5132 100644 --- a/tests/api_resources/abstract/test_custom_method.py +++ b/tests/api_resources/abstract/test_custom_method.py @@ -1,21 +1,21 @@ -import stripe -from stripe import util +import io +from stripe._api_resource import APIResource +from stripe._custom_method import custom_method +from stripe._util import class_method_variant, sanitize_id class TestCustomMethod(object): - @stripe.api_resources.abstract.custom_method( - "do_stuff", http_verb="post", http_path="do_the_thing" - ) - @stripe.api_resources.abstract.custom_method( + @custom_method("do_stuff", http_verb="post", http_path="do_the_thing") + @custom_method( "do_list_stuff", http_verb="get", http_path="do_the_list_thing" ) - @stripe.api_resources.abstract.custom_method( + @custom_method( "do_stream_stuff", http_verb="post", http_path="do_the_stream_thing", is_streaming=True, ) - class MyResource(stripe.api_resources.abstract.APIResource): + class MyResource(APIResource): OBJECT_NAME = "myresource" def do_stuff(self, idempotency_key=None, **params): @@ -35,18 +35,16 @@ class TestCustomMethod(object): def _cls_do_stuff_new_codegen(cls, id, **params): return cls._static_request( "post", - "/v1/myresources/{id}/do_the_thing".format( - id=util.sanitize_id(id) - ), + "/v1/myresources/{id}/do_the_thing".format(id=sanitize_id(id)), params=params, ) - @util.class_method_variant("_cls_do_stuff_new_codegen") + @class_method_variant("_cls_do_stuff_new_codegen") def do_stuff_new_codegen(self, **params): return self._request( "post", "/v1/myresources/{id}/do_the_thing".format( - id=util.sanitize_id(self.get("id")) + id=sanitize_id(self.get("id")) ), params=params, ) @@ -113,7 +111,7 @@ class TestCustomMethod(object): http_client_mock.stub_request( "post", path="/v1/myresources/mid/do_the_stream_thing", - rbody=util.io.BytesIO(str.encode("response body")), + rbody=io.BytesIO(str.encode("response body")), rheaders={"request-id": "req_id"}, ) @@ -155,7 +153,7 @@ class TestCustomMethod(object): http_client_mock.stub_request( "post", path="/v1/myresources/mid/do_the_stream_thing", - rbody=util.io.BytesIO(str.encode("response body")), + rbody=io.BytesIO(str.encode("response body")), rheaders={"request-id": "req_id"}, ) @@ -196,7 +194,7 @@ class TestCustomMethod(object): http_client_mock.stub_request( "post", path="/v1/myresources/mid/do_the_stream_thing", - rbody=util.io.BytesIO(str.encode("response body")), + rbody=io.BytesIO(str.encode("response body")), rheaders={"request-id": "req_id"}, ) diff --git a/tests/api_resources/abstract/test_deletable_api_resource.py b/tests/api_resources/abstract/test_deletable_api_resource.py index 68900b86..b11d9e69 100644 --- a/tests/api_resources/abstract/test_deletable_api_resource.py +++ b/tests/api_resources/abstract/test_deletable_api_resource.py @@ -1,8 +1,8 @@ -import stripe +from stripe._deletable_api_resource import DeletableAPIResource class TestDeletableAPIResource(object): - class MyDeletable(stripe.api_resources.abstract.DeletableAPIResource): + class MyDeletable(DeletableAPIResource): OBJECT_NAME = "mydeletable" def test_delete_class(self, http_client_mock): diff --git a/tests/api_resources/abstract/test_listable_api_resource.py b/tests/api_resources/abstract/test_listable_api_resource.py index edc9b584..8b0732ff 100644 --- a/tests/api_resources/abstract/test_listable_api_resource.py +++ b/tests/api_resources/abstract/test_listable_api_resource.py @@ -1,8 +1,9 @@ -import stripe +from stripe._listable_api_resource import ListableAPIResource +from stripe._charge import Charge class TestListableAPIResource(object): - class MyListable(stripe.api_resources.abstract.ListableAPIResource): + class MyListable(ListableAPIResource): OBJECT_NAME = "mylistable" def test_all(self, http_client_mock): @@ -18,7 +19,7 @@ class TestListableAPIResource(object): "get", path="/v1/mylistables", query_string="" ) assert len(res.data) == 2 - assert all(isinstance(obj, stripe.Charge) for obj in res.data) + assert all(isinstance(obj, Charge) for obj in res.data) assert res.data[0].name == "jose" assert res.data[1].name == "curly" diff --git a/tests/api_resources/abstract/test_nested_resource_class_methods.py b/tests/api_resources/abstract/test_nested_resource_class_methods.py index 2ca7d4a4..a21c8ba0 100644 --- a/tests/api_resources/abstract/test_nested_resource_class_methods.py +++ b/tests/api_resources/abstract/test_nested_resource_class_methods.py @@ -1,11 +1,12 @@ -import stripe +from stripe._nested_resource_class_methods import nested_resource_class_methods +from stripe._api_resource import APIResource class TestNestedResourceClassMethods(object): - @stripe.api_resources.abstract.nested_resource_class_methods( + @nested_resource_class_methods( "nested", operations=["create", "retrieve", "update", "delete", "list"] ) - class MainResource(stripe.api_resources.abstract.APIResource): + class MainResource(APIResource): OBJECT_NAME = "mainresource" def test_create_nested(self, http_client_mock): diff --git a/tests/api_resources/abstract/test_searchable_api_resource.py b/tests/api_resources/abstract/test_searchable_api_resource.py index 32085824..7e74bbc3 100644 --- a/tests/api_resources/abstract/test_searchable_api_resource.py +++ b/tests/api_resources/abstract/test_searchable_api_resource.py @@ -1,8 +1,9 @@ -import stripe +from stripe._searchable_api_resource import SearchableAPIResource +from stripe._charge import Charge class TestSearchableAPIResource(object): - class MySearchable(stripe.api_resources.abstract.SearchableAPIResource): + class MySearchable(SearchableAPIResource): OBJECT_NAME = "mysearchable" @classmethod @@ -27,7 +28,7 @@ class TestSearchableAPIResource(object): "get", path=path, query_string=query_string ) assert len(res.data) == 2 - assert all(isinstance(obj, stripe.Charge) for obj in res.data) + assert all(isinstance(obj, Charge) for obj in res.data) assert res.data[0].name == "jose" assert res.data[1].name == "curly" @@ -70,5 +71,5 @@ class TestSearchableAPIResource(object): ) assert len(res2.data) == 1 - assert all(isinstance(obj, stripe.Charge) for obj in res2.data) + assert all(isinstance(obj, Charge) for obj in res2.data) assert res2.data[0].name == "test" diff --git a/tests/api_resources/abstract/test_singleton_api_resource.py b/tests/api_resources/abstract/test_singleton_api_resource.py index db55ab42..d9a194af 100644 --- a/tests/api_resources/abstract/test_singleton_api_resource.py +++ b/tests/api_resources/abstract/test_singleton_api_resource.py @@ -1,8 +1,8 @@ -import stripe +from stripe._singleton_api_resource import SingletonAPIResource class TestSingletonAPIResource(object): - class MySingleton(stripe.api_resources.abstract.SingletonAPIResource): + class MySingleton(SingletonAPIResource): OBJECT_NAME = "mysingleton" def test_retrieve(self, http_client_mock): diff --git a/tests/api_resources/abstract/test_test_helpers_api_resource.py b/tests/api_resources/abstract/test_test_helpers_api_resource.py index f0c6d646..426aa569 100644 --- a/tests/api_resources/abstract/test_test_helpers_api_resource.py +++ b/tests/api_resources/abstract/test_test_helpers_api_resource.py @@ -1,14 +1,13 @@ -import stripe from stripe._test_helpers import APIResourceTestHelpers +from stripe._custom_method import custom_method +from stripe._api_resource import APIResource class TestTestHelperAPIResource(object): - class MyTestHelpersResource(stripe.api_resources.abstract.APIResource): + class MyTestHelpersResource(APIResource): OBJECT_NAME = "myresource" - @stripe.api_resources.abstract.custom_method( - "do_stuff", http_verb="post", http_path="do_the_thing" - ) + @custom_method("do_stuff", http_verb="post", http_path="do_the_thing") class TestHelpers(APIResourceTestHelpers): def __init__(self, resource): self.resource = resource diff --git a/tests/api_resources/abstract/test_updateable_api_resource.py b/tests/api_resources/abstract/test_updateable_api_resource.py index e14ae1a8..fe419497 100644 --- a/tests/api_resources/abstract/test_updateable_api_resource.py +++ b/tests/api_resources/abstract/test_updateable_api_resource.py @@ -1,11 +1,11 @@ import pytest import json -import stripe +from stripe._updateable_api_resource import UpdateableAPIResource class TestUpdateableAPIResource(object): - class MyUpdateable(stripe.api_resources.abstract.UpdateableAPIResource): + class MyUpdateable(UpdateableAPIResource): OBJECT_NAME = "myupdateable" @pytest.fixture diff --git a/tests/api_resources/test_file.py b/tests/api_resources/test_file.py index 4e43655f..4494f543 100644 --- a/tests/api_resources/test_file.py +++ b/tests/api_resources/test_file.py @@ -3,6 +3,8 @@ import tempfile import pytest import stripe +from stripe._multipart_data_generator import MultipartDataGenerator +from stripe._util import convert_to_stripe_object TEST_RESOURCE_ID = "file_123" @@ -31,9 +33,7 @@ class TestFile(object): assert isinstance(resource, stripe.File) def test_is_creatable(self, setup_upload_api_base, http_client_mock): - stripe.multipart_data_generator.MultipartDataGenerator._initialize_boundary = ( - lambda self: 1234567890 - ) + MultipartDataGenerator._initialize_boundary = lambda self: 1234567890 test_file = tempfile.TemporaryFile() resource = stripe.File.create( purpose="dispute_evidence", @@ -79,13 +79,11 @@ class TestFile(object): ) def test_deserializes_from_file(self): - obj = stripe.util.convert_to_stripe_object( - {"object": "file"}, api_mode="V1" - ) + obj = convert_to_stripe_object({"object": "file"}, api_mode="V1") assert isinstance(obj, stripe.File) def test_deserializes_from_file_upload(self): - obj = stripe.util.convert_to_stripe_object( + obj = convert_to_stripe_object( {"object": "file_upload"}, api_mode="V1" ) assert isinstance(obj, stripe.File) diff --git a/tests/api_resources/test_file_upload.py b/tests/api_resources/test_file_upload.py index fb696d63..8e52cf10 100644 --- a/tests/api_resources/test_file_upload.py +++ b/tests/api_resources/test_file_upload.py @@ -3,6 +3,9 @@ import tempfile import pytest import stripe +from stripe import File +from stripe._multipart_data_generator import MultipartDataGenerator +from stripe._util import convert_to_stripe_object TEST_RESOURCE_ID = "file_123" @@ -18,24 +21,22 @@ class TestFileUpload(object): stripe.upload_api_base = "https://files.stripe.com" def test_is_listable(self, http_client_mock): - resources = stripe.FileUpload.list() + resources = File.list() http_client_mock.assert_requested("get", path="/v1/files") assert isinstance(resources.data, list) - assert isinstance(resources.data[0], stripe.FileUpload) + assert isinstance(resources.data[0], File) def test_is_retrievable(self, http_client_mock): - resource = stripe.FileUpload.retrieve(TEST_RESOURCE_ID) + resource = File.retrieve(TEST_RESOURCE_ID) http_client_mock.assert_requested( "get", path="/v1/files/%s" % TEST_RESOURCE_ID ) - assert isinstance(resource, stripe.FileUpload) + assert isinstance(resource, File) def test_is_creatable(self, setup_upload_api_base, http_client_mock): - stripe.multipart_data_generator.MultipartDataGenerator._initialize_boundary = ( - lambda self: 1234567890 - ) + MultipartDataGenerator._initialize_boundary = lambda self: 1234567890 test_file = tempfile.TemporaryFile() - resource = stripe.FileUpload.create( + resource = File.create( purpose="dispute_evidence", file=test_file, file_link_data={"create": True}, @@ -46,16 +47,14 @@ class TestFileUpload(object): path="/v1/files", content_type="multipart/form-data; boundary=1234567890", ) - assert isinstance(resource, stripe.FileUpload) + assert isinstance(resource, File) def test_deserializes_from_file(self): - obj = stripe.util.convert_to_stripe_object( - {"object": "file"}, api_mode="V1" - ) - assert isinstance(obj, stripe.FileUpload) + obj = convert_to_stripe_object({"object": "file"}, api_mode="V1") + assert isinstance(obj, File) def test_deserializes_from_file_upload(self): - obj = stripe.util.convert_to_stripe_object( + obj = convert_to_stripe_object( {"object": "file_upload"}, api_mode="V1" ) - assert isinstance(obj, stripe.FileUpload) + assert isinstance(obj, File) diff --git a/tests/api_resources/test_list_object.py b/tests/api_resources/test_list_object.py index 8174e939..37ab96fe 100644 --- a/tests/api_resources/test_list_object.py +++ b/tests/api_resources/test_list_object.py @@ -3,6 +3,8 @@ import json import pytest import stripe +from stripe._util import convert_to_stripe_object +from stripe._stripe_object import StripeObject class TestListObject(object): @@ -95,15 +97,13 @@ class TestListObject(object): def test_iter(self): arr = [{"id": 1}, {"id": 2}, {"id": 3}] - expected = stripe.util.convert_to_stripe_object(arr, api_mode="V1") + expected = convert_to_stripe_object(arr, api_mode="V1") lo = stripe.ListObject.construct_from({"data": arr}, None) assert list(lo) == expected def test_iter_reversed(self): arr = [{"id": 1}, {"id": 2}, {"id": 3}] - expected = stripe.util.convert_to_stripe_object( - list(reversed(arr)), api_mode="V1" - ) + expected = convert_to_stripe_object(list(reversed(arr)), api_mode="V1") lo = stripe.ListObject.construct_from({"data": arr}, None) assert list(reversed(lo)) == expected @@ -242,11 +242,9 @@ class TestListObject(object): empty = stripe.ListObject.construct_from( {"object": "list", "data": []}, "mykey" ) - obj = stripe.stripe_object.StripeObject.construct_from( - {"nested": empty}, "mykey" - ) + obj = StripeObject.construct_from({"nested": empty}, "mykey") serialized = str(obj) - deserialized = stripe.stripe_object.StripeObject.construct_from( + deserialized = StripeObject.construct_from( json.loads(serialized), "mykey" ) assert deserialized.nested == empty diff --git a/tests/api_resources/test_list_object_v2.py b/tests/api_resources/test_list_object_v2.py index d86ed54c..7767b6a3 100644 --- a/tests/api_resources/test_list_object_v2.py +++ b/tests/api_resources/test_list_object_v2.py @@ -7,6 +7,7 @@ import pytest import stripe from stripe.v2._list_object import ListObject from tests.http_client_mock import HTTPClientMock +from stripe._util import convert_to_stripe_object class TestListObjectV2(object): @@ -23,7 +24,7 @@ class TestListObjectV2(object): def test_iter(self): arr = ["a", "b", "c"] - expected = stripe.util.convert_to_stripe_object(arr, api_mode="V2") + expected = convert_to_stripe_object(arr, api_mode="V2") lo = ListObject.construct_from({"data": arr}, None) assert list(lo) == expected diff --git a/tests/api_resources/test_search_result_object.py b/tests/api_resources/test_search_result_object.py index 83266f0b..9db97792 100644 --- a/tests/api_resources/test_search_result_object.py +++ b/tests/api_resources/test_search_result_object.py @@ -3,6 +3,8 @@ import json import pytest import stripe +from stripe._util import convert_to_stripe_object +from stripe._stripe_object import StripeObject class TestSearchResultObject(object): @@ -82,7 +84,7 @@ class TestSearchResultObject(object): def test_iter(self): arr = [{"id": 1}, {"id": 2}, {"id": 3}] - expected = stripe.util.convert_to_stripe_object(arr, api_mode="V1") + expected = convert_to_stripe_object(arr, api_mode="V1") sro = stripe.SearchResultObject.construct_from({"data": arr}, None) assert list(sro) == expected @@ -195,11 +197,9 @@ class TestSearchResultObject(object): empty = stripe.SearchResultObject.construct_from( {"object": "search_result", "data": []}, "mykey" ) - obj = stripe.stripe_object.StripeObject.construct_from( - {"nested": empty}, "mykey" - ) + obj = StripeObject.construct_from({"nested": empty}, "mykey") serialized = str(obj) - deserialized = stripe.stripe_object.StripeObject.construct_from( + deserialized = StripeObject.construct_from( json.loads(serialized), "mykey" ) assert deserialized.nested == empty diff --git a/tests/api_resources/test_source.py b/tests/api_resources/test_source.py index af26db6b..e377e4dd 100644 --- a/tests/api_resources/test_source.py +++ b/tests/api_resources/test_source.py @@ -1,6 +1,7 @@ import pytest import stripe +from stripe._error import InvalidRequestError TEST_RESOURCE_ID = "src_123" @@ -60,7 +61,7 @@ class TestSource(object): def test_is_not_detachable_when_unattached(self, http_client_mock): resource = stripe.Source.retrieve(TEST_RESOURCE_ID) - with pytest.raises(stripe.error.InvalidRequestError): + with pytest.raises(InvalidRequestError): resource.detach() def test_is_verifiable(self, http_client_mock): diff --git a/tests/conftest.py b/tests/conftest.py index df2af0e1..c07e9c16 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,6 +9,7 @@ import requests from tests.stripe_mock import StripeMock from tests.http_client_mock import HTTPClientMock +from stripe._http_client import new_default_http_client pytest_plugins = ("anyio",) @@ -70,7 +71,7 @@ def setup_stripe(): "client_id": stripe.client_id, "default_http_client": stripe.default_http_client, } - http_client = stripe.http_client.new_default_http_client() + http_client = new_default_http_client() stripe.api_base = MOCK_API_BASE stripe.upload_api_base = MOCK_API_BASE stripe.api_key = MOCK_API_KEY diff --git a/tests/http_client_mock.py b/tests/http_client_mock.py index 0f016330..da7c0796 100644 --- a/tests/http_client_mock.py +++ b/tests/http_client_mock.py @@ -1,10 +1,13 @@ from __future__ import absolute_import, division, print_function from typing import List -import stripe from urllib.parse import urlsplit, urlencode, parse_qsl import json from unittest.mock import Mock +from stripe._http_client import ( + new_default_http_client, + new_http_client_async_fallback, +) def parse_and_sort(query_string, strict_parsing=False): @@ -217,8 +220,8 @@ class StripeRequestCall(object): class HTTPClientMock(object): def __init__(self, mocker): self.mock_client = mocker.Mock( - wraps=stripe.http_client.new_default_http_client( - async_fallback_client=stripe.http_client.new_http_client_async_fallback() + wraps=new_default_http_client( + async_fallback_client=new_http_client_async_fallback() ) ) diff --git a/tests/services/test_file_upload.py b/tests/services/test_file_upload.py index b1088ed8..cae1c79b 100644 --- a/tests/services/test_file_upload.py +++ b/tests/services/test_file_upload.py @@ -3,6 +3,8 @@ from __future__ import absolute_import, division, print_function import tempfile import stripe +from stripe._file import File +from stripe._multipart_data_generator import MultipartDataGenerator TEST_RESOURCE_ID = "file_123" @@ -13,23 +15,21 @@ class TestFileUpload(object): resources = stripe_mock_stripe_client.files.list() http_client_mock.assert_requested("get", path="/v1/files") assert isinstance(resources.data, list) - assert isinstance(resources.data[0], stripe.FileUpload) + assert isinstance(resources.data[0], File) def test_is_retrievable(self, http_client_mock, stripe_mock_stripe_client): resource = stripe_mock_stripe_client.files.retrieve(TEST_RESOURCE_ID) http_client_mock.assert_requested( "get", path="/v1/files/%s" % TEST_RESOURCE_ID ) - assert isinstance(resource, stripe.FileUpload) + assert isinstance(resource, File) def test_is_creatable( self, file_stripe_mock_stripe_client, http_client_mock, ): - stripe.multipart_data_generator.MultipartDataGenerator._initialize_boundary = ( - lambda self: 1234567890 - ) + MultipartDataGenerator._initialize_boundary = lambda self: 1234567890 test_file = tempfile.TemporaryFile() # We create a new client here instead of re-using the stripe_mock_stripe_client fixture @@ -48,4 +48,4 @@ class TestFileUpload(object): path="/v1/files", content_type="multipart/form-data; boundary=1234567890", ) - assert isinstance(resource, stripe.FileUpload) + assert isinstance(resource, File) diff --git a/tests/test_api_requestor.py b/tests/test_api_requestor.py index 4ee937ca..0262f75f 100644 --- a/tests/test_api_requestor.py +++ b/tests/test_api_requestor.py @@ -9,7 +9,7 @@ import pytest import urllib3 import stripe -from stripe import util +import io from stripe._api_requestor import _api_encode, _APIRequestor from stripe._customer import Customer from stripe._request_options import RequestOptions @@ -363,7 +363,7 @@ class TestAPIRequestor(object): http_client_mock.stub_request( meth, path=self.v1_path, - rbody=util.io.BytesIO(b"thisisdata"), + rbody=io.BytesIO(b"thisisdata"), rcode=200, ) @@ -443,7 +443,7 @@ class TestAPIRequestor(object): method, path=self.v1_path, query_string=encoded if method != "post" else "", - rbody=util.io.BytesIO(b'{"foo": "bar", "baz": 6}'), + rbody=io.BytesIO(b'{"foo": "bar", "baz": 6}'), rcode=200, ) @@ -653,9 +653,7 @@ class TestAPIRequestor(object): def test_sets_default_http_client(self, mocker): assert not stripe.default_http_client - _APIRequestor( - client=mocker.Mock(stripe.http_client.HTTPClient) - )._get_http_client() + _APIRequestor(client=mocker.Mock(stripe.HTTPClient))._get_http_client() # default_http_client is not populated if a client is provided assert not stripe.default_http_client @@ -790,7 +788,7 @@ class TestAPIRequestor(object): def test_fails_without_api_key(self, requestor): stripe.api_key = None - with pytest.raises(stripe.error.AuthenticationError): + with pytest.raises(stripe.AuthenticationError): requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_request_error_404(self, requestor, http_client_mock): @@ -798,7 +796,7 @@ class TestAPIRequestor(object): "get", path=self.v1_path, rbody='{"error": {}}', rcode=404 ) - with pytest.raises(stripe.error.InvalidRequestError): + with pytest.raises(stripe.InvalidRequestError): requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_request_error_400(self, requestor, http_client_mock): @@ -806,7 +804,7 @@ class TestAPIRequestor(object): "get", path=self.v1_path, rbody='{"error": {}}', rcode=400 ) - with pytest.raises(stripe.error.InvalidRequestError): + with pytest.raises(stripe.InvalidRequestError): requestor.request("get", self.v1_path, {}, base_address="api") def test_idempotency_error(self, requestor, http_client_mock): @@ -817,7 +815,7 @@ class TestAPIRequestor(object): rcode=400, ) - with pytest.raises(stripe.error.IdempotencyError): + with pytest.raises(stripe.IdempotencyError): requestor.request("get", self.v1_path, {}, base_address="api") def test_authentication_error(self, requestor, http_client_mock): @@ -825,7 +823,7 @@ class TestAPIRequestor(object): "get", path=self.v1_path, rbody='{"error": {}}', rcode=401 ) - with pytest.raises(stripe.error.AuthenticationError): + with pytest.raises(stripe.AuthenticationError): requestor.request("get", self.v1_path, {}, base_address="api") def test_permissions_error(self, requestor, http_client_mock): @@ -833,7 +831,7 @@ class TestAPIRequestor(object): "get", path=self.v1_path, rbody='{"error": {}}', rcode=403 ) - with pytest.raises(stripe.error.PermissionError): + with pytest.raises(stripe.PermissionError): requestor.request("get", self.v1_path, {}, base_address="api") def test_card_error(self, requestor, http_client_mock): @@ -844,7 +842,7 @@ class TestAPIRequestor(object): rcode=402, ) - with pytest.raises(stripe.error.CardError) as excinfo: + with pytest.raises(stripe.CardError) as excinfo: requestor.request("get", self.v1_path, {}, base_address="api") assert excinfo.value.code == "invalid_expiry_year" @@ -853,7 +851,7 @@ class TestAPIRequestor(object): "get", path=self.v1_path, rbody='{"error": {}}', rcode=429 ) - with pytest.raises(stripe.error.RateLimitError): + with pytest.raises(stripe.RateLimitError): requestor.request("get", self.v1_path, {}, base_address="api") def test_old_rate_limit_error(self, requestor, http_client_mock): @@ -867,7 +865,7 @@ class TestAPIRequestor(object): rcode=400, ) - with pytest.raises(stripe.error.RateLimitError): + with pytest.raises(stripe.RateLimitError): requestor.request("get", self.v1_path, {}, base_address="api") def test_server_error(self, requestor, http_client_mock): @@ -875,7 +873,7 @@ class TestAPIRequestor(object): "get", path=self.v1_path, rbody='{"error": {}}', rcode=500 ) - with pytest.raises(stripe.error.APIError): + with pytest.raises(stripe.APIError): requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_json(self, requestor, http_client_mock): @@ -883,11 +881,11 @@ class TestAPIRequestor(object): "get", path=self.v1_path, rbody="{", rcode=200 ) - with pytest.raises(stripe.error.APIError): + with pytest.raises(stripe.APIError): requestor.request("get", self.v1_path, {}, base_address="api") def test_invalid_method(self, requestor): - with pytest.raises(stripe.error.APIConnectionError): + with pytest.raises(stripe.APIConnectionError): requestor.request("foo", "bar", base_address="api") def test_oauth_invalid_requestor_error(self, requestor, http_client_mock): @@ -929,7 +927,7 @@ class TestAPIRequestor(object): http_client_mock.stub_request( "get", path=self.v1_path, - rbody=util.io.BytesIO(b'{"error": "invalid_grant"}'), + rbody=io.BytesIO(b'{"error": "invalid_grant"}'), rcode=400, ) @@ -946,7 +944,7 @@ class TestAPIRequestor(object): "get", path=self.v1_path, rbody=urllib3.response.HTTPResponse( - body=util.io.BytesIO(b'{"error": "invalid_grant"}'), + body=io.BytesIO(b'{"error": "invalid_grant"}'), preload_content=False, ), rcode=400, diff --git a/tests/test_error.py b/tests/test_error.py index fe0e4a45..f8cfc404 100644 --- a/tests/test_error.py +++ b/tests/test_error.py @@ -2,28 +2,29 @@ import json -from stripe import error + +from stripe._error import StripeError, CardError, APIConnectionError class TestStripeError(object): def test_formatting(self): - err = error.StripeError("öre") + err = StripeError("öre") assert str(err) == "öre" def test_formatting_with_request_id(self): - err = error.StripeError("öre", headers={"request-id": "123"}) + err = StripeError("öre", headers={"request-id": "123"}) assert str(err) == "Request 123: öre" def test_formatting_with_none(self): - err = error.StripeError(None, headers={"request-id": "123"}) + err = StripeError(None, headers={"request-id": "123"}) assert str(err) == "Request 123: <empty message>" def test_formatting_with_message_none_and_request_id_none(self): - err = error.StripeError(None) + err = StripeError(None) assert str(err) == "<empty message>" def test_repr(self): - err = error.StripeError("öre", headers={"request-id": "123"}) + err = StripeError("öre", headers={"request-id": "123"}) assert ( repr(err) == "StripeError(message='öre', http_status=None, " "request_id='123')" @@ -31,7 +32,7 @@ class TestStripeError(object): def test_error_string_body(self): http_body = '{"error": {"code": "some_error"}}' - err = error.StripeError( + err = StripeError( "message", http_body=http_body, json_body=json.loads(http_body) ) assert err.http_body is not None @@ -39,14 +40,14 @@ class TestStripeError(object): def test_error_bytes_body(self): http_body = '{"error": {"code": "some_error"}}'.encode("utf-8") - err = error.StripeError( + err = StripeError( "message", http_body=http_body, json_body=json.loads(http_body) ) assert err.http_body is not None assert err.http_body == json.dumps(err.json_body) def test_error_object(self): - err = error.StripeError( + err = StripeError( "message", json_body={"error": {"code": "some_error"}} ) assert err.error is not None @@ -54,13 +55,13 @@ class TestStripeError(object): assert err.error.charge is None def test_error_object_not_dict(self): - err = error.StripeError("message", json_body={"error": "not a dict"}) + err = StripeError("message", json_body={"error": "not a dict"}) assert err.error is None class TestStripeErrorWithParamCode(object): def test_repr(self): - err = error.CardError( + err = CardError( "öre", param="cparam", code="ccode", @@ -76,8 +77,8 @@ class TestStripeErrorWithParamCode(object): class TestApiConnectionError(object): def test_default_no_retry(self): - err = error.APIConnectionError("msg") + err = APIConnectionError("msg") assert err.should_retry is False - err = error.APIConnectionError("msg", should_retry=True) + err = APIConnectionError("msg", should_retry=True) assert err.should_retry diff --git a/tests/test_exports.py b/tests/test_exports.py index 307529e8..93d3f77f 100644 --- a/tests/test_exports.py +++ b/tests/test_exports.py @@ -1,6 +1,5 @@ # pyright: strict # we specifically test various import patterns -from typing import Any import stripe import subprocess import sys @@ -22,372 +21,80 @@ def assert_output(code: str, expected: str) -> None: assert output == expected -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, - ) - - # 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, - ) - - assert stripe.RequestOptions is RequestOptionsStripeRequestOptions - assert RequestOptionsFromStripe is RequestOptionsStripeRequestOptions + from stripe import RequestOptions # pyright: ignore[reportUnusedImport] 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, - PycurlClient as PycurlClientFromStripe, - RequestsClient as RequestsClientFromStripe, - UrlFetchClient as UrlFetchClientFromStripe, - new_default_http_client as new_default_http_clientFromStripe, - ) - - assert HTTPClientFromStripe is HTTPClientFromStripeHTTPClient - assert PycurlClientFromStripe is PycurlClientFromStripeHTTPClient - assert RequestsClientFromStripe is RequestsClientFromStripeHTTPClient - assert UrlFetchClientFromStripe is UrlFetchClientFromStripeHTTPClient - assert ( - new_default_http_clientFromStripe - is new_default_http_clientFromStripeHTTPClient - ) - - assert stripe.HTTPClient is HTTPClientFromStripeHTTPClient - assert stripe.PycurlClient is PycurlClientFromStripeHTTPClient - assert stripe.RequestsClient is RequestsClientFromStripeHTTPClient - assert stripe.UrlFetchClient is UrlFetchClientFromStripeHTTPClient - assert ( - stripe.new_default_http_client - is new_default_http_clientFromStripeHTTPClient + HTTPClient, # pyright: ignore[reportUnusedImport] + PycurlClient, # pyright: ignore[reportUnusedImport] + RequestsClient, # pyright: ignore[reportUnusedImport] + UrlFetchClient, # pyright: ignore[reportUnusedImport] + new_default_http_client, # pyright: ignore[reportUnusedImport] ) 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, - WebhookSignature, + Webhook, # pyright: ignore[reportUnusedImport] + WebhookSignature, # pyright: ignore[reportUnusedImport] ) - assert Webhook is not None - assert WebhookSignature is not None - - assert WebhookFromStripeWebhook is Webhook - assert WebhookSignatureFromStripeWebhook is WebhookSignature - - -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 - from stripe.api_resources import ListObject as ListObjectFromResources # type: ignore - from stripe import ListObject as LOFromStripe - from stripe.api_resources import SearchResultObject as SearchObjectFromResources # type: ignore - from stripe import SearchResultObject as SOFromStripe - # fmt: on - - from stripe import StripeObject - - assert ( - ListObjectFromResources[StripeObject] - == stripe.ListObject[StripeObject] - ) - assert ( - SearchObjectFromResources[StripeObject] - == stripe.SearchResultObject[StripeObject] - ) - assert ListObjectFromResources[StripeObject] == LOFromStripe[StripeObject] - assert ( - SearchObjectFromResources[StripeObject] == SOFromStripe[StripeObject] - ) - - -def test_can_import_misc_resources() -> None: - from stripe.api_resources import ErrorObject, OAuthErrorObject # type: ignore - from stripe import ( - 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 - from stripe import FileUpload as FileUploadFromStripe # type: ignore - - assert ErrorObject is stripe.ErrorObject - assert ErrorObjectFromStripe is stripe.ErrorObject - assert ErrorObjectFromStripe is ErrorObjectFromStripeApiResources - - assert OAuthErrorObject is stripe.OAuthErrorObject - assert OAuthErrorObjectFromStripe is stripe.OAuthErrorObject - assert OAuthErrorObject is OAuthErrorObjectFromStripeApiResources - - assert FileUploadFromApiResources is stripe.FileUpload # type: ignore - assert FileUploadFromApiResources is FileUploadFromStripe - - assert_output("stripe.error is not None", "True") - def test_can_import_abstract() -> None: - # fmt: off - from stripe.api_resources.abstract import APIResource as APIResourceFromAbstract # type: ignore - from stripe.api_resources.abstract import SingletonAPIResource as SingletonFromAbstract # type: ignore - from stripe.api_resources.abstract import CreateableAPIResource as CreateableFromAbstract # type: ignore - from stripe.api_resources.abstract import UpdateableAPIResource as UpdateableFromAbstract # type: ignore - from stripe.api_resources.abstract import DeletableAPIResource as DeletableFromAbstract # type: ignore - from stripe.api_resources.abstract import ListableAPIResource as ListableFromAbstract # type: ignore - from stripe.api_resources.abstract import SearchableAPIResource as SearchableFromAbstract # type: ignore - from stripe.api_resources.abstract import VerifyMixin as VerifyMixinFromAbstract # type: ignore - from stripe.api_resources.abstract import APIResourceTestHelpers as APIResourceTestHelpersFromAbstract # type: ignore - from stripe.api_resources.abstract import custom_method as custom_methodFromAbstract - from stripe.api_resources.abstract import nested_resource_class_methods as nested_resource_class_methodsFromAbstract - from stripe import APIResource as APIResourceFromStripe - from stripe import SingletonAPIResource as SingletonFromStripe - from stripe import CreateableAPIResource as CreateableFromStripe - from stripe import UpdateableAPIResource as UpdateableFromStripe - from stripe import DeletableAPIResource as DeletableFromStripe - from stripe import ListableAPIResource as ListableFromStripe - from stripe import SearchableAPIResource as SearchableFromStripe - from stripe import VerifyMixin as VerifyMixinFromStripe - from stripe import APIResourceTestHelpers as APIResourceTestHelpersFromStripe - from stripe import custom_method as custom_methodFromStripe # pyright: ignore[reportDeprecated] - from stripe import nested_resource_class_methods as nested_resource_class_methodsFromStripe - # fmt: on - - from stripe.stripe_object import StripeObject # type: ignore - - assert ( - APIResourceFromAbstract[StripeObject] - == stripe.abstract.APIResource[StripeObject] # type: ignore - ) - assert ( - stripe.abstract.SingletonAPIResource[StripeObject] # type: ignore - == SingletonFromAbstract[StripeObject] - ) - assert ( - stripe.abstract.CreateableAPIResource[StripeObject] # type: ignore - == CreateableFromAbstract[StripeObject] - ) - assert ( - stripe.abstract.UpdateableAPIResource[StripeObject] # type: ignore - == UpdateableFromAbstract[StripeObject] - ) - assert ( - stripe.abstract.DeletableAPIResource[StripeObject] # type: ignore - == DeletableFromAbstract[StripeObject] - ) - assert ( - stripe.abstract.ListableAPIResource[StripeObject] # type: ignore - == ListableFromAbstract[StripeObject] - ) - assert ( - stripe.abstract.SearchableAPIResource[StripeObject] # type: ignore - == SearchableFromAbstract[StripeObject] - ) - assert stripe.abstract.VerifyMixin is VerifyMixinFromAbstract # type: ignore - assert ( - stripe.abstract.custom_method is custom_methodFromAbstract # type: ignore - ) - assert ( - stripe.abstract.APIResourceTestHelpers[Any] # type: ignore - is APIResourceTestHelpersFromAbstract[Any] - ) - assert ( - stripe.abstract.nested_resource_class_methods # type: ignore - is nested_resource_class_methodsFromAbstract - ) - - assert APIResourceFromStripe is APIResourceFromAbstract - assert SingletonFromStripe is SingletonFromAbstract - assert CreateableFromStripe is CreateableFromAbstract - assert UpdateableFromStripe is UpdateableFromAbstract - assert DeletableFromStripe is DeletableFromAbstract - assert ListableFromStripe is ListableFromAbstract - assert SearchableFromStripe is SearchableFromAbstract - assert VerifyMixinFromStripe is VerifyMixinFromAbstract - assert ( - APIResourceTestHelpersFromStripe is APIResourceTestHelpersFromAbstract - ) - assert custom_methodFromStripe is custom_methodFromAbstract - assert ( - nested_resource_class_methodsFromStripe - is nested_resource_class_methodsFromAbstract + from stripe import ( + APIResource, # pyright: ignore[reportUnusedImport] + SingletonAPIResource, # pyright: ignore[reportUnusedImport] + CreateableAPIResource, # pyright: ignore[reportUnusedImport] + UpdateableAPIResource, # pyright: ignore[reportUnusedImport] + DeletableAPIResource, # pyright: ignore[reportUnusedImport] + ListableAPIResource, # pyright: ignore[reportUnusedImport] + SearchableAPIResource, # pyright: ignore[reportUnusedImport] + VerifyMixin, # pyright: ignore[reportUnusedImport] + APIResourceTestHelpers, # pyright: ignore[reportUnusedImport] + custom_method, # pyright: ignore[reportDeprecated, reportUnusedImport] + nested_resource_class_methods, # pyright: ignore[reportUnusedImport] ) def test_can_import_app_info() -> None: - from stripe.app_info import AppInfo as AppInfoFromStripeAppInfo # type: ignore - from stripe import AppInfo as AppInfoFromStripe - - assert AppInfoFromStripeAppInfo is AppInfoFromStripe - assert AppInfoFromStripeAppInfo is stripe.AppInfo + from stripe import AppInfo # pyright: ignore[reportUnusedImport] 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, - StripeResponseBase as StripeResponseBaseFromStripe, - StripeStreamResponse as StripeStreamResponseFromStripe, + StripeResponse, # pyright: ignore[reportUnusedImport] + StripeResponseBase, # pyright: ignore[reportUnusedImport] + StripeStreamResponse, # pyright: ignore[reportUnusedImport] ) - assert ( - StripeResponseFromStripeResponse - is stripe.stripe_response.StripeResponse # type: ignore - ) - - assert StripeResponseFromStripe is StripeResponseFromStripeResponse - - assert StripeResponseFromStripe is stripe.StripeResponse - - assert StripeResponseBaseFromStripe is StripeResponseBaseFromStripeResponse - - assert StripeResponseBaseFromStripe is stripe.StripeResponseBase - - assert ( - StripeStreamResponseFromStripe - is StripeStreamResponseFromStripeResponse - ) - - assert StripeStreamResponseFromStripe is stripe.StripeStreamResponse - def test_can_import_oauth_members() -> None: - from stripe.oauth import OAuth as OAuthFromStripeOAuth # type: ignore - from stripe import ( - OAuth, - ) + from stripe import OAuth assert OAuth is not None - assert OAuthFromStripeOAuth is OAuth - assert OAuthFromStripeOAuth is stripe.OAuth 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, - ) - - assert ( - stripe.convert_to_stripe_object is convert_to_stripe_objectFromStripe - ) - assert ( - convert_to_stripe_objectFromStripe - is convert_to_stripe_objectFromStripeUtil - ) - assert stripe.util.io is not None # type: ignore - assert_output("stripe.util is not None", "True") + from stripe import convert_to_stripe_object # pyright: ignore[reportUnusedImport] def test_can_import_errors() -> None: # fmt: off - from stripe.error import StripeError as StripeErrorFromStripeError # type: ignore - from stripe.error import APIError as APIErrorFromStripeError # type: ignore - from stripe.error import APIConnectionError as APIConnectionErrorFromStripeError # type: ignore - from stripe.error import StripeErrorWithParamCode as StripeErrorWithParamCodeFromStripeError # type: ignore - from stripe.error import CardError as CardErrorFromStripeError # type: ignore - from stripe.error import IdempotencyError as IdempotencyErrorFromStripeError # type: ignore - from stripe.error import InvalidRequestError as InvalidRequestErrorFromStripeError # type: ignore - from stripe.error import AuthenticationError as AuthenticationErrorFromStripeError # type: ignore - from stripe.error import PermissionError as PermissionErrorFromStripeError # type: ignore - from stripe.error import RateLimitError as RateLimitErrorFromStripeError # type: ignore - from stripe.error import SignatureVerificationError as SignatureVerificationErrorFromStripeError # type: ignore + from stripe import StripeError # pyright: ignore[reportUnusedImport] + from stripe import APIError # pyright: ignore[reportUnusedImport] + from stripe import APIConnectionError # pyright: ignore[reportUnusedImport] + from stripe import StripeErrorWithParamCode # pyright: ignore[reportUnusedImport] + from stripe import CardError # pyright: ignore[reportUnusedImport] + from stripe import IdempotencyError # pyright: ignore[reportUnusedImport] + from stripe import InvalidRequestError # pyright: ignore[reportUnusedImport] + from stripe import AuthenticationError # pyright: ignore[reportUnusedImport] + from stripe import PermissionError # pyright: ignore[reportUnusedImport] + from stripe import RateLimitError # pyright: ignore[reportUnusedImport] + from stripe import SignatureVerificationError # pyright: ignore[reportUnusedImport] # fmt: on - from stripe import StripeError as StripeErrorFromStripe - from stripe import APIError as APIErrorFromStripe - from stripe import APIConnectionError as APIConnectionErrorFromStripe - from stripe import ( - StripeErrorWithParamCode as StripeErrorWithParamCodeFromStripe, - ) - from stripe import CardError as CardErrorFromStripe - from stripe import IdempotencyError as IdempotencyErrorFromStripe - from stripe import InvalidRequestError as InvalidRequestErrorFromStripe - from stripe import AuthenticationError as AuthenticationErrorFromStripe - from stripe import PermissionError as PermissionErrorFromStripe - from stripe import RateLimitError as RateLimitErrorFromStripe - from stripe import ( - SignatureVerificationError as SignatureVerificationErrorFromStripe, - ) - - assert StripeErrorFromStripeError is StripeErrorFromStripe - assert APIErrorFromStripeError is APIErrorFromStripe - assert APIConnectionErrorFromStripeError is APIConnectionErrorFromStripe - assert ( - StripeErrorWithParamCodeFromStripeError - is StripeErrorWithParamCodeFromStripe - ) - assert CardErrorFromStripeError is CardErrorFromStripe - assert IdempotencyErrorFromStripeError is IdempotencyErrorFromStripe - assert InvalidRequestErrorFromStripeError is InvalidRequestErrorFromStripe - assert AuthenticationErrorFromStripeError is AuthenticationErrorFromStripe - assert PermissionErrorFromStripeError is PermissionErrorFromStripe - assert RateLimitErrorFromStripeError is RateLimitErrorFromStripe - assert ( - SignatureVerificationErrorFromStripeError - is SignatureVerificationErrorFromStripe - ) - - -def test_can_import_top_level_resource() -> None: - from stripe import Account as AccountFromStripe - from stripe.api_resources import Account as AccountFromStripeResources # type: ignore - - # This import has to be single line, mypy and pyright are producing errors - # on different lines of multiline import - from stripe.api_resources.account import Account as AccFromModule # type: ignore - - assert stripe.Account == AccountFromStripe - assert AccountFromStripe == AccountFromStripeResources - assert AccFromModule == AccountFromStripeResources - - assert_output("stripe.api_resources.Account is not None", "True") - assert_output("stripe.api_resources.account is not None", "True") - assert_output("stripe.api_resources.account.Account is not None", "True") - def test_can_import_namespaced_resource() -> None: from stripe import tax as TaxPackage @@ -395,21 +102,9 @@ def test_can_import_namespaced_resource() -> None: Calculation as CalculationFromStripe, ) - # This import has to be single line, mypy and pyright are producing errors - # on different lines of multiline import - from stripe.api_resources.tax import Calculation as CalcFromResources # type: ignore - - # 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 assert stripe.tax.Calculation is TaxPackage.Calculation - assert stripe.tax.Calculation is CalcFromResources - assert CalcFromResources is CalcFromModule assert_output("stripe.tax is not None", "True") assert_output("stripe.tax.Calculation is not None", "True") diff --git a/tests/test_http_client.py b/tests/test_http_client.py index af295337..2f183498 100644 --- a/tests/test_http_client.py +++ b/tests/test_http_client.py @@ -1,3 +1,4 @@ +import io import base64 import json import sys @@ -17,7 +18,7 @@ from contextlib import contextmanager import urllib3 import stripe -from stripe import APIConnectionError, _http_client, _util +from stripe import APIConnectionError, _http_client from stripe._encode import _api_encode from stripe._http_client import ( AIOHTTPClient, @@ -636,7 +637,7 @@ class TestRequestsClient(ClientTestBase): result.status_code = code result.headers = {} result.raw = urllib3.response.HTTPResponse( - body=_util.io.BytesIO(str.encode(body)), + body=io.BytesIO(str.encode(body)), preload_content=False, status=code, ) @@ -723,7 +724,7 @@ class TestRequestClientRetryBehavior(TestRequestsClient): result.status_code = code result.headers = headers or {} result.raw = urllib3.response.HTTPResponse( - body=_util.io.BytesIO(str.encode(result.content)), + body=io.BytesIO(str.encode(result.content)), preload_content=False, status=code, ) @@ -1081,7 +1082,7 @@ class TestPycurlClient(ClientTestBase): @pytest.fixture def bio_mock(self, mocker): - bio_patcher = mocker.patch("stripe.util.io.BytesIO") + bio_patcher = mocker.patch("stripe._http_client.BytesIO") bio_mock = Mock() bio_patcher.return_value = bio_mock return bio_mock diff --git a/tests/test_integration.py b/tests/test_integration.py index d40bb934..b5adcb97 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -14,6 +14,7 @@ from collections import defaultdict from typing import List, Dict, Tuple, Optional from stripe._stripe_client import StripeClient +from stripe._http_client import new_default_http_client if platform.python_implementation() == "PyPy": pytest.skip("skip integration tests with PyPy", allow_module_level=True) @@ -191,7 +192,7 @@ class TestIntegration(object): client = stripe.StripeClient( "sk_test_123", - http_client=stripe.http_client.new_default_http_client( + http_client=new_default_http_client( proxy="http://localhost:%s" % self.mock_server_port ), base_addresses={"api": "http://localhost:12111"}, diff --git a/tests/test_stripe_client.py b/tests/test_stripe_client.py index e06082e7..13097b21 100644 --- a/tests/test_stripe_client.py +++ b/tests/test_stripe_client.py @@ -7,6 +7,7 @@ from stripe._http_client import new_default_http_client from stripe.events._v1_billing_meter_error_report_triggered_event import ( V1BillingMeterErrorReportTriggeredEvent, ) +from stripe._error import AuthenticationError class TestStripeClient(object): @@ -59,7 +60,7 @@ class TestStripeClient(object): assert isinstance(event, V1BillingMeterErrorReportTriggeredEvent) def test_no_api_key(self): - with pytest.raises(stripe.error.AuthenticationError): + with pytest.raises(AuthenticationError): stripe.StripeClient(None) # type: ignore def test_http_client_and_options_overlap(self): diff --git a/tests/test_stripe_object.py b/tests/test_stripe_object.py index be893167..c6356d67 100644 --- a/tests/test_stripe_object.py +++ b/tests/test_stripe_object.py @@ -6,6 +6,7 @@ from copy import copy, deepcopy import pytest import stripe +from stripe._stripe_object import StripeObject # We use this because it has a map, "restriction.currency_options" from string -> CurrencyOptions nested class. SAMPLE_PROMOTION_CODE = json.loads( @@ -79,15 +80,13 @@ SAMPLE_INVOICE = json.loads( class TestStripeObject(object): def test_initializes_with_parameters(self): - obj = stripe.stripe_object.StripeObject( - "foo", "bar", myparam=5, yourparam="boo" - ) + obj = StripeObject("foo", "bar", myparam=5, yourparam="boo") assert obj.id == "foo" assert obj.api_key == "bar" def test_access(self): - obj = stripe.stripe_object.StripeObject("myid", "mykey", myparam=5) + obj = StripeObject("myid", "mykey", myparam=5) # Empty with pytest.raises(AttributeError): @@ -117,7 +116,7 @@ class TestStripeObject(object): obj.foo = "" def test_refresh_from(self, mocker): - obj = stripe.stripe_object.StripeObject.construct_from( + obj = StripeObject.construct_from( {"foo": "bar", "trans": "me"}, "mykey" ) @@ -154,7 +153,7 @@ class TestStripeObject(object): assert obj.trans == 4 def test_passing_nested_refresh(self): - obj = stripe.stripe_object.StripeObject.construct_from( + obj = StripeObject.construct_from( {"foos": {"type": "list", "data": [{"id": "nested"}]}}, "key", stripe_account="acct_foo", @@ -204,9 +203,7 @@ class TestStripeObject(object): assert seen == ["sli_xyz"] assert isinstance(obj.lines.data[0], stripe.InvoiceLineItem) - assert isinstance( - obj.lines.data[0].price, stripe.stripe_object.StripeObject - ) + assert isinstance(obj.lines.data[0].price, StripeObject) assert isinstance(obj.lines.data[0].price, stripe.Price) assert obj.lines.data[0].price.billing_scheme == "per_unit" @@ -219,7 +216,7 @@ class TestStripeObject(object): ) assert not isinstance( obj.restrictions.currency_options, - stripe.stripe_object.StripeObject, + StripeObject, ) assert isinstance( obj.restrictions.currency_options["gbp"], @@ -227,9 +224,7 @@ class TestStripeObject(object): ) def test_to_json(self): - obj = stripe.stripe_object.StripeObject.construct_from( - SAMPLE_INVOICE, "key" - ) + obj = StripeObject.construct_from(SAMPLE_INVOICE, "key") self.check_invoice_data(json.loads(str(obj))) @@ -248,7 +243,7 @@ class TestStripeObject(object): ) def test_repr(self): - obj = stripe.stripe_object.StripeObject("foo", "bar", myparam=5) + obj = StripeObject("foo", "bar", myparam=5) obj["object"] = "\u4e00boo\u1f00" obj.date = datetime.datetime.fromtimestamp(1511136000) @@ -260,7 +255,7 @@ class TestStripeObject(object): assert '"date": 1511136000' in res def test_pickling(self): - obj = stripe.stripe_object.StripeObject("foo", "bar", myparam=5) + obj = StripeObject("foo", "bar", myparam=5) obj["object"] = "boo" obj.refresh_from( @@ -285,7 +280,7 @@ class TestStripeObject(object): assert newobj.emptystring == "" def test_deletion(self): - obj = stripe.stripe_object.StripeObject("id", "key") + obj = StripeObject("id", "key") obj.coupon = "foo" assert obj.coupon == "foo" @@ -298,7 +293,7 @@ class TestStripeObject(object): assert obj.coupon == "foo" def test_deletion_metadata(self): - obj = stripe.stripe_object.StripeObject.construct_from( + obj = StripeObject.construct_from( {"metadata": {"key": "value"}}, "mykey" ) @@ -309,10 +304,8 @@ class TestStripeObject(object): obj.metadata["key"] def test_copy(self): - nested = stripe.stripe_object.StripeObject.construct_from( - {"value": "bar"}, "mykey" - ) - obj = stripe.stripe_object.StripeObject.construct_from( + nested = StripeObject.construct_from({"value": "bar"}, "mykey") + obj = StripeObject.construct_from( {"empty": "", "value": "foo", "nested": nested}, "mykey", stripe_account="myaccount", @@ -331,10 +324,8 @@ class TestStripeObject(object): assert id(nested) == id(copied.nested) def test_deepcopy(self): - nested = stripe.stripe_object.StripeObject.construct_from( - {"value": "bar"}, "mykey" - ) - obj = stripe.stripe_object.StripeObject.construct_from( + nested = StripeObject.construct_from({"value": "bar"}, "mykey") + obj = StripeObject.construct_from( {"empty": "", "value": "foo", "nested": nested}, "mykey", stripe_account="myaccount", @@ -353,13 +344,9 @@ class TestStripeObject(object): assert id(nested) != id(copied.nested) def test_to_dict_recursive(self): - foo = stripe.stripe_object.StripeObject.construct_from( - {"value": "foo"}, "mykey" - ) - bar = stripe.stripe_object.StripeObject.construct_from( - {"value": "bar"}, "mykey" - ) - obj = stripe.stripe_object.StripeObject.construct_from( + foo = StripeObject.construct_from({"value": "foo"}, "mykey") + bar = StripeObject.construct_from({"value": "bar"}, "mykey") + obj = StripeObject.construct_from( {"empty": "", "value": "foobar", "nested": [foo, bar]}, "mykey" ) @@ -369,36 +356,30 @@ class TestStripeObject(object): "value": "foobar", "nested": [{"value": "foo"}, {"value": "bar"}], } - assert not isinstance( - d["nested"][0], stripe.stripe_object.StripeObject - ) - assert not isinstance( - d["nested"][1], stripe.stripe_object.StripeObject - ) + assert not isinstance(d["nested"][0], StripeObject) + assert not isinstance(d["nested"][1], StripeObject) def test_serialize_empty_string_unsets(self): - class SerializeToEmptyString(stripe.stripe_object.StripeObject): + class SerializeToEmptyString(StripeObject): def serialize(self, previous): return "" nested = SerializeToEmptyString.construct_from( {"value": "bar"}, "mykey" ) - obj = stripe.stripe_object.StripeObject.construct_from( - {"nested": nested}, "mykey" - ) + obj = StripeObject.construct_from({"nested": nested}, "mykey") assert obj.serialize(None) == {"nested": ""} def test_field_name_remapping(self): - class Foo(stripe.stripe_object.StripeObject): + class Foo(StripeObject): _field_remappings = {"getter_name": "data_name"} obj = Foo.construct_from({"data_name": "foo"}, "mykey") assert obj.getter_name == "foo" def test_sends_request_with_api_key(self, http_client_mock): - obj = stripe.stripe_object.StripeObject("id", "key") + obj = StripeObject("id", "key") http_client_mock.stub_request( "get", @@ -415,7 +396,7 @@ class TestStripeObject(object): @pytest.mark.anyio async def test_request_async_succeeds(self, http_client_mock): http_client_mock.stub_request("get", "/foo") - obj = stripe.stripe_object.StripeObject("id", "key") + obj = StripeObject("id", "key") await obj._request_async("get", "/foo", base_address="api") http_client_mock.assert_requested( api_key="key", @@ -423,9 +404,7 @@ class TestStripeObject(object): ) def test_refresh_from_creates_new_requestor(self): - obj = stripe.stripe_object.StripeObject.construct_from( - {}, key="origkey" - ) + obj = StripeObject.construct_from({}, key="origkey") orig_requestor = obj._requestor assert obj.api_key == "origkey" @@ -438,7 +417,7 @@ class TestStripeObject(object): assert orig_requestor.api_key == "origkey" def test_can_update_api_key(self, http_client_mock): - obj = stripe.stripe_object.StripeObject("id", "key") + obj = StripeObject("id", "key") http_client_mock.stub_request( "get", diff --git a/tests/test_util.py b/tests/test_util.py index aa01eed5..1331dbe2 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -3,10 +3,19 @@ from collections import namedtuple import pytest -import stripe -from stripe import util +from stripe._util import ( + dashboard_link, + convert_to_dict, + convert_to_stripe_object, + logfmt, + log_info, + log_debug, + sanitize_id, +) +from stripe import Balance from stripe._api_mode import ApiMode from stripe._util import get_api_mode +from stripe._stripe_object import StripeObject LogTestCase = namedtuple("LogTestCase", "env flag should_output") FmtTestCase = namedtuple("FmtTestCase", "props expected") @@ -17,7 +26,7 @@ class TestUtil(object): def test_test_apikey(self, mocker): mocker.patch("stripe.api_key", "sk_test_KOWobxXidxNlIx") - link = util.dashboard_link(self.DUMMY_REQ_ID) + link = dashboard_link(self.DUMMY_REQ_ID) assert ( link == "https://dashboard.stripe.com/test/logs/" + self.DUMMY_REQ_ID @@ -25,7 +34,7 @@ class TestUtil(object): def test_live_apikey(self, mocker): mocker.patch("stripe.api_key", "sk_live_axwITqZSgTUXSN") - link = util.dashboard_link(self.DUMMY_REQ_ID) + link = dashboard_link(self.DUMMY_REQ_ID) assert ( link == "https://dashboard.stripe.com/live/logs/" + self.DUMMY_REQ_ID @@ -33,7 +42,7 @@ class TestUtil(object): def test_no_apikey(self, mocker): mocker.patch("stripe.api_key", None) - link = util.dashboard_link(self.DUMMY_REQ_ID) + link = dashboard_link(self.DUMMY_REQ_ID) assert ( link == "https://dashboard.stripe.com/test/logs/" + self.DUMMY_REQ_ID @@ -41,7 +50,7 @@ class TestUtil(object): def test_old_apikey(self, mocker): mocker.patch("stripe.api_key", "axwITqZSgTUXSN") - link = util.dashboard_link(self.DUMMY_REQ_ID) + link = dashboard_link(self.DUMMY_REQ_ID) assert ( link == "https://dashboard.stripe.com/test/logs/" + self.DUMMY_REQ_ID @@ -82,8 +91,8 @@ class TestUtil(object): ] self.log_test_loop( test_cases, - logging_func=util.log_debug, - logger_name="stripe.util.logger.debug", + logging_func=log_debug, + logger_name="stripe._util.logger.debug", mocker=mocker, ) @@ -102,8 +111,8 @@ class TestUtil(object): ] self.log_test_loop( test_cases, - logging_func=util.log_info, - logger_name="stripe.util.logger.info", + logging_func=log_info, + logger_name="stripe._util.logger.info", mocker=mocker, ) @@ -123,7 +132,7 @@ class TestUtil(object): ), ] for case in cases: - result = util.logfmt(case.props) + result = logfmt(case.props) assert result == case.expected def test_convert_to_stripe_object_and_back(self): @@ -139,12 +148,12 @@ class TestUtil(object): "livemode": False, } - obj = util.convert_to_stripe_object(resp, api_mode="V1") - assert isinstance(obj, stripe.Balance) + obj = convert_to_stripe_object(resp, api_mode="V1") + assert isinstance(obj, Balance) assert isinstance(obj.available, list) - assert isinstance(obj.available[0], stripe.stripe_object.StripeObject) + assert isinstance(obj.available[0], StripeObject) - d = util.convert_to_dict(obj) + d = convert_to_dict(obj) assert isinstance(d, dict) assert isinstance(d["available"], list) assert isinstance(d["available"][0], dict) @@ -152,7 +161,7 @@ class TestUtil(object): assert d == resp def test_sanitize_id(self): - sanitized_id = util.sanitize_id("cu %x 123") + sanitized_id = sanitize_id("cu %x 123") if isinstance(sanitized_id, bytes): sanitized_id = sanitized_id.decode("utf-8", "strict") assert sanitized_id == "cu++%25x+123" diff --git a/tests/test_v2_error.py b/tests/test_v2_error.py index f2828c37..e470d018 100644 --- a/tests/test_v2_error.py +++ b/tests/test_v2_error.py @@ -5,7 +5,7 @@ import json import pytest import stripe -from stripe import error +from stripe._error import InvalidRequestError, TemporarySessionExpiredError from tests.http_client_mock import HTTPClientMock @@ -42,7 +42,7 @@ class TestV2Error(object): try: stripe_client.v2.core.events.retrieve("evt_123") - except error.TemporarySessionExpiredError as e: + except TemporarySessionExpiredError as e: assert e.code == "session_bad" assert e.error.code == "session_bad" assert e.error.message == "you messed up" @@ -55,47 +55,47 @@ class TestV2Error(object): api_key="keyinfo_test_123", ) - @pytest.mark.skip("python doesn't have any errors with invalid params yet") - def test_raises_v2_error_with_field( - self, - stripe_client: stripe.StripeClient, - http_client_mock: HTTPClientMock, - ): - method = "post" - path = "/v2/payment_methods/us_bank_accounts" - - error_response = { - "error": { - "type": "invalid_payment_method", - "code": "invalid_us_bank_account", - "message": "bank account is invalid", - "invalid_param": "routing_number", - } - } - http_client_mock.stub_request( - method, - path=path, - rbody=json.dumps(error_response), - rcode=400, - rheaders={}, - ) - - try: - stripe_client.v2.payment_methods.us_bank_accounts.create( - params={"account_number": "123", "routing_number": "456"} - ) - except error.InvalidPaymentMethodError as e: - assert e.invalid_param == "routing_number" - assert e.error.code == "invalid_us_bank_account" - assert e.error.message == "bank account is invalid" - else: - assert False, "Should have raised a InvalidUsBankAccountError" - - http_client_mock.assert_requested( - method, - path=path, - api_key="keyinfo_test_123", - ) + # @pytest.mark.skip("python doesn't have any errors with invalid params yet") + # def test_raises_v2_error_with_field( + # self, + # stripe_client: stripe.StripeClient, + # http_client_mock: HTTPClientMock, + # ): + # method = "post" + # path = "/v2/payment_methods/us_bank_accounts" + + # error_response = { + # "error": { + # "type": "invalid_payment_method", + # "code": "invalid_us_bank_account", + # "message": "bank account is invalid", + # "invalid_param": "routing_number", + # } + # } + # http_client_mock.stub_request( + # method, + # path=path, + # rbody=json.dumps(error_response), + # rcode=400, + # rheaders={}, + # ) + + # try: + # stripe_client.v2.payment_methods.us_bank_accounts.create( + # params={"account_number": "123", "routing_number": "456"} + # ) + # except error.InvalidPaymentMethodError as e: + # assert e.invalid_param == "routing_number" + # assert e.error.code == "invalid_us_bank_account" + # assert e.error.message == "bank account is invalid" + # else: + # assert False, "Should have raised a InvalidUsBankAccountError" + + # http_client_mock.assert_requested( + # method, + # path=path, + # api_key="keyinfo_test_123", + # ) def test_falls_back_to_v1_error( self, @@ -124,7 +124,7 @@ class TestV2Error(object): stripe_client.v2.billing.meter_events.create( {"event_name": "asdf", "payload": {}} ) - except error.InvalidRequestError as e: + except InvalidRequestError as e: assert e.param == "invalid_param" assert repr(e) == ( "InvalidRequestError(message='your request is invalid', " diff --git a/tests/test_webhook.py b/tests/test_webhook.py index 53389f72..cd648faa 100644 --- a/tests/test_webhook.py +++ b/tests/test_webhook.py @@ -3,6 +3,7 @@ import time import pytest import stripe +from stripe._error import SignatureVerificationError DUMMY_WEBHOOK_PAYLOAD = """{ @@ -47,7 +48,7 @@ class TestWebhook(object): def test_raise_on_invalid_header(self): header = "bad_header" - with pytest.raises(stripe.error.SignatureVerificationError): + with pytest.raises(SignatureVerificationError): stripe.Webhook.construct_event( DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET ) @@ -73,7 +74,7 @@ class TestWebhookSignature(object): def test_raise_on_malformed_header(self): header = "i'm not even a real signature header" with pytest.raises( - stripe.error.SignatureVerificationError, + SignatureVerificationError, match="Unable to extract timestamp and signatures from header", ): stripe.WebhookSignature.verify_header( @@ -83,7 +84,7 @@ class TestWebhookSignature(object): def test_raise_on_no_signatures_with_expected_scheme(self): header = generate_header(scheme="v0") with pytest.raises( - stripe.error.SignatureVerificationError, + SignatureVerificationError, match="No signatures found with expected scheme v1", ): stripe.WebhookSignature.verify_header( @@ -93,7 +94,7 @@ class TestWebhookSignature(object): def test_raise_on_no_valid_signatures_for_payload(self): header = generate_header(signature="bad_signature") with pytest.raises( - stripe.error.SignatureVerificationError, + SignatureVerificationError, match="No signatures found matching the expected signature for payload", ): stripe.WebhookSignature.verify_header( @@ -103,7 +104,7 @@ class TestWebhookSignature(object): def test_raise_on_timestamp_outside_tolerance(self): header = generate_header(timestamp=int(time.time()) - 15) with pytest.raises( - stripe.error.SignatureVerificationError, + SignatureVerificationError, match="Timestamp outside the tolerance zone", ): stripe.WebhookSignature.verify_header( @@ -150,7 +151,7 @@ class TestStripeClientConstructEvent(object): def test_raise_on_invalid_header(self, stripe_mock_stripe_client): header = "bad_header" - with pytest.raises(stripe.error.SignatureVerificationError): + with pytest.raises(SignatureVerificationError): stripe_mock_stripe_client.construct_event( DUMMY_WEBHOOK_PAYLOAD, header, DUMMY_WEBHOOK_SECRET ) |