Changes working directory and returns to previous on exit.
(path: Path)
| 39 | |
| 40 | @contextmanager |
| 41 | def as_cwd(path: Path): |
| 42 | """Changes working directory and returns to previous on exit.""" |
| 43 | prev_cwd = Path.cwd() |
| 44 | os.chdir(path) |
| 45 | try: |
| 46 | yield |
| 47 | finally: |
| 48 | os.chdir(prev_cwd) |
| 49 | |
| 50 | |
| 51 | def get_asyncio_default_loop_per_os() -> type[asyncio.AbstractEventLoop]: |
no outgoing calls