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.
This commit is contained in:
yryzhan-vitech 2026-08-04 14:16:46 +02:00
parent 2e931db15b
commit c524a885e3

View file

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