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

Method _expand_template

verifier/AgentVerifier/yaml_parser.py:252–266  ·  view source on GitHub ↗

Expand template variables

(self, text: str)

Source from the content-addressed store, hash-verified

250 return parsed_steps
251
252 def _expand_template(self, text: str) -> str:
253 """Expand template variables"""
254 if not isinstance(text, str):
255 return str(text)
256
257 # Replace {{variable}} format variables
258 def replace_template_var(match):
259 var_name = match.group(1)
260 value = self.context.get(var_name, f"{{{{{var_name}}}}}")
261 return str(value) # Ensure a string is returned
262
263 # Replace template variables
264 text = re.sub(r"\{\{([^}]+)\}\}", replace_template_var, text)
265
266 return text
267
268 def validate_yaml_syntax(self, file_path: str) -> tuple[bool, str]:
269 """Validate YAML syntax"""

Callers 2

_parse_basic_stepMethod · 0.95
_parse_task_stepMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected