MCPcopy
hub / github.com/fastapi/fastapi / effective_low_priority_routes

Method effective_low_priority_routes

fastapi/routing.py:1604–1624  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1602 return self._effective_candidates
1603
1604 def effective_low_priority_routes(self) -> list["_EffectiveRouteContext"]:
1605 routes_version = self.original_router._get_routes_version()
1606 if routes_version == self._effective_low_priority_routes_version:
1607 return self._effective_low_priority_routes
1608 self._effective_low_priority_routes = []
1609 for route in self.original_router._low_priority_routes:
1610 route_context = self._build_effective_context(route)
1611 if route_context is not None:
1612 self._effective_low_priority_routes.append(route_context)
1613 for route in self.original_router.routes:
1614 if isinstance(route, _IncludedRouter):
1615 child_context = self.include_context.combine(route.include_context)
1616 child_branch = _IncludedRouter(
1617 original_router=route.original_router,
1618 include_context=child_context,
1619 )
1620 self._effective_low_priority_routes.extend(
1621 child_branch.effective_low_priority_routes()
1622 )
1623 self._effective_low_priority_routes_version = routes_version
1624 return self._effective_low_priority_routes
1625
1626 def _build_effective_context(
1627 self, route: BaseRoute

Calls 4

_IncludedRouterClass · 0.85
_get_routes_versionMethod · 0.80
combineMethod · 0.80