Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove more deprecated methods #1204

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

from stripe._base_address import BaseAddress
from stripe._api_mode import ApiMode
from stripe import _util

if TYPE_CHECKING:
from stripe._stripe_object import StripeObject
Expand Down Expand Up @@ -143,13 +142,6 @@ def _global_with_options(
) -> "APIRequestor":
return APIRequestor._global_instance()._replace_options(params)

@classmethod
@_util.deprecated(
"This method is internal to stripe-python and the public interface will be removed in a future stripe-python version"
)
def format_app_info(cls, info):
return cls._format_app_info(info)

@classmethod
def _format_app_info(cls, info):
str = info["name"]
Expand Down
13 changes: 1 addition & 12 deletions stripe/_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import stripe # noqa: IMP101
from stripe._error_object import ErrorObject

from stripe import _util
import warnings


class StripeError(Exception):
_message: Optional[str]
Expand Down Expand Up @@ -71,10 +68,7 @@ def __repr__(self):
self.request_id,
)

@_util.deprecated(
"For internal stripe-python use only. The public interface will be removed in a future version."
)
def construct_error_object(self) -> Optional[ErrorObject]:
def _construct_error_object(self) -> Optional[ErrorObject]:
if (
self.json_body is None
or not isinstance(self.json_body, dict)
Expand All @@ -89,11 +83,6 @@ def construct_error_object(self) -> Optional[ErrorObject]:
api_mode="V1",
)

def _construct_error_object(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
return self.construct_error_object()


class APIError(StripeError):
pass
Expand Down
10 changes: 0 additions & 10 deletions stripe/_list_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,6 @@ def auto_paging_iter(self) -> Iterator[T]:
if page.is_empty:
break

@classmethod
@_util.deprecated(
"This method is for internal stripe-python use only. The public interface will be removed in a future version."
)
def empty_list(
cls,
**params: Unpack[RequestOptions],
) -> Self:
return cls._empty_list(**params)

@classmethod
def _empty_list(
cls,
Expand Down
12 changes: 0 additions & 12 deletions stripe/_search_result_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ def _empty_search_result(
api_mode="V1",
)

@classmethod
@_util.deprecated(
"For internal stripe-python use only. This will be removed in a future version."
)
def empty_search_result(
cls,
**params: Unpack[RequestOptions],
) -> Self:
return cls._empty_search_result(
**params,
)

@property
def is_empty(self) -> bool:
return not self.data
Expand Down
13 changes: 0 additions & 13 deletions stripe/_stripe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ def default(self, o: Any) -> Any:
return _encode_datetime(o)
return super(StripeObject._ReprJSONEncoder, self).default(o)

@_util.deprecated(
"For internal stripe-python use only. The public interface will be removed in a future version"
)
class ReprJSONEncoder(_ReprJSONEncoder):
pass

_retrieve_params: Mapping[str, Any]
_previous: Optional[Mapping[str, Any]]

Expand Down Expand Up @@ -376,13 +370,6 @@ def _refresh_from(

self._previous = values

@classmethod
@_util.deprecated(
"This will be removed in a future version of stripe-python."
)
def api_base(cls) -> Optional[str]:
return None

@_util.deprecated(
"This will be removed in a future version of stripe-python."
)
Expand Down
2 changes: 1 addition & 1 deletion stripe/oauth_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(
description, http_body, http_status, json_body, headers, code
)

def construct_error_object(self):
def _construct_error_object(self):
if self.json_body is None:
return None

Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_list_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_is_empty(self):
assert lo.is_empty is True

def test_empty_list(self):
lo = stripe.ListObject.empty_list()
lo = stripe.ListObject._empty_list()
assert lo.is_empty

def test_iter(self):
Expand Down Expand Up @@ -176,7 +176,7 @@ def test_next_page_empty_list(self):
)

next_lo = lo.next_page()
assert next_lo == stripe.ListObject.empty_list()
assert next_lo == stripe.ListObject._empty_list()

def test_prev_page(self, http_client_mock):
lo = stripe.ListObject.construct_from(
Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_search_result_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_is_empty(self):
assert sro.is_empty is True

def test_empty_search_result(self):
sro = stripe.SearchResultObject.empty_search_result()
sro = stripe.SearchResultObject._empty_search_result()
assert sro.is_empty

def test_iter(self):
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_next_search_result_page_empty_search_result(self):
)

next_sro = sro.next_search_result_page()
assert next_sro == stripe.SearchResultObject.empty_search_result()
assert next_sro == stripe.SearchResultObject._empty_search_result()

def test_serialize_empty_search_result(self):
empty = stripe.SearchResultObject.construct_from(
Expand Down