Fix class file so it can be used as "with file(...) as f: f.read() # etc."

This commit is contained in:
Guido van Rossum
2016-01-25 17:01:34 -08:00
parent 958a8e5f45
commit a1fe083133

View File

@@ -824,5 +824,29 @@ def cmp(x: Any, y: Any) -> int: ...
def execfile(filename: str, globals: Dict[str, Any] = None, locals: Dict[str, Any] = None) -> None: ...
class file(BinaryIO): ...
class file(BinaryIO):
@overload
def __init__(self, file: str, mode: str = 'r', buffering: int = ...) -> None: ...
@overload
def __init__(self, file: unicode, mode: str = 'r', buffering: int = ...) -> None: ...
@overload
def __init__(file: int, mode: str = 'r', buffering: int = ...) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def read(self, n: int = ...) -> str: ...
def __enter__(self) -> BinaryIO: ...
def __exit__(self, typ, exc, tb) -> bool: ...
def flush(self) -> None: ...
def fileno(self) -> int: ...
def isatty(self) -> bool: ...
def close(self) -> None: ...
def readable(self) -> bool: ...
def writable(self) -> bool: ...
def seekable(self) -> bool: ...
def seek(self, offset: int, whence: int = ...) -> None: ...
def tell(self) -> int: ...
def readline(self, limit: int = ...) -> str: ...
def readlines(self, hint: int = ...) -> List[str]: ...
def write(self, data: str) -> None: ...
def writelines(self, data: Iterable[str]) -> None: ...
def truncate(self, pos: int = ...) -> int: ...