MCPcopy Create free account
hub / github.com/cztomczak/cefpython / replace_template_vars

Function replace_template_vars

tools/make_installer.py:181–191  ·  view source on GitHub ↗

Replaces template variables like {{SOME}} in the string using the dictionary values.

(string, dictionary)

Source from the content-addressed store, hash-verified

179
180
181def replace_template_vars(string, dictionary):
182 """Replaces template variables like {{SOME}} in the string
183 using the dictionary values."""
184 orig_string = string
185 for key, value in dictionary.items():
186 string = string.replace("{{"+key+"}}", value)
187 if string == orig_string:
188 raise Exception("Nothing to format")
189 if re.search(r"{{[a-zA-Z0-9_]+}}", string):
190 raise Exception("Not all strings were formatted")
191 return string
192
193
194def perform_copy_operations(operations):

Callers 1

copy_template_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected