mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
refactor(proxy): narrow user budget limits without a cast
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
9fdd22db8d
commit
9a977be141
1 changed files with 2 additions and 2 deletions
|
|
@ -1264,7 +1264,7 @@ def _process_keys_for_user_info(
|
|||
def _prepare_user_budget_limits(value: object) -> str:
|
||||
from litellm.proxy.common_utils.timezone_utils import get_budget_reset_time
|
||||
|
||||
if not value:
|
||||
if not isinstance(value, list) or not value:
|
||||
return json.dumps(None)
|
||||
initialized_windows: Final = tuple(
|
||||
{ # mutable-ok: prisma stores a dict row per budget window
|
||||
|
|
@ -1273,7 +1273,7 @@ def _prepare_user_budget_limits(value: object) -> str:
|
|||
}
|
||||
for w in (
|
||||
window if isinstance(window, dict) else window.model_dump() # pyright: ignore[reportAttributeAccessIssue] # BudgetLimitEntry or its JSON dict
|
||||
for window in cast(Sequence[object], value)
|
||||
for window in value
|
||||
)
|
||||
)
|
||||
return json.dumps(initialized_windows)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue