Add _TemporaryFileWrapper (#4559)

This commit is contained in:
Rune Tynan
2021-01-23 10:54:31 -05:00
committed by GitHub
parent 58032a7018
commit 6870caf79c
2 changed files with 35 additions and 0 deletions

View File

@@ -164,6 +164,39 @@ else:
dir: Optional[_DirT[AnyStr]] = ...,
) -> IO[Any]: ...
class _TemporaryFileWrapper(IO[str]):
file: IO[str]
name: Any
delete: bool
def __init__(self, file: IO[str], name: Any, delete: bool = ...) -> None: ...
def __enter__(self) -> _TemporaryFileWrapper: ...
def __exit__(
self, exc: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[TracebackType]
) -> Optional[bool]: ...
def __getattr__(self, name: str) -> Any: ...
def close(self) -> None: ...
def unlink(self, path: str) -> None: ...
# These methods don't exist directly on this object, but
# are delegated to the underlying IO object through __getattr__.
# We need to add them here so that this class is concrete.
def __iter__(self) -> Iterator[str]: ...
def __next__(self) -> str: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def next(self) -> str: ...
def read(self, n: int = ...) -> str: ...
def readable(self) -> bool: ...
def readline(self, limit: int = ...) -> str: ...
def readlines(self, hint: int = ...) -> List[str]: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
def write(self, s: str) -> int: ...
def writelines(self, lines: Iterable[str]) -> None: ...
# It does not actually derive from IO[AnyStr], but it does implement the
# protocol.
class SpooledTemporaryFile(IO[AnyStr]):