Browse Source

🎨 Auto format

pull/15963/head
pre-commit-ci-lite[bot] 2 weeks ago
committed by GitHub
parent
commit
bdd4f26555
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 26
      fastapi/routing.py

26
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

Loading…
Cancel
Save