From: Ben Darnell Date: Fri, 7 Jun 2024 18:28:07 +0000 (-0400) Subject: Update mypy and typing packages to latest X-Git-Tag: v6.5.0b1~58^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f9833160959552231c72f7127cf6b7774f6746b;p=thirdparty%2Ftornado.git Update mypy and typing packages to latest Adapt to newer upstream types for AbstractEventLoop --- diff --git a/requirements.txt b/requirements.txt index 9118bdfde..8dcc978d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -48,9 +48,9 @@ markupsafe==2.1.2 # via jinja2 mccabe==0.7.0 # via flake8 -mypy==1.0.1 +mypy==1.10.0 # via -r requirements.in -mypy-extensions==0.4.3 +mypy-extensions==1.0.0 # via # black # mypy @@ -111,9 +111,9 @@ sphinxcontrib-serializinghtml==1.1.5 # via sphinx tox==4.6.0 # via -r requirements.in -types-pycurl==7.45.2.0 +types-pycurl==7.45.3.20240421 # via -r requirements.in -typing-extensions==4.4.0 +typing-extensions==4.12.1 # via mypy urllib3==1.26.18 # via requests diff --git a/tornado/platform/asyncio.py b/tornado/platform/asyncio.py index 79e60848b..2e9f42484 100644 --- a/tornado/platform/asyncio.py +++ b/tornado/platform/asyncio.py @@ -49,6 +49,9 @@ from typing import ( Union, ) +if typing.TYPE_CHECKING: + from typing_extensions import TypeVarTuple, Unpack + class _HasFileno(Protocol): def fileno(self) -> int: @@ -59,6 +62,8 @@ _FileDescriptorLike = Union[int, _HasFileno] _T = TypeVar("_T") +if typing.TYPE_CHECKING: + _Ts = TypeVarTuple("_Ts") # Collection of selector thread event loops to shut down on exit. _selector_loops: Set["SelectorThread"] = set() @@ -702,12 +707,18 @@ class AddThreadSelectorEventLoop(asyncio.AbstractEventLoop): self._real_loop.close() def add_reader( - self, fd: "_FileDescriptorLike", callback: Callable[..., None], *args: Any + self, + fd: "_FileDescriptorLike", + callback: Callable[..., None], + *args: "Unpack[_Ts]", ) -> None: return self._selector.add_reader(fd, callback, *args) def add_writer( - self, fd: "_FileDescriptorLike", callback: Callable[..., None], *args: Any + self, + fd: "_FileDescriptorLike", + callback: Callable[..., None], + *args: "Unpack[_Ts]", ) -> None: return self._selector.add_writer(fd, callback, *args)