mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Fix class file so it can be used as "with file(...) as f: f.read() # etc."
This commit is contained in:
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user