import asyncio
from _typeshed import Incomplete
from collections.abc import AsyncIterator
from concurrent.futures import Future
from typing import Self

class Abort(Exception): ...

class AsyncIteratorReader:
    _aborted: bool
    _exhausted: bool
    _loop: Incomplete
    _stream: Incomplete
    _buffer: bytes | None
    _next_future: Future[bytes | None] | None
    _pos: int
    def __init__(self, loop: asyncio.AbstractEventLoop, stream: AsyncIterator[bytes]) -> None: ...
    async def _next(self) -> bytes | None: ...
    def abort(self) -> None: ...
    def read(self, n: int = -1, /) -> bytes: ...
    def close(self) -> None: ...

class AsyncIteratorWriter:
    _aborted: bool
    _loop: Incomplete
    _pos: int
    _queue: asyncio.Queue[bytes | None]
    _write_future: Future[bytes | None] | None
    def __init__(self, loop: asyncio.AbstractEventLoop) -> None: ...
    def __aiter__(self) -> Self: ...
    async def __anext__(self) -> bytes: ...
    def abort(self) -> None: ...
    def tell(self) -> int: ...
    def write(self, s: bytes, /) -> int: ...
