From 13377dfc48a51d4b804f9828aa9f7ef0e9d1c6bc Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 25 Sep 2026 01:31:40 +0000 Subject: [PATCH] style: apply ruff format to the anthropic stream changes Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../adapters/streaming_iterator.py | 4 +++- litellm/router.py | 12 +++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py index d6c73bad36a..9e17268e8c5 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py @@ -1206,7 +1206,9 @@ class AnthropicSSEStream(AsyncIterator[bytes]): def __init__(self, anthropic_wrapper: AnthropicStreamWrapper) -> None: self._anthropic_wrapper = anthropic_wrapper self._byte_stream: Final[AsyncIterator[bytes]] = anthropic_wrapper.async_anthropic_sse_wrapper() - self._hidden_params: dict[str, object] = {} # mutable-ok: the proxy merges provider headers onto _hidden_params in place + self._hidden_params: dict[ + str, object + ] = {} # mutable-ok: the proxy merges provider headers onto _hidden_params in place @property def chunks(self) -> list | None: diff --git a/litellm/router.py b/litellm/router.py index 74573b54a06..021ff768b53 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -637,15 +637,21 @@ class FallbackAwareAnthropicMessagesStream: @property def chunks(self) -> list | None: - return cast("list | None", getattr(self._source_iterator, "chunks", None)) # cast-ok: the billing helper itself treats chunks as an opaque getattr + return cast( + "list | None", getattr(self._source_iterator, "chunks", None) + ) # cast-ok: the billing helper itself treats chunks as an opaque getattr @property def messages(self) -> list | None: - return cast("list | None", getattr(self._source_iterator, "messages", None)) # cast-ok: messages is a plain list on the inner stream + return cast( + "list | None", getattr(self._source_iterator, "messages", None) + ) # cast-ok: messages is a plain list on the inner stream @property def model(self) -> str | None: - return cast("str | None", getattr(self._source_iterator, "model", None)) # cast-ok: model is a str on the inner stream + return cast( + "str | None", getattr(self._source_iterator, "model", None) + ) # cast-ok: model is a str on the inner stream def adopt_fallback_source(self, fallback_response: object) -> None: self._source_iterator = fallback_response