io: various fixes (#4525)

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-09-10 23:30:03 -07:00
committed by GitHub
parent 1bc7689cbc
commit 861d6425b4

View File

@@ -73,6 +73,8 @@ class FileIO(RawIOBase, BinaryIO):
closefd: bool = ...,
opener: Optional[Callable[[Union[int, str], str], int]] = ...,
) -> None: ...
@property
def closefd(self) -> bool: ...
def write(self, __b: ReadableBuffer) -> int: ...
def read(self, __size: int = ...) -> bytes: ...
def __enter__(self: _T) -> _T: ...
@@ -116,6 +118,7 @@ class BufferedRandom(BufferedReader, BufferedWriter):
class BufferedRWPair(BufferedIOBase):
def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = ...) -> None: ...
def peek(self, __size: int = ...) -> bytes: ...
class TextIOBase(IOBase):
encoding: str
@@ -132,7 +135,6 @@ class TextIOBase(IOBase):
def tell(self) -> int: ...
class TextIOWrapper(TextIOBase, TextIO):
line_buffering: bool
def __init__(
self,
buffer: IO[bytes],
@@ -144,7 +146,13 @@ class TextIOWrapper(TextIOBase, TextIO):
) -> None: ...
@property
def buffer(self) -> BinaryIO: ...
@property
def closed(self) -> bool: ...
@property
def line_buffering(self) -> bool: ...
if sys.version_info >= (3, 7):
@property
def write_through(self) -> bool: ...
def reconfigure(
self,
*,
@@ -154,7 +162,6 @@ class TextIOWrapper(TextIOBase, TextIO):
line_buffering: Optional[bool] = ...,
write_through: Optional[bool] = ...,
) -> None: ...
closed: bool
# These are inherited from TextIOBase, but must exist in the stub to satisfy mypy.
def __enter__(self: _T) -> _T: ...
def __iter__(self) -> Iterator[str]: ... # type: ignore
@@ -175,3 +182,5 @@ class StringIO(TextIOWrapper):
class IncrementalNewlineDecoder(codecs.IncrementalDecoder):
def __init__(self, decoder: Optional[codecs.IncrementalDecoder], translate: bool, errors: str = ...) -> None: ...
def decode(self, input: Union[bytes, str], final: bool = ...) -> str: ...
@property
def newlines(self) -> Optional[Union[str, Tuple[str, ...]]]: ...