style(proxy): keep cast-ok reasons on the cast line

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
mateo 2026-09-21 23:37:48 +00:00
parent 9d201a74eb
commit d08c7217f5
2 changed files with 16 additions and 12 deletions

View file

@ -138,9 +138,9 @@ async def create_fallback(
# Get existing fallbacks
existing_fallbacks: Final[list[dict[str, list[str]]]] = (
list( # mutable-ok: copy so edits stay off the frozen config
cast(
cast( # cast-ok: entries are model -> fallback models maps
"list[dict[str, list[str]]]", router_settings.get(fallback_key)
) # cast-ok: entries are model -> fallback models maps
)
)
)
@ -315,9 +315,9 @@ async def delete_fallback(
# Get existing fallbacks
existing_fallbacks: Final[list[dict[str, list[str]]]] = (
list( # mutable-ok: copy so edits stay off the frozen config
cast(
cast( # cast-ok: entries are model -> fallback models maps
"list[dict[str, list[str]]]", router_settings.get(fallback_key)
) # cast-ok: entries are model -> fallback models maps
)
)
)

View file

@ -6640,9 +6640,12 @@ class ProxyConfig:
)
global_agent_registry.load_agents_from_config(
cast(
"list[AgentConfig]", [dict(agent) for agent in agent_config]
) # mutable-ok: dict copies; cast-ok: entries are AgentConfig-shaped YAML mappings
cast( # cast-ok: entries are AgentConfig-shaped YAML mappings
"list[AgentConfig]",
[
dict(agent) for agent in agent_config
], # mutable-ok: dict copies so registry mutation cannot reach the frozen config
)
)
mcp_servers_config: Final = config.mcp_servers
@ -6656,12 +6659,13 @@ class ProxyConfig:
mcp_aliases: Final = litellm_settings.get("mcp_aliases", None)
await global_mcp_server_manager.load_servers_from_config(
cast(
"dict[str, MCPServerConfig]", dict(mcp_servers_config)
), # mutable-ok: dict copy for a dict-typed callee; cast-ok: values are raw YAML mappings the manager reads via .get
cast("dict[str, str]", mcp_aliases)
cast( # cast-ok: values are raw YAML mappings the manager reads via .get
"dict[str, MCPServerConfig]",
dict(mcp_servers_config), # mutable-ok: dict copy for a dict-typed callee
),
cast("dict[str, str]", mcp_aliases) # cast-ok: YAML-provided alias map
if isinstance(mcp_aliases, dict)
else None, # cast-ok: YAML-provided alias map
else None,
)
## VECTOR STORES