MCPcopy Create free account
hub / github.com/WeaveMindAI/weft / sanitize_identifier

Function sanitize_identifier

catalog/code/:exec/python/backend.rs:338–351  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

336}
337
338fn sanitize_identifier(name: &str) -> String {
339 let mut out = String::new();
340 for (i, c) in name.chars().enumerate() {
341 if c.is_alphanumeric() || c == '_' {
342 if i == 0 && c.is_ascii_digit() {
343 out.push('_');
344 }
345 out.push(c);
346 } else {
347 out.push('_');
348 }
349 }
350 if out.is_empty() { "_input".into() } else { out }
351}
352
353fn indent_code(code: &str, indent: &str) -> String {
354 if code.is_empty() {

Callers 1

build_user_blockFunction · 0.85

Calls 1

is_emptyMethod · 0.80

Tested by

no test coverage detected