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 <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-07-18 23:06:46 +00:00
parent 366ec6f487
commit 227fc9f3c6
No known key found for this signature in database

View file

@ -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,
)