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

Function chdir

mypy/test/test_config_parser.py:15–22  ·  view source on GitHub ↗
(target: Path)

Source from the content-addressed store, hash-verified

13
14@contextlib.contextmanager
15def chdir(target: Path) -> Iterator[None]:
16 # Replace with contextlib.chdir in Python 3.11
17 dir = os.getcwd()
18 os.chdir(target)
19 try:
20 yield
21 finally:
22 os.chdir(dir)
23
24
25def write_config(path: Path, content: str | None = None) -> None:

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…