From 735b14f59167e75a81893e2e35e3f441ef3fbd47 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Thu, 2 Jul 2026 10:57:10 +0530 Subject: [PATCH] style: ruff format after greploop fixes --- litellm/llms/anthropic/chat/guardrail_translation/handler.py | 4 +--- .../test_streaming_buffer_until_moderated.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.py index 8a45dfb84d5..469acd9c8cd 100644 --- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py +++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py @@ -132,9 +132,7 @@ class AnthropicMessagesHandler(BaseTranslation): def _sse(event_type: str, payload: dict) -> bytes: return f"event: {event_type}\ndata: {json.dumps(payload)}\n\n".encode() - output_tokens = blocked_response_usage(getattr(exc, "original_response", None))[ - "output_tokens" - ] + output_tokens = blocked_response_usage(getattr(exc, "original_response", None))["output_tokens"] open_index, max_index = self._content_block_state(responses_so_far) new_index = (max_index + 1) if max_index is not None else 0 chunks: list[bytes] = [] diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/unified_guardrails/test_streaming_buffer_until_moderated.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/unified_guardrails/test_streaming_buffer_until_moderated.py index 4a2d8efc12f..2b163ee5233 100644 --- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/unified_guardrails/test_streaming_buffer_until_moderated.py +++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/unified_guardrails/test_streaming_buffer_until_moderated.py @@ -166,9 +166,7 @@ async def test_buffered_mode_disabled_for_content_rewriting_guardrail(): the client would get the unredacted original instead of the moderated output. mask_response_content=True must force buffering off so the request falls back to the (correctly moderated) non-buffered path.""" - guardrail = _PassingGuardrail( - guardrail_name="masker", event_hook="post_call", mask_response_content=True - ) + guardrail = _PassingGuardrail(guardrail_name="masker", event_hook="post_call", mask_response_content=True) raw = await _run(guardrail) assert guardrail.streaming_buffer_until_moderated is True # request asked for buffering assert ORIGINAL_MARKER in raw