From bdd4f265551a762f444a6f25c6579c670d543e01 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 11:27:21 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Auto=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi/routing.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index 7b65fef73..fab6ec3cb 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -2551,7 +2551,9 @@ class APIRouter(routing.Router): resolved_scope["path_params"] = dict(resolved_scope["path_params"]) scope.update(resolved_scope) if effective_context is not None: - _get_fastapi_scope(scope)[_FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY] = effective_context + _get_fastapi_scope(scope)[_FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY] = ( + effective_context + ) scope["route"] = effective_context.original_route else: scope["route"] = leaf_route @@ -2575,11 +2577,18 @@ class APIRouter(routing.Router): is_static = not leaf_route.param_convertors if is_static: - self._route_cache[cache_key] = (Match.FULL, leaf_route, child_scope, effective_context) + self._route_cache[cache_key] = ( + Match.FULL, + leaf_route, + child_scope, + effective_context, + ) scope.update(child_scope) if effective_context is not None: - _get_fastapi_scope(scope)[_FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY] = effective_context + _get_fastapi_scope(scope)[_FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY] = ( + effective_context + ) scope["route"] = effective_context.original_route else: scope["route"] = leaf_route @@ -2598,11 +2607,18 @@ class APIRouter(routing.Router): is_static = not leaf_route.param_convertors if is_static: - self._route_cache[cache_key] = (Match.PARTIAL, leaf_route, child_scope, effective_context) + self._route_cache[cache_key] = ( + Match.PARTIAL, + leaf_route, + child_scope, + effective_context, + ) scope.update(child_scope) if effective_context is not None: - _get_fastapi_scope(scope)[_FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY] = effective_context + _get_fastapi_scope(scope)[_FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY] = ( + effective_context + ) scope["route"] = effective_context.original_route else: scope["route"] = leaf_route