MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / create_file

Function create_file

test/common.py:210–220  ·  view source on GitHub ↗
(name, contents, binary=False, absolute=False)

Source from the content-addressed store, hash-verified

208
209
210def create_file(name, contents, binary=False, absolute=False):
211 name = Path(name)
212 assert absolute or not name.is_absolute(), name
213 if binary:
214 name.write_bytes(contents)
215 else:
216 # Dedent the contents of text files so that the files on disc all
217 # start in column 1, even if they are indented when embedded in the
218 # python test code.
219 contents = textwrap.dedent(contents)
220 name.write_text(contents, encoding='utf-8')
221
222
223@contextlib.contextmanager

Calls

no outgoing calls