From 9dc611d8c0c712d83aa28ee99096b7ff0ddae9e4 Mon Sep 17 00:00:00 2001 From: A5rocks Date: Wed, 14 Oct 2026 14:46:01 -0400 Subject: [PATCH 1/3] Update AsyncFileWrapper for consistency between what we need/what we declare --- src/trio/_file_io.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/trio/_file_io.py b/src/trio/_file_io.py index d9305ef4f..354d04838 100644 --- a/src/trio/_file_io.py +++ b/src/trio/_file_io.py @@ -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: ... @@ -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. @@ -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 @@ -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: ... From ec678e1f58f9b9c523f8d0a9735181ff6ead7248 Mon Sep 17 00:00:00 2001 From: A5rocks Date: Wed, 14 Oct 2026 15:02:26 -0400 Subject: [PATCH 2/3] Add a newsfragment --- newsfragments/3542.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/3542.misc.rst diff --git a/newsfragments/3542.misc.rst b/newsfragments/3542.misc.rst new file mode 100644 index 000000000..0ebd5e02b --- /dev/null +++ b/newsfragments/3542.misc.rst @@ -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. \ No newline at end of file From 550f9b1c3ea2392cd3fd80c80aace4780b0f86bf Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 14 Oct 2026 19:06:09 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- newsfragments/3542.misc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newsfragments/3542.misc.rst b/newsfragments/3542.misc.rst index 0ebd5e02b..27d29ea97 100644 --- a/newsfragments/3542.misc.rst +++ b/newsfragments/3542.misc.rst @@ -1 +1 @@ -The typing for :ref:`async-file-objects` is now consistent about what it exposes based on what is exposed by the underlying object. \ No newline at end of file +The typing for :ref:`async-file-objects` is now consistent about what it exposes based on what is exposed by the underlying object.