MCPcopy Index your code
hub / github.com/RustPython/RustPython / script

Method script

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

Source from the content-addressed store, hash-verified

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

Callers 15

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

Calls 6

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

Tested by

no test coverage detected