From eb6af498f7d11db13b98dd299de5369f1bf413a9 Mon Sep 17 00:00:00 2001 From: thementalcoding <312162298+thementalcoding@users.noreply.github.com> Date: Tue, 29 Sep 2026 15:14:33 +0200 Subject: [PATCH] fix(proxy): avoid reassigning a Final variable in the db where builder basedpyright's reportGeneralTypeIssues budget counts the reassignment of the Final-annotated db_where_condition; express it as a single conditional expression instead. --- litellm/proxy/proxy_server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 7bbdb64e861..6a1c16b197e 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -14498,10 +14498,11 @@ async def _fetch_db_models_for_search( match_conditions.append({"model_id": {"not": {"in": list(db_model_ids_in_router)}}}) # Keep the single-condition shape flat: it is what existing callers (and # tests) assert, and Prisma treats both forms identically. - if len(match_conditions) == 1: - db_where_condition: Final[dict[str, Any]] = match_conditions[0] - else: - db_where_condition = {"AND": match_conditions} + # Keep the single-condition shape flat: it is what existing callers (and + # tests) assert, and Prisma treats both forms identically. + db_where_condition: Final[dict[str, Any]] = ( + match_conditions[0] if len(match_conditions) == 1 else {"AND": match_conditions} + ) # Unsorted searches only need enough DB rows to fill the current # page after counting router-side matches. Sorted searches need