From 9257fff1cf5de05b36e5dfbf6d02443bb21dbe87 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Tue, 23 Jun 2026 21:28:46 -0700 Subject: [PATCH] chore(lint): satisfy stable/1.86.x's stricter formatters on backported code stable/1.86.x enforces PLR0915 in the main ruff config; internal staging moved it to a separate strict gate, so two functions that ship cleanly on staging trip it here: _build_usage_only_response_from_chunks (#31035) and the post-call cost callback (#30788). Exempt both files via the existing per-file-ignores convention rather than editing the picked source. Also black-normalize blank lines around the reconstructed TestInterruptedStream class in the #30787 test file. --- ruff.toml | 2 ++ .../test_anthropic_passthrough_logging_handler.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ruff.toml b/ruff.toml index 6c854b7ad03..54261fb189e 100644 --- a/ruff.toml +++ b/ruff.toml @@ -19,3 +19,5 @@ exclude = ["litellm/types/*", "litellm/__init__.py", "litellm/proxy/example_conf "litellm/responses/streaming_iterator.py" = ["PLR0915"] "litellm/files/main.py" = ["PLR0915"] "litellm/llms/litellm_proxy/skills/sandbox_executor.py" = ["PLR0915"] +"litellm/proxy/hooks/proxy_track_cost_callback.py" = ["PLR0915"] +"litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py" = ["PLR0915"] diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_anthropic_passthrough_logging_handler.py b/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_anthropic_passthrough_logging_handler.py index c2673ddce23..c7c46952c71 100644 --- a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_anthropic_passthrough_logging_handler.py +++ b/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_anthropic_passthrough_logging_handler.py @@ -752,6 +752,8 @@ class TestBuildCompleteStreamingResponseRobustness: result = self._build(chunks) assert result is not None assert result.choices[0].message.content == "The stream ends with [DONE]" + + class TestInterruptedStreamOutputTokenRecovery: """ When an Anthropic pass-through stream is interrupted (client disconnect) @@ -893,7 +895,6 @@ class TestInterruptedStreamOutputTokenRecovery: assert usage.completion_tokens == final - class TestStreamFalseDeduplication: """ Regression tests for the duplicate-callback bug where a streaming pass-through