MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / template_eval

Function template_eval

tools/api.py:1272–1282  ·  view source on GitHub ↗
(template, **kwargs)

Source from the content-addressed store, hash-verified

1270
1271
1272def template_eval(template, **kwargs):
1273 start = '<%'
1274 end = '%>'
1275 escaped = (re.escape(start), re.escape(end))
1276 mark = re.compile('%s(.*?)%s' % escaped, re.DOTALL)
1277 for key in kwargs:
1278 exec('%s = %s' % (key, kwargs[key]))
1279 for item in mark.findall(template):
1280 e = eval(item.strip())
1281 template = template.replace(start + item + end, str(e))
1282 return template
1283
1284
1285def run(path: Union[Path, str]) -> str:

Callers 1

runFunction · 0.70

Calls 4

execFunction · 0.85
evalFunction · 0.50
compileMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected