Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/3542.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The typing for :ref:`async-file-objects` is now consistent about what it exposes based on what is exposed by the underlying object.
8 changes: 4 additions & 4 deletions src/trio/_file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class _CanReadLines(Protocol[AnyStr]):
def readlines(self, hint: int = ..., /) -> list[AnyStr]: ...

class _CanSeek(Protocol):
def seek(self, target: int, whence: int = 0, /) -> int: ...
def seek(self, target: int, whence: int = ..., /) -> int: ...

class _CanTell(Protocol):
def tell(self) -> int: ...
Expand All @@ -204,7 +204,7 @@ class _CanWriteLines(Protocol[T_contra]):
def writelines(self, lines: Iterable[T_contra], /) -> None: ...

class _CanPeek(Protocol[AnyStr_co]):
def peek(self, size: int = 0, /) -> AnyStr_co: ...
def peek(self, size: int = ..., /) -> AnyStr_co: ...

class _CanDetach(Protocol[T_co]):
# The T typevar will be the unbuffered/binary file this file wraps.
Expand Down Expand Up @@ -313,7 +313,7 @@ def buffer(self: AsyncIOWrapper[_HasBuffer]) -> BinaryIO: ...
@property
def raw(self: AsyncIOWrapper[_HasRaw]) -> io.RawIOBase: ...
@property
def line_buffering(self: AsyncIOWrapper[_HasLineBuffering]) -> int: ...
def line_buffering(self: AsyncIOWrapper[_HasLineBuffering]) -> bool: ...
@property
def closefd(self: AsyncIOWrapper[_HasCloseFD]) -> bool: ...
@property
Expand All @@ -334,7 +334,7 @@ async def read1(self: AsyncIOWrapper[_CanRead1], size: int | None = -1, /) -> by
async def readall(self: AsyncIOWrapper[_CanReadAll[AnyStr]]) -> AnyStr: ...
async def readinto(self: AsyncIOWrapper[_CanReadInto], buf: Buffer, /) -> int | None: ...
async def readline(self: AsyncIOWrapper[_CanReadLine[AnyStr]], size: int = -1, /) -> AnyStr: ...
async def readlines(self: AsyncIOWrapper[_CanReadLines[AnyStr]]) -> list[AnyStr]: ...
async def readlines(self: AsyncIOWrapper[_CanReadLines[AnyStr]], hint: int = -1, /) -> list[AnyStr]: ...
async def seek(self: AsyncIOWrapper[_CanSeek], target: int, whence: int = 0, /) -> int: ...
async def tell(self: AsyncIOWrapper[_CanTell]) -> int: ...
async def truncate(self: AsyncIOWrapper[_CanTruncate], size: int | None = None, /) -> int: ...
Expand Down
Loading