mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
[alt] typing: accept buffers in IO.write (#9861)
Co-authored-by: JelleZijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
@@ -90,7 +90,7 @@ class BufferedIOBase(IOBase):
|
||||
def read(self, __size: int | None = ...) -> bytes: ...
|
||||
def read1(self, __size: int = ...) -> bytes: ...
|
||||
|
||||
class FileIO(RawIOBase, BinaryIO):
|
||||
class FileIO(RawIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of writelines in the base classes
|
||||
mode: str
|
||||
name: FileDescriptorOrPath # type: ignore[assignment]
|
||||
def __init__(
|
||||
@@ -102,7 +102,7 @@ class FileIO(RawIOBase, BinaryIO):
|
||||
def read(self, __size: int = -1) -> bytes: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
|
||||
class BytesIO(BufferedIOBase, BinaryIO):
|
||||
class BytesIO(BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of methods in the base classes
|
||||
def __init__(self, initial_bytes: ReadableBuffer = ...) -> None: ...
|
||||
# BytesIO does not contain a "name" field. This workaround is necessary
|
||||
# to allow BytesIO sub-classes to add this field, as it is defined
|
||||
@@ -113,17 +113,17 @@ class BytesIO(BufferedIOBase, BinaryIO):
|
||||
def getbuffer(self) -> memoryview: ...
|
||||
def read1(self, __size: int | None = -1) -> bytes: ...
|
||||
|
||||
class BufferedReader(BufferedIOBase, BinaryIO):
|
||||
class BufferedReader(BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of methods in the base classes
|
||||
def __enter__(self) -> Self: ...
|
||||
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
|
||||
def peek(self, __size: int = 0) -> bytes: ...
|
||||
|
||||
class BufferedWriter(BufferedIOBase, BinaryIO):
|
||||
class BufferedWriter(BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of writelines in the base classes
|
||||
def __enter__(self) -> Self: ...
|
||||
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
|
||||
def write(self, __buffer: ReadableBuffer) -> int: ...
|
||||
|
||||
class BufferedRandom(BufferedReader, BufferedWriter):
|
||||
class BufferedRandom(BufferedReader, BufferedWriter): # type: ignore[misc] # incompatible definitions of methods in the base classes
|
||||
def __enter__(self) -> Self: ...
|
||||
def seek(self, __target: int, __whence: int = 0) -> int: ... # stubtest needs this
|
||||
|
||||
@@ -144,7 +144,7 @@ class TextIOBase(IOBase):
|
||||
def readlines(self, __hint: int = -1) -> list[str]: ... # type: ignore[override]
|
||||
def read(self, __size: int | None = ...) -> str: ...
|
||||
|
||||
class TextIOWrapper(TextIOBase, TextIO):
|
||||
class TextIOWrapper(TextIOBase, TextIO): # type: ignore[misc] # incompatible definitions of write in the base classes
|
||||
def __init__(
|
||||
self,
|
||||
buffer: IO[bytes],
|
||||
|
||||
Reference in New Issue
Block a user