From 227fc9f3c64f819ce2566e7e20d5e4737c112836 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 18 Jul 2026 23:06:46 +0000 Subject: [PATCH] fix(lint): swap Optional[str] for str | None in main.py casts Reduces UP045 count in litellm/main.py from 2 to 0 in the recently-added Anthropic prompt-caching seeding paths, bringing internal_staging back under the ruff-strict budget so the promotion PR to main can pass CI. Co-authored-by: Krrish Dholakia --- litellm/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/main.py b/litellm/main.py index 3584297b35f..6b7dd9029b4 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -520,7 +520,7 @@ async def acompletion( non_default_params=kwargs, messages=cast(list[AllMessageValues], messages), # cast-ok: acompletion types messages as a bare List model=model, - custom_llm_provider=cast(Optional[str], custom_llm_provider), # cast-ok: read from untyped kwargs + custom_llm_provider=cast(str | None, custom_llm_provider), # cast-ok: read from untyped kwargs tools=tools, ) @@ -5078,7 +5078,7 @@ def completion( # type: ignore non_default_params=non_default_params, messages=cast(list[AllMessageValues], messages), # cast-ok: completion types messages as a bare List model=model, - custom_llm_provider=cast(Optional[str], kwargs.get("custom_llm_provider")), # cast-ok: untyped kwargs + custom_llm_provider=cast(str | None, kwargs.get("custom_llm_provider")), # cast-ok: untyped kwargs tools=tools, )