mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 03:41:28 +08:00
asyncio: make AbstractServer abstract and remove unnecessary metaclass=ABCMeta (#7185)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import ssl
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike
|
||||
from abc import ABCMeta
|
||||
from asyncio.events import AbstractEventLoop, AbstractServer, Handle, TimerHandle
|
||||
from asyncio.futures import Future
|
||||
from asyncio.protocols import BaseProtocol
|
||||
@@ -33,6 +32,10 @@ class Server(AbstractServer):
|
||||
backlog: int,
|
||||
ssl_handshake_timeout: float | None,
|
||||
) -> None: ...
|
||||
def get_loop(self) -> AbstractEventLoop: ...
|
||||
def is_serving(self) -> bool: ...
|
||||
async def start_serving(self) -> None: ...
|
||||
async def serve_forever(self) -> None: ...
|
||||
else:
|
||||
def __init__(self, loop: AbstractEventLoop, sockets: list[socket]) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@@ -43,8 +46,10 @@ class Server(AbstractServer):
|
||||
def sockets(self) -> list[socket]: ...
|
||||
else:
|
||||
sockets: list[socket] | None
|
||||
def close(self) -> None: ...
|
||||
async def wait_closed(self) -> None: ...
|
||||
|
||||
class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
class BaseEventLoop(AbstractEventLoop):
|
||||
def run_forever(self) -> None: ...
|
||||
# Can't use a union, see mypy issue # 1873.
|
||||
@overload
|
||||
|
||||
@@ -56,18 +56,24 @@ class TimerHandle(Handle):
|
||||
def when(self) -> float: ...
|
||||
|
||||
class AbstractServer:
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
async def __aenter__(self: Self) -> Self: ...
|
||||
async def __aexit__(self, *exc: Any) -> None: ...
|
||||
@abstractmethod
|
||||
def get_loop(self) -> AbstractEventLoop: ...
|
||||
@abstractmethod
|
||||
def is_serving(self) -> bool: ...
|
||||
@abstractmethod
|
||||
async def start_serving(self) -> None: ...
|
||||
@abstractmethod
|
||||
async def serve_forever(self) -> None: ...
|
||||
|
||||
@abstractmethod
|
||||
async def wait_closed(self) -> None: ...
|
||||
|
||||
class AbstractEventLoop(metaclass=ABCMeta):
|
||||
class AbstractEventLoop:
|
||||
slow_callback_duration: float
|
||||
@abstractmethod
|
||||
def run_forever(self) -> None: ...
|
||||
@@ -491,7 +497,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
async def shutdown_default_executor(self) -> None: ...
|
||||
|
||||
class AbstractEventLoopPolicy(metaclass=ABCMeta):
|
||||
class AbstractEventLoopPolicy:
|
||||
@abstractmethod
|
||||
def get_event_loop(self) -> AbstractEventLoop: ...
|
||||
@abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user