fix: drop Final from loop locals to stay within the basedpyright budget

This commit is contained in:
Thijmen Stavenuiter 2026-08-15 21:26:55 +02:00
parent 34bc22fffd
commit db67bafd59
2 changed files with 6 additions and 3 deletions

View file

@ -3555,7 +3555,7 @@ async def _attach_budget_limits_usage(key_info: dict, api_key_hash: str) -> None
return
for idx, window in enumerate(budget_limits):
w: Final = _budget_window_to_dict(window)
w = _budget_window_to_dict(window)
if not w:
continue
budget_limits[idx] = w
@ -3567,8 +3567,8 @@ async def _attach_budget_limits_usage(key_info: dict, api_key_hash: str) -> None
max_budget = float(max_budget) if max_budget is not None else None
except (TypeError, ValueError):
max_budget = None
counter_key: Final = f"spend:key:{api_key_hash}:window:{duration}"
spend: Final = await get_current_spend(
counter_key = f"spend:key:{api_key_hash}:window:{duration}"
spend = await get_current_spend(
counter_key=counter_key,
fallback_spend=0.0,
max_budget=max_budget,

View file

@ -7020,6 +7020,9 @@ export interface paths {
* - model_max_budget: dict - Per-model budgets, e.g. {"gpt-4": {"budget_limit": 0.0005, "time_period": "30d"}}
* - model_max_budget_usage: dict | None - Current-window spend per model, present only when
* the key has per-model budgets
* - budget_limits: list | None - Concurrent budget windows. Each entry includes
* current_spend: spend accumulated in the window so far (read from the same cross-pod
* spend counter the budget enforcement uses)
* - models: list - Model_name's the key is allowed to call
* - tpm_limit / rpm_limit: int | None - Tokens and requests per minute limits
* - metadata: dict - Metadata for the key, e.g. {"team": "core-infra"}