mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Update asyncio.Stream.readuntil for Python 3.13 (#11755)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import ssl
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Sequence
|
||||
from typing import Any, SupportsIndex
|
||||
from _typeshed import ReadableBuffer, StrPath
|
||||
from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Sequence, Sized
|
||||
from typing import Any, Protocol, SupportsIndex
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
from . import events, protocols, transports
|
||||
@@ -23,6 +23,8 @@ else:
|
||||
|
||||
_ClientConnectedCallback: TypeAlias = Callable[[StreamReader, StreamWriter], Awaitable[None] | None]
|
||||
|
||||
class _ReaduntilBuffer(ReadableBuffer, Sized, Protocol): ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
async def open_connection(
|
||||
host: str | None = None,
|
||||
@@ -140,8 +142,11 @@ class StreamReader(AsyncIterator[bytes]):
|
||||
def at_eof(self) -> bool: ...
|
||||
def feed_data(self, data: Iterable[SupportsIndex]) -> None: ...
|
||||
async def readline(self) -> bytes: ...
|
||||
# Can be any buffer that supports len(); consider changing to a Protocol if PEP 688 is accepted
|
||||
async def readuntil(self, separator: bytes | bytearray | memoryview = b"\n") -> bytes: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
async def readuntil(self, separator: _ReaduntilBuffer | tuple[_ReaduntilBuffer, ...] = b"\n") -> bytes: ...
|
||||
else:
|
||||
async def readuntil(self, separator: _ReaduntilBuffer = b"\n") -> bytes: ...
|
||||
|
||||
async def read(self, n: int = -1) -> bytes: ...
|
||||
async def readexactly(self, n: int) -> bytes: ...
|
||||
def __aiter__(self) -> Self: ...
|
||||
|
||||
Reference in New Issue
Block a user