MCPcopy Index your code
hub / github.com/fastapi/fastapi / url_path_for

Method url_path_for

fastapi/routing.py:1513–1526  ·  view source on GitHub ↗
(self, name: str, /, **path_params: Any)

Source from the content-addressed store, hash-verified

1511 return Match.FULL, child_scope
1512
1513 def url_path_for(self, name: str, /, **path_params: Any) -> Any:
1514 if not isinstance(self.original_route, APIRoute):
1515 assert self.starlette_route is not None
1516 return self.starlette_route.url_path_for(name, **path_params)
1517 seen_params = set(path_params.keys())
1518 param_convertors = self.param_convertors
1519 expected_params = set(param_convertors.keys())
1520 if name != self.name or seen_params != expected_params:
1521 raise routing.NoMatchFound(name, path_params)
1522 path, remaining_params = routing.replace_params(
1523 self.path_format, param_convertors, path_params
1524 )
1525 assert not remaining_params
1526 return URLPath(path=path, protocol="http")
1527
1528
1529@dataclass(frozen=True)

Callers

nothing calls this directly

Calls 1

url_path_forMethod · 0.45

Tested by

no test coverage detected