From 0502cc4a67f65f5cec5493ea16f4b81186117bfb Mon Sep 17 00:00:00 2001 From: Mubashir Osmani Date: Tue, 22 Sep 2026 20:51:24 +0000 Subject: [PATCH] style(anthropic): ruff format batches files Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/llms/anthropic/batches/handler.py | 8 ++++++-- litellm/llms/anthropic/batches/transformation.py | 4 +++- litellm/proxy/batches_endpoints/endpoints.py | 9 +++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/litellm/llms/anthropic/batches/handler.py b/litellm/llms/anthropic/batches/handler.py index acdc3bdd504..50047a1edfd 100644 --- a/litellm/llms/anthropic/batches/handler.py +++ b/litellm/llms/anthropic/batches/handler.py @@ -18,7 +18,9 @@ if TYPE_CHECKING: else: LiteLLMLoggingObj = Any -_EMPTY_PARAMS: Final[dict] = {} # mutable-ok: shared empty mapping for signatures that declare dict; every callee here only reads it +_EMPTY_PARAMS: Final[ + dict +] = {} # mutable-ok: shared empty mapping for signatures that declare dict; every callee here only reads it _EMPTY_MESSAGES: Final[list] = [] # mutable-ok: shared empty list for the messages signature; callees only read it from ..common_utils import AnthropicModelInfo @@ -207,7 +209,9 @@ class AnthropicBatchesHandler: if not resolved_api_key: raise ValueError("Missing Anthropic API Key") - resolved_logging_obj: Final = logging_obj or self._default_logging_obj(call_type="batch_list", call_id="batch_list") + resolved_logging_obj: Final = logging_obj or self._default_logging_obj( + call_type="batch_list", call_id="batch_list" + ) list_url: Final = self.provider_config.get_list_batches_url( api_base=resolved_api_base, diff --git a/litellm/llms/anthropic/batches/transformation.py b/litellm/llms/anthropic/batches/transformation.py index da6fa5b0b0d..d61af0cdd35 100644 --- a/litellm/llms/anthropic/batches/transformation.py +++ b/litellm/llms/anthropic/batches/transformation.py @@ -92,7 +92,9 @@ class AnthropicMessageBatchList(TypedDict, total=False): _ANTHROPIC_MESSAGE_BATCH_ADAPTER: Final = TypeAdapter(AnthropicMessageBatch) _ANTHROPIC_MESSAGE_BATCH_LIST_ADAPTER: Final = TypeAdapter(AnthropicMessageBatchList) _OBJECT_DICT_ADAPTER: Final = TypeAdapter(dict[str, object]) -_EMPTY_PARAMS: Final[dict] = {} # mutable-ok: shared empty mapping for signatures that declare dict; callees only read it +_EMPTY_PARAMS: Final[ + dict +] = {} # mutable-ok: shared empty mapping for signatures that declare dict; callees only read it _EMPTY_METADATA: Final[dict] = {} # mutable-ok: shared empty LiteLLMBatch metadata; callers never mutate it diff --git a/litellm/proxy/batches_endpoints/endpoints.py b/litellm/proxy/batches_endpoints/endpoints.py index 5b77cee8aa4..7b4601971c8 100644 --- a/litellm/proxy/batches_endpoints/endpoints.py +++ b/litellm/proxy/batches_endpoints/endpoints.py @@ -260,11 +260,16 @@ async def _create_anthropic_batch_for_managed_file( extra_body: Final = ( cast( # cast-ok: extra_body is declared dict[str, str] but the Anthropic requests array is a list value "dict[str, str]", - {**(create_batch_data.get("extra_body") or EMPTY_MAPPING), "requests": list(requests)}, # mutable-ok: one-shot payload build; the requests contract requires list + { + **(create_batch_data.get("extra_body") or EMPTY_MAPPING), + "requests": list(requests), + }, # mutable-ok: one-shot payload build; the requests contract requires list ) ) request: Final[LiteLLMBatchCreateRequest] = { - **{key: value for key, value in create_batch_data.items() if key != "model_file_id_mapping"}, # mutable-ok: one-shot rebuild without the managed-files key; the request contract requires dict + **{ + key: value for key, value in create_batch_data.items() if key != "model_file_id_mapping" + }, # mutable-ok: one-shot rebuild without the managed-files key; the request contract requires dict "model": model, "input_file_id": input_file_id, "disable_fallbacks": True,