mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
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:
parent
2e931db15b
commit
c524a885e3
1 changed files with 5 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue