MCPcopy Create free account
hub / github.com/encode/starlette / url_path_for

Method url_path_for

starlette/routing.py:262–271  ·  view source on GitHub ↗
(self, name: str, /, **path_params: Any)

Source from the content-addressed store, hash-verified

260 return Match.NONE, {}
261
262 def url_path_for(self, name: str, /, **path_params: Any) -> URLPath:
263 seen_params = set(path_params.keys())
264 expected_params = set(self.param_convertors.keys())
265
266 if name != self.name or seen_params != expected_params:
267 raise NoMatchFound(name, path_params)
268
269 path, remaining_params = replace_params(self.path_format, self.param_convertors, path_params)
270 assert not remaining_params
271 return URLPath(path=path, protocol="http")
272
273 async def handle(self, scope: Scope, receive: Receive, send: Send) -> None:
274 if self.methods and scope["method"] not in self.methods:

Callers

nothing calls this directly

Calls 4

URLPathClass · 0.90
NoMatchFoundClass · 0.85
replace_paramsFunction · 0.85
keysMethod · 0.45

Tested by

no test coverage detected