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

Class TempFileObject

tools/tempfiles.py:39–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37 The file will be deleted immediately once the 'with' block is exited.
38 """
39 class TempFileObject:
40 def __enter__(self_): # noqa: DC02
41 self_.file = tempfile.NamedTemporaryFile(dir=self.tmpdir, suffix=suffix, delete=False)
42 self_.file.close() # NamedTemporaryFile passes out open file handles, but callers prefer filenames (and open their own handles manually if needed)
43 return self_.file.name
44
45 def __exit__(self_, _type, _value, _traceback): # noqa: DC02
46 if not self.save_debug_files:
47 utils.delete_file(self_.file.name)
48 return TempFileObject()
49
50 def get_dir(self):

Callers 1

get_fileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected