Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

refactor(key_management): immutable types in preset transition helper for lint budgets

Yuneng Jiang4bfc6766e7b4
diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py
index b18704d4ee9..1fc2850c4ae 100644
--- a/litellm/proxy/management_endpoints/key_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py
@@ -737,8 +737,8 @@ def _check_allowed_routes_caller_permission(
def _is_safe_preset_route_transition(
- incoming_allowed_routes: list | None,
- existing_allowed_routes: list | None,
+ incoming_allowed_routes: Sequence[str] | None,
+ existing_allowed_routes: Sequence[str] | None,
) -> bool:
"""
True when every route on BOTH sides is a safe `key_type` preset bucket
@@ -748,7 +748,7 @@ def _is_safe_preset_route_transition(
"""
return all(
route in _NON_ADMIN_SAFE_ALLOWED_ROUTES_PRESETS
- for route in (*(incoming_allowed_routes or []), *(existing_allowed_routes or []))
+ for route in (*(incoming_allowed_routes or ()), *(existing_allowed_routes or ()))
)