Return concrete server from abstract event loop (#5566)

https://docs.python.org/3/library/asyncio-eventloop.html?highlight=abstracteventloop#creating-network-servers
documents the methods as returning a concrete server object.
This commit is contained in:
Sebastian Rittau
2021-06-03 16:03:45 +02:00
committed by GitHub
parent f4c5ae01c4
commit 7e1b8384a0
3 changed files with 19 additions and 15 deletions

View File

@@ -2,15 +2,17 @@ import ssl
import sys
from _typeshed import FileDescriptorLike
from abc import ABCMeta, abstractmethod
from asyncio.futures import Future
from asyncio.protocols import BaseProtocol
from asyncio.tasks import Task
from asyncio.transports import BaseTransport
from asyncio.unix_events import AbstractChildWatcher
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
from typing import IO, Any, Awaitable, Callable, Dict, Generator, List, Optional, Sequence, Tuple, TypeVar, Union, overload
from typing_extensions import Literal
from .base_events import Server
from .futures import Future
from .protocols import BaseProtocol
from .tasks import Task
from .transports import BaseTransport
from .unix_events import AbstractChildWatcher
if sys.version_info >= (3, 7):
from contextvars import Context
@@ -261,7 +263,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
reuse_port: Optional[bool] = ...,
ssl_handshake_timeout: Optional[float] = ...,
start_serving: bool = ...,
) -> AbstractServer: ...
) -> Server: ...
@overload
@abstractmethod
async def create_server(
@@ -279,7 +281,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
reuse_port: Optional[bool] = ...,
ssl_handshake_timeout: Optional[float] = ...,
start_serving: bool = ...,
) -> AbstractServer: ...
) -> Server: ...
async def create_unix_connection(
self,
protocol_factory: _ProtocolFactory,
@@ -300,7 +302,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
ssl: _SSLContext = ...,
ssl_handshake_timeout: Optional[float] = ...,
start_serving: bool = ...,
) -> AbstractServer: ...
) -> Server: ...
@abstractmethod
async def sendfile(
self,
@@ -338,7 +340,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
) -> AbstractServer: ...
) -> Server: ...
@overload
@abstractmethod
async def create_server(
@@ -354,7 +356,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...,
) -> AbstractServer: ...
) -> Server: ...
async def create_unix_connection(
self,
protocol_factory: _ProtocolFactory,
@@ -372,7 +374,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
sock: Optional[socket] = ...,
backlog: int = ...,
ssl: _SSLContext = ...,
) -> AbstractServer: ...
) -> Server: ...
@abstractmethod
async def create_datagram_endpoint(
self,