MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / _substitute

Function _substitute

src/ifcedit/ifcedit/foreach.py:26–30  ·  view source on GitHub ↗

Replace {key} placeholders in template with values from item.

(template: str, item: dict)

Source from the content-addressed store, hash-verified

24
25
26def _substitute(template: str, item: dict) -> str:
27 """Replace {key} placeholders in template with values from item."""
28 for key, value in item.items():
29 template = template.replace(f"{{{key}}}", str(value))
30 return template
31
32
33def run_foreach(

Callers 5

test_single_fieldMethod · 0.90
test_multiple_fieldsMethod · 0.90
test_no_placeholderMethod · 0.90
run_foreachFunction · 0.85

Calls 1

itemsMethod · 0.45

Tested by 4

test_single_fieldMethod · 0.72
test_multiple_fieldsMethod · 0.72
test_no_placeholderMethod · 0.72