Module

contracts.routes

Route helpers for contracts checker.

Functions

attr_to_method 2 str
Map a URL-bearing template attribute name to HTTP method.
def attr_to_method(attr: str, method_override: str | None = None) -> str
Parameters
Name Type Description
attr str
method_override str | None Default:None
Returns
str
collect_route_paths 1 dict[str, frozenset[str]]
Map route path to allowed methods.
def collect_route_paths(router: Router) -> dict[str, frozenset[str]]
Parameters
Name Type Description
router Router
Returns
dict[str, frozenset[str]]
path_matches_route 2 bool
Check if URL could match a route pattern.
def path_matches_route(url: str, route_path: str) -> bool
Parameters
Name Type Description
url str
route_path str
Returns
bool