From ad4488b168b0d0a4d6c16554588957fe24c076eb Mon Sep 17 00:00:00 2001 From: Aiden McComiskey Date: Fri, 25 Sep 2026 15:43:14 +0100 Subject: [PATCH] chore: drop mutable-collection constructions flagged by LIT002 gate --- litellm/llms/vllm/common_utils.py | 2 +- litellm/proxy/proxy_server.py | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/litellm/llms/vllm/common_utils.py b/litellm/llms/vllm/common_utils.py index cdfef9a42bc..576931582fb 100644 --- a/litellm/llms/vllm/common_utils.py +++ b/litellm/llms/vllm/common_utils.py @@ -89,7 +89,7 @@ class VLLMModelInfo(BaseLLMModelInfo): resolved_api_base: Final = self._get_discovery_api_base(api_base) environment_variable: Final = "HOSTED_VLLM_API_KEY" if self._provider == "hosted_vllm" else "VLLM_API_KEY" resolved_api_key: Final = api_key or get_secret_str(environment_variable) - headers: Final = {"Authorization": f"Bearer {resolved_api_key}"} if resolved_api_key else {} + headers: Final = {"Authorization": f"Bearer {resolved_api_key}"} if resolved_api_key else None response: Final = litellm.module_level_client.get( url=_add_path_to_api_base(resolved_api_base, "/v1/models"), headers=headers, diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index a4453a5f480..55c00b57720 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -9782,10 +9782,10 @@ def get_litellm_model_info(model: dict = {}): return { **live_model_info, **static_model_info, - **( - {"max_input_tokens": live_model_info["max_input_tokens"]} + "max_input_tokens": ( + live_model_info["max_input_tokens"] if live_model_info["max_input_tokens"] is not None - else {} + else static_model_info.get("max_input_tokens") ), } except Exception: @@ -15052,17 +15052,15 @@ async def model_info_v2( # Fill in model info based on config.yaml and litellm model_prices_and_context_window.json # This must happen before teamId filtering so that direct_access and access_via_team_ids are populated - all_models = list( - await asyncio.gather( - *( - asyncio.to_thread( - _enrich_model_info_with_litellm_data, - model=_model, - debug=debug if debug is not None else False, - llm_router=llm_router, - ) - for _model in all_models + all_models = await asyncio.gather( + *( + asyncio.to_thread( + _enrich_model_info_with_litellm_data, + model=_model, + debug=debug if debug is not None else False, + llm_router=llm_router, ) + for _model in all_models ) )