MCPcopy Create free account
hub / github.com/Houseofmvps/codesight / normalize_route

Function normalize_route

plugins/ast/python/src/lib.rs:249–257  ·  view source on GitHub ↗

Normalize a URLConf pattern to a leading-slash path, stripping regex anchors.

(raw: &str)

Source from the content-addressed store, hash-verified

247
248/// Normalize a URLConf pattern to a leading-slash path, stripping regex anchors.
249fn normalize_route(raw: &str) -> String {
250 let trimmed = raw.trim_start_matches('^').trim_end_matches('$');
251
252 if trimmed.starts_with('/') {
253 trimmed.to_string()
254 } else {
255 format!("/{trimmed}")
256 }
257}
258
259fn routes_from_decorator(expression: &Expression, routes: &mut Vec<Route>) {
260 let Expression::Call(CallExpression {

Callers 1

routes_from_urlconfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected