From c524a885e34eaa67c9d34ae73fa05ed3ab31100e Mon Sep 17 00:00:00 2001 From: yryzhan-vitech Date: Tue, 4 Aug 2026 14:16:46 +0200 Subject: [PATCH] fix(slack-alerting): build the metadata fallback without a new mutable dict The metadata fallback seeded two empty dict literals, which pushed LIT002 over its type-discipline ceiling. Chain the fallback through a module-level frozen empty mapping instead, so the file carries the same violation count as the base. --- .../integrations/SlackAlerting/hanging_request_check.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/litellm/integrations/SlackAlerting/hanging_request_check.py b/litellm/integrations/SlackAlerting/hanging_request_check.py index 4071f78e189..60d49ba4b0c 100644 --- a/litellm/integrations/SlackAlerting/hanging_request_check.py +++ b/litellm/integrations/SlackAlerting/hanging_request_check.py @@ -9,6 +9,8 @@ Notes: import asyncio import time +from collections.abc import Mapping +from types import MappingProxyType from typing import TYPE_CHECKING, Any, Final import litellm @@ -26,6 +28,8 @@ if TYPE_CHECKING: else: SlackAlerting = Any +_NO_METADATA: Mapping[str, Any] = MappingProxyType({}) + class AlertingHangingRequestCheck: """ @@ -58,9 +62,7 @@ class AlertingHangingRequestCheck: return request_metadata: Final = ( - get_litellm_metadata_from_kwargs(kwargs=request_data) - or request_data.get("metadata", {}) - or {} + get_litellm_metadata_from_kwargs(kwargs=request_data) or request_data.get("metadata") or _NO_METADATA ) model: Final = request_data.get("model", "") api_base: str | None = None