Add pathlib.Path.__enter__ and __exit__ (#2048)

This commit is contained in:
Eddie Schoute
2018-04-12 13:39:19 -04:00
committed by Jelle Zijlstra
parent 7cd2016931
commit 5327841a18

View File

@@ -1,6 +1,7 @@
# Stubs for pathlib (Python 3.4)
from typing import Any, Generator, IO, Optional, Sequence, Tuple, Type, TypeVar, Union, List
from types import TracebackType
import os
import sys
@@ -52,6 +53,10 @@ class PurePosixPath(PurePath): ...
class PureWindowsPath(PurePath): ...
class Path(PurePath):
def __enter__(self) -> Path: ...
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType]) -> Optional[bool]: ...
@classmethod
def cwd(cls: Type[_P]) -> _P: ...
def stat(self) -> os.stat_result: ...