MCPcopy
hub / github.com/pex-tool/pex / write_pth

Function write_pth

tests/integration/test_issue_1025.py:26–33  ·  view source on GitHub ↗
(
        pth_path,  # type: str
        sitedir,  # type: str
    )

Source from the content-addressed store, hash-verified

24 cleanups = []
25
26 def write_pth(
27 pth_path, # type: str
28 sitedir, # type: str
29 ):
30 # type: (...) -> None
31 cleanups.append(lambda: safe_delete(pth_path))
32 with open(pth_path, "w") as fp:
33 fp.write("import site; site.addsitedir({!r})\n".format(sitedir))
34
35 try:
36 yield write_pth

Callers

nothing calls this directly

Calls 3

safe_deleteFunction · 0.90
appendMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected