from queue import Queue
from typing import Any

from typing_extensions import Self

__all__ = ["Client", "Listener", "Pipe"]

class Connection:
    def __init__(self, _in: Queue[Any], _out: Queue[Any]) -> None: ...
    def poll(self, timeout: float = ...) -> bool: ...
    def close(self) -> None: ...

class Listener:
    def __init__(
        self,
        address: Any = ...,
        family: str | None = ...,
        backlog: int = ...,
    ) -> None: ...
    def accept(self) -> Connection: ...
    def close(self) -> None: ...
    def __enter__(self) -> Self: ...
    def __exit__(self, *exc_info: object) -> None: ...
    @property
    def address(self) -> Any: ...

def Client(address: Any) -> Connection: ...
def Pipe(duplex: bool = ...) -> tuple[Connection, Connection]: ...
