mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(anthropic): stop annotating loop-assigned locals as Final
The recursion-to-loop rewrite carried its Final annotations onto locals that are now assigned once per iteration, which basedpyright reports as an error: a Final cannot be assigned within a loop. Each is a genuine per-iteration rebind, so they carry rebind-ok with the reason instead
This commit is contained in:
parent
e71d5cf8fe
commit
8655283659
2 changed files with 2 additions and 2 deletions
|
|
@ -189,7 +189,7 @@ def _fetch_anthropic_model_ids(
|
|||
collected: tuple[str, ...] = () # rebind-ok: accumulates one page of ids per iteration
|
||||
cursor: str | None = after_id # rebind-ok: advances to each page's last_id
|
||||
for _ in range(max(pages_left, 0)):
|
||||
page: Final = _fetch_anthropic_models_page(api_base, headers, cursor)
|
||||
page = _fetch_anthropic_models_page(api_base, headers, cursor) # rebind-ok: one page per iteration
|
||||
collected += tuple(entry.id for entry in page.data)
|
||||
if not page.has_more or page.last_id is None:
|
||||
return collected
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ def _strip_path_suffixes(path: str) -> str:
|
|||
token URL. Each pass removes at most one suffix, so the loop is bounded by the segment count."""
|
||||
trimmed = path.rstrip("/") # rebind-ok: fixed-point strip, one suffix per pass
|
||||
while True:
|
||||
shortened: Final = next(
|
||||
shortened = next( # rebind-ok: one suffix removed per iteration
|
||||
(trimmed.removesuffix(suffix) for suffix in _CHAT_BASE_SUFFIXES if trimmed.endswith(suffix)),
|
||||
trimmed,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue