add contextlib.chdir (#6191)

This commit is contained in:
Thomas Grainger
2021-11-08 19:54:51 +00:00
committed by GitHub
parent e3180cd48f
commit 50dff2454a

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import Self
from _typeshed import Self, StrOrBytesPath
from types import TracebackType
from typing import (
IO,
@@ -9,6 +9,7 @@ from typing import (
Awaitable,
Callable,
ContextManager,
Generic,
Iterator,
Optional,
Type,
@@ -124,3 +125,11 @@ elif sys.version_info >= (3, 7):
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __enter__(self) -> _T: ...
def __exit__(self, *exctype: Any) -> None: ...
if sys.version_info >= (3, 11):
_T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=int | StrOrBytesPath)
class chdir(AbstractContextManager[None], Generic[_T_fd_or_any_path]):
path: _T_fd_or_any_path
def __init__(self, path: _T_fd_or_any_path) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, *excinfo: object) -> None: ...