Skip to content

Commit 6d4d92b

Browse files
authored
add contextlib.chdir
1 parent b3f29b6 commit 6d4d92b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

stdlib/contextlib.pyi

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from _typeshed import Self
2+
from _typeshed import Self, StrOrBytesPath
33
from types import TracebackType
44
from typing import (
55
IO,
@@ -124,3 +124,15 @@ elif sys.version_info >= (3, 7):
124124
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
125125
def __enter__(self) -> _T: ...
126126
def __exit__(self, *exctype: Any) -> None: ...
127+
128+
129+
if sys.version_info >= (3, 11):
130+
_FdOrAnyPath = int | StrOrBytesPath
131+
_T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=_FdOrAnyPath)
132+
133+
class chdir(AbstractContextManager[_T_fd_or_any_path]):
134+
path: _T_fd_or_any_path
135+
_old_cwd: list[str]
136+
def __init__(self, path: _FdOrAnyPath) -> None: ...
137+
def __enter__(self) -> None: ...
138+
def __exit__(self, *excinfo: Any) -> None: ...

0 commit comments

Comments
 (0)