diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4b6cc3c..dc9bcb3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.46.0" + ".": "1.47.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ed1713f..7ec943d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 10 +configured_endpoints: 9 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/babs-technologies%2Fspitch-d909291d8029ce7de8d2ccad8e6d05f1f1d893f2ba68fcf6c1cd7265ab6a8df9.yml openapi_spec_hash: 243f422b356ab7c8c417f87fe9ae2ad6 -config_hash: a7d6293922d36aa3c3d9d7418f952ece +config_hash: 75f0cebdc2bbaa3b412c700aac6d0a13 diff --git a/CHANGELOG.md b/CHANGELOG.md index dced65b..3134d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 1.47.0 (2026-02-04) + +Full Changelog: [v1.46.0...v1.47.0](https://github.com/spi-tch/spitch-python/compare/v1.46.0...v1.47.0) + +### Features + +* **api:** manual updates ([fc95856](https://github.com/spi-tch/spitch-python/commit/fc95856fb63359296f4c6211b58d2297559a7670)) +* **api:** manual updates ([fc4b87a](https://github.com/spi-tch/spitch-python/commit/fc4b87a89ee3e9bd71b91261b47e49ef93198543)) +* **api:** manual updates ([37b581a](https://github.com/spi-tch/spitch-python/commit/37b581a20032fe936d4cec742e3fc17bca98f4b4)) +* **api:** manual updates ([671d858](https://github.com/spi-tch/spitch-python/commit/671d858a48e9b4af627d8ee4c13460cd05b55f51)) + ## 1.46.0 (2026-02-04) Full Changelog: [v1.45.0...v1.46.0](https://github.com/spi-tch/spitch-python/compare/v1.45.0...v1.46.0) diff --git a/README.md b/README.md index 944ff82..978cf28 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ client = Spitch() all_files = [] # Automatically fetches more pages as needed. for file in client.files.list( - limit=10, + limit=50, ): # Do something with file here all_files.append(file) @@ -149,7 +149,7 @@ async def main() -> None: all_files = [] # Iterate through items across all pages, issuing requests as needed. async for file in client.files.list( - limit=10, + limit=50, ): all_files.append(file) print(all_files) @@ -162,7 +162,7 @@ Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get ```python first_page = await client.files.list( - limit=10, + limit=50, ) if first_page.has_next_page(): print(f"will fetch next page using these details: {first_page.next_page_info()}") @@ -176,7 +176,7 @@ Or just work directly with the returned data: ```python first_page = await client.files.list( - limit=10, + limit=50, ) print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..." diff --git a/api.md b/api.md index 8913e54..e6d09e9 100644 --- a/api.md +++ b/api.md @@ -29,14 +29,13 @@ Methods: Types: ```python -from spitch.types import File, FileUsage, Files, FileDeleteResponse +from spitch.types import FileMeta, FileUsage, FileDeleteResponse ``` Methods: -- client.files.list(\*\*params) -> SyncFilesCursor[File] +- client.files.list(\*\*params) -> SyncFilesCursor[FileMeta] - client.files.delete(file_id) -> FileDeleteResponse - client.files.download(file_id, \*\*params) -> object -- client.files.get(file_id) -> File -- client.files.upload(\*\*params) -> File +- client.files.upload(\*\*params) -> FileMeta - client.files.usage() -> FileUsage diff --git a/pyproject.toml b/pyproject.toml index 6a10cad..4e4f392 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "spitch" -version = "1.46.0" +version = "1.47.0" description = "The official Python library for the Spitch API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/spitch/_constants.py b/src/spitch/_constants.py index 6ddf2c7..d75fcb5 100644 --- a/src/spitch/_constants.py +++ b/src/spitch/_constants.py @@ -10,5 +10,5 @@ DEFAULT_MAX_RETRIES = 2 DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) -INITIAL_RETRY_DELAY = 0.5 -MAX_RETRY_DELAY = 8.0 +INITIAL_RETRY_DELAY = 0.3 +MAX_RETRY_DELAY = 10.0 diff --git a/src/spitch/_version.py b/src/spitch/_version.py index 9384528..6751d47 100644 --- a/src/spitch/_version.py +++ b/src/spitch/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "spitch" -__version__ = "1.46.0" # x-release-please-version +__version__ = "1.47.0" # x-release-please-version diff --git a/src/spitch/resources/files.py b/src/spitch/resources/files.py index 1bf894b..7fe4fa0 100644 --- a/src/spitch/resources/files.py +++ b/src/spitch/resources/files.py @@ -18,8 +18,8 @@ async_to_streamed_response_wrapper, ) from ..pagination import SyncFilesCursor, AsyncFilesCursor -from ..types.file import File from .._base_client import AsyncPaginator, make_request_options +from ..types.file_meta import FileMeta from ..types.file_usage import FileUsage from ..types.file_delete_response import FileDeleteResponse @@ -57,7 +57,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncFilesCursor[File]: + ) -> SyncFilesCursor[FileMeta]: """ Get Files @@ -72,7 +72,7 @@ def list( """ return self._get_api_list( "/v1/files", - page=SyncFilesCursor[File], + page=SyncFilesCursor[FileMeta], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -86,7 +86,7 @@ def list( file_list_params.FileListParams, ), ), - model=File, + model=FileMeta, ) def delete( @@ -160,39 +160,6 @@ def download( cast_to=object, ) - def get( - self, - file_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> File: - """ - Get File - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return self._get( - f"/v1/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=File, - ) - def upload( self, *, @@ -203,7 +170,7 @@ def upload( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> File: + ) -> FileMeta: """ Upload a file to your storage. @@ -229,7 +196,7 @@ def upload( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=File, + cast_to=FileMeta, ) def usage( @@ -283,7 +250,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[File, AsyncFilesCursor[File]]: + ) -> AsyncPaginator[FileMeta, AsyncFilesCursor[FileMeta]]: """ Get Files @@ -298,7 +265,7 @@ def list( """ return self._get_api_list( "/v1/files", - page=AsyncFilesCursor[File], + page=AsyncFilesCursor[FileMeta], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -312,7 +279,7 @@ def list( file_list_params.FileListParams, ), ), - model=File, + model=FileMeta, ) async def delete( @@ -386,39 +353,6 @@ async def download( cast_to=object, ) - async def get( - self, - file_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> File: - """ - Get File - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return await self._get( - f"/v1/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=File, - ) - async def upload( self, *, @@ -429,7 +363,7 @@ async def upload( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> File: + ) -> FileMeta: """ Upload a file to your storage. @@ -455,7 +389,7 @@ async def upload( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=File, + cast_to=FileMeta, ) async def usage( @@ -491,9 +425,6 @@ def __init__(self, files: FilesResource) -> None: self.download = to_raw_response_wrapper( files.download, ) - self.get = to_raw_response_wrapper( - files.get, - ) self.upload = to_raw_response_wrapper( files.upload, ) @@ -515,9 +446,6 @@ def __init__(self, files: AsyncFilesResource) -> None: self.download = async_to_raw_response_wrapper( files.download, ) - self.get = async_to_raw_response_wrapper( - files.get, - ) self.upload = async_to_raw_response_wrapper( files.upload, ) @@ -539,9 +467,6 @@ def __init__(self, files: FilesResource) -> None: self.download = to_streamed_response_wrapper( files.download, ) - self.get = to_streamed_response_wrapper( - files.get, - ) self.upload = to_streamed_response_wrapper( files.upload, ) @@ -563,9 +488,6 @@ def __init__(self, files: AsyncFilesResource) -> None: self.download = async_to_streamed_response_wrapper( files.download, ) - self.get = async_to_streamed_response_wrapper( - files.get, - ) self.upload = async_to_streamed_response_wrapper( files.upload, ) diff --git a/src/spitch/types/__init__.py b/src/spitch/types/__init__.py index 93e1d0f..ec9a954 100644 --- a/src/spitch/types/__init__.py +++ b/src/spitch/types/__init__.py @@ -2,9 +2,8 @@ from __future__ import annotations -from .file import File as File -from .files import Files as Files from .segment import Segment as Segment +from .file_meta import FileMeta as FileMeta from .diacritics import Diacritics as Diacritics from .file_usage import FileUsage as FileUsage from .translation import Translation as Translation diff --git a/src/spitch/types/file.py b/src/spitch/types/file_meta.py similarity index 88% rename from src/spitch/types/file.py rename to src/spitch/types/file_meta.py index 281ed0a..e2b8b29 100644 --- a/src/spitch/types/file.py +++ b/src/spitch/types/file_meta.py @@ -5,10 +5,10 @@ from .._models import BaseModel -__all__ = ["File"] +__all__ = ["FileMeta"] -class File(BaseModel): +class FileMeta(BaseModel): """Metadata info for this file.""" created_at: datetime diff --git a/src/spitch/types/files.py b/src/spitch/types/files.py deleted file mode 100644 index c29ba0d..0000000 --- a/src/spitch/types/files.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .file import File -from .._models import BaseModel - -__all__ = ["Files"] - - -class Files(BaseModel): - """an array of file information.""" - - items: List[File] - - next_cursor: Optional[str] = None diff --git a/tests/api_resources/test_files.py b/tests/api_resources/test_files.py index 7f37b8b..8f1c2b0 100644 --- a/tests/api_resources/test_files.py +++ b/tests/api_resources/test_files.py @@ -9,7 +9,11 @@ from spitch import Spitch, AsyncSpitch from tests.utils import assert_matches_type -from spitch.types import File, FileUsage, FileDeleteResponse +from spitch.types import ( + FileMeta, + FileUsage, + FileDeleteResponse, +) from spitch.pagination import SyncFilesCursor, AsyncFilesCursor base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +25,7 @@ class TestFiles: @parametrize def test_method_list(self, client: Spitch) -> None: file = client.files.list() - assert_matches_type(SyncFilesCursor[File], file, path=["response"]) + assert_matches_type(SyncFilesCursor[FileMeta], file, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Spitch) -> None: @@ -29,7 +33,7 @@ def test_method_list_with_all_params(self, client: Spitch) -> None: cursor="cursor", limit=99, ) - assert_matches_type(SyncFilesCursor[File], file, path=["response"]) + assert_matches_type(SyncFilesCursor[FileMeta], file, path=["response"]) @parametrize def test_raw_response_list(self, client: Spitch) -> None: @@ -38,7 +42,7 @@ def test_raw_response_list(self, client: Spitch) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = response.parse() - assert_matches_type(SyncFilesCursor[File], file, path=["response"]) + assert_matches_type(SyncFilesCursor[FileMeta], file, path=["response"]) @parametrize def test_streaming_response_list(self, client: Spitch) -> None: @@ -47,7 +51,7 @@ def test_streaming_response_list(self, client: Spitch) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = response.parse() - assert_matches_type(SyncFilesCursor[File], file, path=["response"]) + assert_matches_type(SyncFilesCursor[FileMeta], file, path=["response"]) assert cast(Any, response.is_closed) is True @@ -135,50 +139,12 @@ def test_path_params_download(self, client: Spitch) -> None: file_id="", ) - @parametrize - def test_method_get(self, client: Spitch) -> None: - file = client.files.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(File, file, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Spitch) -> None: - response = client.files.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(File, file, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Spitch) -> None: - with client.files.with_streaming_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(File, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Spitch) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - client.files.with_raw_response.get( - "", - ) - @parametrize def test_method_upload(self, client: Spitch) -> None: file = client.files.upload( file=b"raw file contents", ) - assert_matches_type(File, file, path=["response"]) + assert_matches_type(FileMeta, file, path=["response"]) @parametrize def test_raw_response_upload(self, client: Spitch) -> None: @@ -189,7 +155,7 @@ def test_raw_response_upload(self, client: Spitch) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = response.parse() - assert_matches_type(File, file, path=["response"]) + assert_matches_type(FileMeta, file, path=["response"]) @parametrize def test_streaming_response_upload(self, client: Spitch) -> None: @@ -200,7 +166,7 @@ def test_streaming_response_upload(self, client: Spitch) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = response.parse() - assert_matches_type(File, file, path=["response"]) + assert_matches_type(FileMeta, file, path=["response"]) assert cast(Any, response.is_closed) is True @@ -238,7 +204,7 @@ class TestAsyncFiles: @parametrize async def test_method_list(self, async_client: AsyncSpitch) -> None: file = await async_client.files.list() - assert_matches_type(AsyncFilesCursor[File], file, path=["response"]) + assert_matches_type(AsyncFilesCursor[FileMeta], file, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncSpitch) -> None: @@ -246,7 +212,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSpitch) -> N cursor="cursor", limit=99, ) - assert_matches_type(AsyncFilesCursor[File], file, path=["response"]) + assert_matches_type(AsyncFilesCursor[FileMeta], file, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncSpitch) -> None: @@ -255,7 +221,7 @@ async def test_raw_response_list(self, async_client: AsyncSpitch) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = await response.parse() - assert_matches_type(AsyncFilesCursor[File], file, path=["response"]) + assert_matches_type(AsyncFilesCursor[FileMeta], file, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncSpitch) -> None: @@ -264,7 +230,7 @@ async def test_streaming_response_list(self, async_client: AsyncSpitch) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = await response.parse() - assert_matches_type(AsyncFilesCursor[File], file, path=["response"]) + assert_matches_type(AsyncFilesCursor[FileMeta], file, path=["response"]) assert cast(Any, response.is_closed) is True @@ -352,50 +318,12 @@ async def test_path_params_download(self, async_client: AsyncSpitch) -> None: file_id="", ) - @parametrize - async def test_method_get(self, async_client: AsyncSpitch) -> None: - file = await async_client.files.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert_matches_type(File, file, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncSpitch) -> None: - response = await async_client.files.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(File, file, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncSpitch) -> None: - async with async_client.files.with_streaming_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(File, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncSpitch) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - await async_client.files.with_raw_response.get( - "", - ) - @parametrize async def test_method_upload(self, async_client: AsyncSpitch) -> None: file = await async_client.files.upload( file=b"raw file contents", ) - assert_matches_type(File, file, path=["response"]) + assert_matches_type(FileMeta, file, path=["response"]) @parametrize async def test_raw_response_upload(self, async_client: AsyncSpitch) -> None: @@ -406,7 +334,7 @@ async def test_raw_response_upload(self, async_client: AsyncSpitch) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = await response.parse() - assert_matches_type(File, file, path=["response"]) + assert_matches_type(FileMeta, file, path=["response"]) @parametrize async def test_streaming_response_upload(self, async_client: AsyncSpitch) -> None: @@ -417,7 +345,7 @@ async def test_streaming_response_upload(self, async_client: AsyncSpitch) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" file = await response.parse() - assert_matches_type(File, file, path=["response"]) + assert_matches_type(FileMeta, file, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index 8b9b263..fd945a4 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -820,21 +820,21 @@ class Model(BaseModel): "remaining_retries,retry_after,timeout", [ [3, "20", 20], - [3, "0", 0.5], - [3, "-10", 0.5], + [3, "0", 0.35], + [3, "-10", 0.35], [3, "60", 60], - [3, "61", 0.5], + [3, "61", 0.35], [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], - [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.35], + [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.35], [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], - [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], - [3, "99999999999999999999999999999999999", 0.5], - [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "", 0.5], - [2, "", 0.5 * 2.0], - [1, "", 0.5 * 4.0], - [-1100, "", 8], # test large number potentially overflowing + [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.35], + [3, "99999999999999999999999999999999999", 0.35], + [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.35], + [3, "", 0.35], + [2, "", 0.35 * 2.0], + [1, "", 0.35 * 4.0], + [-1100, "", 10], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) @@ -844,7 +844,7 @@ def test_parse_retry_after_header( headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) - assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + assert calculated == pytest.approx(timeout, 0.35 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("spitch._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -1722,21 +1722,21 @@ class Model(BaseModel): "remaining_retries,retry_after,timeout", [ [3, "20", 20], - [3, "0", 0.5], - [3, "-10", 0.5], + [3, "0", 0.35], + [3, "-10", 0.35], [3, "60", 60], - [3, "61", 0.5], + [3, "61", 0.35], [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], - [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], - [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.35], + [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.35], [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], - [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], - [3, "99999999999999999999999999999999999", 0.5], - [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], - [3, "", 0.5], - [2, "", 0.5 * 2.0], - [1, "", 0.5 * 4.0], - [-1100, "", 8], # test large number potentially overflowing + [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.35], + [3, "99999999999999999999999999999999999", 0.35], + [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.35], + [3, "", 0.35], + [2, "", 0.35 * 2.0], + [1, "", 0.35 * 4.0], + [-1100, "", 10], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) @@ -1746,7 +1746,7 @@ async def test_parse_retry_after_header( headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = async_client._calculate_retry_timeout(remaining_retries, options, headers) - assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + assert calculated == pytest.approx(timeout, 0.35 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("spitch._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url)