import socket

from gunicorn.http import Request
from gunicorn.workers.base import Worker

from .._types import _AddressType

class StopWaiting(Exception): ...

class SyncWorker(Worker):
    def accept(self, listener: socket.socket) -> None: ...
    def wait(self, timeout: int) -> list[socket.socket | int] | None: ...
    def is_parent_alive(self) -> bool: ...
    def run_for_one(self, timeout: int) -> None: ...
    def run_for_multiple(self, timeout: int) -> None: ...
    def run(self) -> None: ...
    def handle(self, listener: socket.socket, client: socket.socket, addr: _AddressType) -> None: ...
    def handle_request(self, listener: socket.socket, req: Request, client: socket.socket, addr: tuple[str, int]) -> bool: ...
    def handle_error(self, req: Request | None, client: socket.socket, addr: _AddressType, exc: BaseException) -> None: ...
