(
self, scope: Scope
)
| 1699 | return None |
| 1700 | |
| 1701 | def _match( |
| 1702 | self, scope: Scope |
| 1703 | ) -> tuple[Match, Scope, BaseRoute | None, _EffectiveRouteContext | None]: |
| 1704 | partial: tuple[Scope, BaseRoute, _EffectiveRouteContext | None] | None = None |
| 1705 | for candidate in self.effective_candidates(): |
| 1706 | if isinstance(candidate, _IncludedRouter): |
| 1707 | match, child_scope = candidate.matches(scope) |
| 1708 | route: BaseRoute = candidate |
| 1709 | route_context = None |
| 1710 | elif isinstance(candidate.original_route, APIRoute): |
| 1711 | route_context = candidate |
| 1712 | fastapi_scope = _get_fastapi_scope(scope) |
| 1713 | previous_context = fastapi_scope.get( |
| 1714 | _FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY, _SCOPE_MISSING |
| 1715 | ) |
| 1716 | fastapi_scope[_FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY] = route_context |
| 1717 | try: |
| 1718 | match, child_scope = candidate.original_route.matches(scope) |
| 1719 | finally: |
| 1720 | _restore_fastapi_scope_key( |
| 1721 | scope, _FASTAPI_EFFECTIVE_ROUTE_CONTEXT_KEY, previous_context |
| 1722 | ) |
| 1723 | route = candidate.original_route |
| 1724 | else: |
| 1725 | route_context = candidate |
| 1726 | match, child_scope = candidate.matches(scope) |
| 1727 | route = candidate.starlette_route or candidate.original_route |
| 1728 | if match == Match.FULL: |
| 1729 | return match, child_scope, route, route_context |
| 1730 | if match == Match.PARTIAL and partial is None: |
| 1731 | partial = (child_scope, route, route_context) |
| 1732 | if partial is not None: |
| 1733 | child_scope, route, route_context = partial |
| 1734 | return Match.PARTIAL, child_scope, route, route_context |
| 1735 | return Match.NONE, {}, None, None |
| 1736 | |
| 1737 | def matches(self, scope: Scope) -> tuple[Match, Scope]: |
| 1738 | fastapi_scope = _get_fastapi_scope(scope) |
no test coverage detected