From 646bde17afb4732e585abe0c85564bf804edef8e Mon Sep 17 00:00:00 2001 From: abhi Date: Sat, 15 Aug 2026 11:24:57 -0700 Subject: [PATCH] style: apply ruff format to canonical resolution changes The lint job's 'Check ruff format' step (separate from the strict-rule budget step that failed earlier) flagged two files. Both diffs are confined to lines added by this PR -- the multi-line isinstance/and condition in _can_object_call_model, and the build_canonical_index call in _get_canonical_model_index -- so no unrelated formatting is swept in. Cosmetic only, no semantic change. ruff format --check: clean. ruff check: clean. basedpyright (new module): 0 errors. strict-rule budgets BLE001/PERF401: unchanged at base parity. Tests: 32 passed. Co-Authored-By: Claude --- litellm/proxy/auth/auth_checks.py | 16 ++++++++++------ litellm/router.py | 4 +--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py index 8a44a7bab33..42c73729a2b 100644 --- a/litellm/proxy/auth/auth_checks.py +++ b/litellm/proxy/auth/auth_checks.py @@ -3338,12 +3338,16 @@ def _can_object_call_model( ) # Require a real model-group name; a non-string from a router stub must # never be treated as a grant. - if isinstance(canonical_target, str) and canonical_target and _check_model_access_helper( - model=canonical_target, - llm_router=llm_router, - models=models, - team_model_aliases=team_model_aliases, - team_id=team_id, + if ( + isinstance(canonical_target, str) + and canonical_target + and _check_model_access_helper( + model=canonical_target, + llm_router=llm_router, + models=models, + team_model_aliases=team_model_aliases, + team_id=team_id, + ) ): return True diff --git a/litellm/router.py b/litellm/router.py index 94ca7854233..aee52e50f7b 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -10721,9 +10721,7 @@ class Router: cost_generation: Final = get_model_cost_mutation_generation() if self._canonical_model_index is None or self._canonical_model_index_cost_generation != cost_generation: try: - self._canonical_model_index = build_canonical_index( - cast("list[DeploymentTypedDict]", self.model_list) - ) + self._canonical_model_index = build_canonical_index(cast("list[DeploymentTypedDict]", self.model_list)) except Exception as exc: # noqa: BLE001 # index construction must never brick a router; degrade to 'strict' verbose_router_logger.error("canonical-resolution: index build failed, disabling feature: %s", exc) self._canonical_model_index = {}