fix(proxy): drop LIT001 mutable annotations on team-limit warnings

This commit is contained in:
lei_lei 2026-09-14 01:52:24 +00:00
parent 1ced5b45f2
commit b9a8c838b0
2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
import enum
import json
import os
from collections.abc import Callable, Mapping
from collections.abc import Callable, Mapping, Sequence
from datetime import datetime
from types import MappingProxyType
from typing import TYPE_CHECKING, Any, Final, Literal, NamedTuple
@ -1278,7 +1278,7 @@ class GenerateKeyResponse(KeyRequestBase):
updated_by: str | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
warnings: list[KeyTeamLimitWarning] | None = None
warnings: Sequence[KeyTeamLimitWarning] | None = None
@model_validator(mode="before")
@classmethod

View file

@ -1529,10 +1529,10 @@ def _collect_key_team_limit_warnings(
def _maybe_add_key_team_limit_warnings(
payload: dict[str, object],
payload: Mapping[str, object],
data: GenerateKeyRequest | UpdateKeyRequest,
team_table: LiteLLM_TeamTable | LiteLLM_TeamTableCachedObj | None,
) -> dict[str, object]:
) -> Mapping[str, object]:
"""Attach team-limit warnings to a key update payload when caps are exceeded."""
if team_table is None:
return payload
@ -3239,7 +3239,7 @@ async def update_key_fn(
if response is None:
raise ValueError("Failed to update key got response = None")
updated_key_info: Final[dict[str, object]] = {"key": key, **response["data"]}
updated_key_info: Final[Mapping[str, object]] = {"key": key, **response["data"]}
if team_limit_warnings:
return {**updated_key_info, "warnings": list(team_limit_warnings)}
return updated_key_info