MCPcopy Index your code
hub / github.com/python/cpython / script

Method script

Lib/test/test_launcher.py:277–286  ·  view source on GitHub ↗
(self, content, encoding="utf-8")

Source from the content-addressed store, hash-verified

275
276 @contextlib.contextmanager
277 def script(self, content, encoding="utf-8"):
278 file = Path(tempfile.mktemp(dir=os.getcwd()) + ".py")
279 if isinstance(content, bytes):
280 file.write_bytes(content)
281 else:
282 file.write_text(content, encoding=encoding)
283 try:
284 yield file
285 finally:
286 file.unlink()
287
288 @contextlib.contextmanager
289 def fake_venv(self):

Callers 15

test_py_shebangMethod · 0.45
test_python_shebangMethod · 0.45
test_py2_shebangMethod · 0.45
test_py3_shebangMethod · 0.45
test_py_shebang_nlMethod · 0.45
test_py2_shebang_nlMethod · 0.45
test_py3_shebang_nlMethod · 0.45
test_search_pathMethod · 0.45
test_search_path_exeMethod · 0.45

Calls 5

write_bytesMethod · 0.95
write_textMethod · 0.95
unlinkMethod · 0.95
PathClass · 0.90
mktempMethod · 0.80

Tested by

no test coverage detected