MCPcopy
hub / github.com/python/mypy / temp_source

Function temp_source

mypy/test/test_nativeparse.py:276–281  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

274
275@contextlib.contextmanager
276def temp_source(text: str) -> Iterator[str]:
277 with tempfile.TemporaryDirectory() as temp_dir:
278 temp_path = os.path.join(temp_dir, "t.py")
279 with open(temp_path, "w") as f:
280 f.write(text)
281 yield temp_path

Callers 3

test_parserFunction · 0.85
test_parser_importsFunction · 0.85

Calls 2

joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…