MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / _derive_prefix

Function _derive_prefix

verifier/AgentVerifier/yaml_to_lean.py:32–51  ·  view source on GitHub ↗

Convert a workflow name to a valid Lean identifier prefix. Examples: "rlhf_verifiable_rewards_search_2025_2026" → "rlhfVerifiableRewardsSearch20252026" "Quick Start" → "quickStart" "" → "workflow"

(name: str)

Source from the content-addressed store, hash-verified

30
31
32def _derive_prefix(name: str) -> str:
33 """Convert a workflow name to a valid Lean identifier prefix.
34
35 Examples:
36 "rlhf_verifiable_rewards_search_2025_2026""rlhfVerifiableRewardsSearch20252026"
37 "Quick Start""quickStart"
38 """workflow"
39 """
40 if not name:
41 return "workflow"
42 clean = re.sub(r'[^0-9A-Za-z]+', ' ', name).strip()
43 if not clean:
44 return "workflow"
45 parts = clean.split()
46 head = parts[0].lower() if parts[0] else "workflow"
47 tail = "".join(p[:1].upper() + p[1:].lower() for p in parts[1:])
48 prefix = head + tail
49 if not prefix[0].isalpha() and not prefix[0] == "_":
50 prefix = "w_" + prefix
51 return prefix
52
53
54def main(argv=None) -> int:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected