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 <noreply@anthropic.com>
This commit is contained in:
abhi 2026-08-15 11:24:57 -07:00
parent 84e2d4e23c
commit 646bde17af
2 changed files with 11 additions and 9 deletions

View file

@ -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

View file

@ -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 = {}