hpcflow.sdk.core.utils.substitute_string_vars#

hpcflow.sdk.core.utils.substitute_string_vars(string, variables=None)#

Scan string and substitute sequences like <<var:ABC>> with the value looked up in the supplied dictionary (with ABC as the key).

Default values for the substitution can be supplied like: <<var:ABC[default=XYZ]>>

Examples

>>> substitute_string_vars("abc <<var:def>> ghi", {"def": "123"})
"abc 123 def"
Parameters:

variables (Dict[str, str]) –