]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Update python dependencies
authorBen Darnell <ben@bendarnell.com>
Thu, 22 May 2025 20:18:09 +0000 (16:18 -0400)
committerBen Darnell <ben@bendarnell.com>
Thu, 22 May 2025 20:18:09 +0000 (16:18 -0400)
Notably including mypy, which required some updates to various
code files to improve type annotations.

12 files changed:
docs/conf.py
requirements.txt
tornado/curl_httpclient.py
tornado/gen.py
tornado/process.py
tornado/tcpclient.py
tornado/test/__main__.py
tornado/test/ioloop_test.py
tornado/test/web_test.py
tornado/test/websocket_test.py
tornado/util.py
tornado/websocket.py

index c2c81b5f0711dcea52b57706f047bd487a6eef45..ce766675a33b8db5d1d3bd826d94835cf393ed29 100644 (file)
@@ -2,8 +2,6 @@ import os
 import sphinx.errors
 import sys
 
-import sphinx_rtd_theme
-
 # Ensure we get the local copy of tornado instead of what's on the standard path
 sys.path.insert(0, os.path.abspath(".."))
 import tornado
@@ -88,7 +86,6 @@ latex_documents = [
 intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)}
 
 html_theme = "sphinx_rtd_theme"
-html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
 
 # Suppress warnings about "class reference target not found" for these types.
 # In most cases these types come from type annotations and are for mypy's use.
index b32a5562007f209e367ecbdad7f893d91a95da02..5f450911c83b2bd11fe461067b0c5e4ee524ed32 100644 (file)
@@ -4,31 +4,31 @@
 #
 #    pip-compile
 #
-alabaster==0.7.16
+alabaster==1.0.0
     # via sphinx
-babel==2.15.0
+babel==2.17.0
     # via sphinx
-black==24.4.2
+black==25.1.0
     # via -r requirements.in
-build==1.2.1
+build==1.2.2.post1
     # via pip-tools
 cachetools==5.5.2
     # via tox
-certifi==2024.7.4
+certifi==2025.4.26
     # via requests
 chardet==5.2.0
     # via tox
-charset-normalizer==3.3.2
+charset-normalizer==3.4.2
     # via requests
-click==8.1.7
+click==8.2.1
     # via
     #   black
     #   pip-tools
 colorama==0.4.6
     # via tox
-distlib==0.3.8
+distlib==0.3.9
     # via virtualenv
-docutils==0.20.1
+docutils==0.21.2
     # via
     #   sphinx
     #   sphinx-rtd-theme
@@ -36,21 +36,21 @@ filelock==3.18.0
     # via
     #   tox
     #   virtualenv
-flake8==7.0.0
+flake8==7.2.0
     # via -r requirements.in
-idna==3.7
+idna==3.10
     # via requests
 imagesize==1.4.1
     # via sphinx
 jinja2==3.1.6
     # via sphinx
-markupsafe==2.1.5
+markupsafe==3.0.2
     # via jinja2
 mccabe==0.7.0
     # via flake8
-mypy==1.10.0
+mypy==1.15.0
     # via -r requirements.in
-mypy-extensions==1.0.0
+mypy-extensions==1.1.0
     # via
     #   black
     #   mypy
@@ -70,56 +70,58 @@ platformdirs==4.3.8
     #   black
     #   tox
     #   virtualenv
-pluggy==1.5.0
+pluggy==1.6.0
     # via tox
-pycodestyle==2.11.1
+pycodestyle==2.13.0
     # via flake8
-pyflakes==3.2.0
+pyflakes==3.3.2
     # via flake8
-pygments==2.18.0
+pygments==2.19.1
     # via sphinx
 pyproject-api==1.9.1
     # via tox
-pyproject-hooks==1.1.0
+pyproject-hooks==1.2.0
     # via
     #   build
     #   pip-tools
 requests==2.32.3
     # via sphinx
-snowballstemmer==2.2.0
+roman-numerals-py==3.1.0
     # via sphinx
-sphinx==7.3.7
+snowballstemmer==3.0.1
+    # via sphinx
+sphinx==8.2.3
     # via
     #   -r requirements.in
     #   sphinx-rtd-theme
     #   sphinxcontrib-jquery
-sphinx-rtd-theme==2.0.0
+sphinx-rtd-theme==3.0.2
     # via -r requirements.in
-sphinxcontrib-applehelp==1.0.8
+sphinxcontrib-applehelp==2.0.0
     # via sphinx
-sphinxcontrib-devhelp==1.0.6
+sphinxcontrib-devhelp==2.0.0
     # via sphinx
-sphinxcontrib-htmlhelp==2.0.5
+sphinxcontrib-htmlhelp==2.1.0
     # via sphinx
 sphinxcontrib-jquery==4.1
     # via sphinx-rtd-theme
 sphinxcontrib-jsmath==1.0.1
     # via sphinx
-sphinxcontrib-qthelp==1.0.7
+sphinxcontrib-qthelp==2.0.0
     # via sphinx
-sphinxcontrib-serializinghtml==1.1.10
+sphinxcontrib-serializinghtml==2.0.0
     # via sphinx
 tox==4.26.0
     # via -r requirements.in
-types-pycurl==7.45.3.20240421
+types-pycurl==7.45.6.20250309
     # via -r requirements.in
-typing-extensions==4.12.2
+typing-extensions==4.13.2
     # via mypy
-urllib3==2.2.2
+urllib3==2.4.0
     # via requests
 virtualenv==20.31.2
     # via tox
-wheel==0.43.0
+wheel==0.45.1
     # via pip-tools
 
 # The following packages are considered to be unsafe in a requirements file:
index dde700326668d98a3fbe87ca42766f5a4d12a5ad..eb3fa7836fac39a9256a863108c74023fd90a7c7 100644 (file)
@@ -544,7 +544,7 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
     def _curl_header_callback(
         self,
         headers: httputil.HTTPHeaders,
-        header_callback: Callable[[str], None],
+        header_callback: Optional[Callable[[str], None]],
         header_line_bytes: bytes,
     ) -> None:
         header_line = native_str(header_line_bytes.decode("latin1"))
index 3dab733c6a9925214889f0b29862634d31a5cd02..1ee8b60844cd45df313a44657a257d3e2cd866ad 100644 (file)
@@ -171,7 +171,7 @@ def _fake_ctx_run(f: Callable[..., _T], *args: Any, **kw: Any) -> _T:
 
 @overload
 def coroutine(
-    func: Callable[..., "Generator[Any, Any, _T]"]
+    func: Callable[..., "Generator[Any, Any, _T]"],
 ) -> Callable[..., "Future[_T]"]: ...
 
 
@@ -180,7 +180,7 @@ def coroutine(func: Callable[..., _T]) -> Callable[..., "Future[_T]"]: ...
 
 
 def coroutine(
-    func: Union[Callable[..., "Generator[Any, Any, _T]"], Callable[..., _T]]
+    func: Union[Callable[..., "Generator[Any, Any, _T]"], Callable[..., _T]],
 ) -> Callable[..., "Future[_T]"]:
     """Decorator for asynchronous generators.
 
index 339ef659b1cfbdc72b222109bfc34488ca24ed64..61700c58ddcd6f3868fa7d021a11144463c7a697 100644 (file)
@@ -117,7 +117,6 @@ def fork_processes(
     if max_restarts is None:
         max_restarts = 100
 
-    global _task_id
     assert _task_id is None
     if num_processes is None or num_processes <= 0:
         num_processes = cpu_count()
@@ -181,7 +180,6 @@ def task_id() -> Optional[int]:
 
     Returns None if this process was not created by `fork_processes`.
     """
-    global _task_id
     return _task_id
 
 
index 2e4b28482dc6f369669888448c4bc786f51fbd81..5b2a9f3fcd92f116ad92c47efc6e689cda191666 100644 (file)
@@ -13,8 +13,7 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-"""A non-blocking TCP connection factory.
-"""
+"""A non-blocking TCP connection factory."""
 
 import functools
 import socket
@@ -296,7 +295,7 @@ class TCPClient:
 
     def _create_stream(
         self,
-        max_buffer_size: int,
+        max_buffer_size: Optional[int],
         af: socket.AddressFamily,
         addr: Tuple,
         source_ip: Optional[str] = None,
index 65b794d9beafd5662679fff18ca510abaf4d5cdc..eb52caf17f7e700ccddcf2c0175f3b67acfa87d3 100644 (file)
@@ -1,5 +1,4 @@
-"""Shim to allow python -m tornado.test.
-"""
+"""Shim to allow python -m tornado.test."""
 
 from tornado.test.runtests import all, main
 
index 37ac6deba2976937447c76739780182edc74b97d..c1e2df6a41aba288925f8da51087cd0cb01cf091 100644 (file)
@@ -555,7 +555,7 @@ class TestIOLoopFutures(AsyncTestCase):
         count = [0]
 
         class MyExecutor(futures.ThreadPoolExecutor):
-            def submit(self, func, *args):
+            def submit(self, func, *args):  # type: ignore[override]
                 count[0] += 1
                 return super().submit(func, *args)
 
index a514e2a4ca97c8275bed704f551f0d51518f7718..9ab054b325fbcaf29db6958168e552b691667ffe 100644 (file)
@@ -53,7 +53,7 @@ import logging
 import os
 import re
 import socket
-import typing  # noqa: F401
+import typing
 import unittest
 import urllib.parse
 
@@ -111,10 +111,10 @@ class CookieTestRequestHandler(RequestHandler):
                 settings=dict(cookie_secret=cookie_secret, key_version=key_version)
             )
 
-    def get_cookie(self, name):
-        return self._cookies.get(name)
+    def get_cookie(self, name) -> typing.Optional[str]:  # type: ignore[override]
+        return to_unicode(self._cookies.get(name))
 
-    def set_cookie(self, name, value, expires_days=None):
+    def set_cookie(self, name, value, expires_days=None):  # type: ignore[override]
         self._cookies[name] = value
 
 
index 1f317fb0d5ac6dfaaafbce447cab4fd10af0ec3b..275fcaeed9c1af5f86e759ca79a10675bb0826f9 100644 (file)
@@ -141,7 +141,7 @@ class PathArgsHandler(TestWebSocketHandler):
 
 
 class CoroutineOnMessageHandler(TestWebSocketHandler):
-    def initialize(self, **kwargs):
+    def initialize(self, **kwargs):  # type: ignore[override]
         super().initialize(**kwargs)
         self.sleeping = 0
 
@@ -161,7 +161,7 @@ class RenderMessageHandler(TestWebSocketHandler):
 
 
 class SubprotocolHandler(TestWebSocketHandler):
-    def initialize(self, **kwargs):
+    def initialize(self, **kwargs):  # type: ignore[override]
         super().initialize(**kwargs)
         self.select_subprotocol_called = False
 
@@ -180,7 +180,7 @@ class SubprotocolHandler(TestWebSocketHandler):
 
 
 class OpenCoroutineHandler(TestWebSocketHandler):
-    def initialize(self, test, **kwargs):
+    def initialize(self, test, **kwargs):  # type: ignore[override]
         super().initialize(**kwargs)
         self.test = test
         self.open_finished = False
@@ -634,7 +634,7 @@ class WebSocketTest(WebSocketBaseTestCase):
 
 
 class NativeCoroutineOnMessageHandler(TestWebSocketHandler):
-    def initialize(self, **kwargs):
+    def initialize(self, **kwargs):  # type: ignore[override]
         super().initialize(**kwargs)
         self.sleeping = 0
 
index 2e5eee792bd4dc7d95997a620df9f6b293a87e36..19df4913232b4055ae130ef871516f8b918e5947 100644 (file)
@@ -145,7 +145,7 @@ def exec_in(
 
 
 def raise_exc_info(
-    exc_info: Tuple[Optional[type], Optional[BaseException], Optional["TracebackType"]]
+    exc_info: Tuple[Optional[type], Optional[BaseException], Optional["TracebackType"]],
 ) -> typing.NoReturn:
     try:
         if exc_info[1] is not None:
index b719547bdf94e9623a9050a2eea3c911f655f6bc..95d780294bc5397aea83a6d5f30a945d017f8c54 100644 (file)
@@ -65,7 +65,9 @@ if TYPE_CHECKING:
             pass
 
     class _Decompressor(Protocol):
-        unconsumed_tail = b""  # type: bytes
+        @property
+        def unconsumed_tail(self) -> bytes:
+            pass
 
         def decompress(self, data: bytes, max_length: int) -> bytes:
             pass
@@ -420,21 +422,23 @@ class WebSocketHandler(tornado.web.RequestHandler):
         # TODO: Add wbits option.
         return None
 
-    def open(self, *args: str, **kwargs: str) -> Optional[Awaitable[None]]:
-        """Invoked when a new WebSocket is opened.
+    def _open(self, *args: str, **kwargs: str) -> Optional[Awaitable[None]]:
+        pass
 
-        The arguments to `open` are extracted from the `tornado.web.URLSpec`
-        regular expression, just like the arguments to
-        `tornado.web.RequestHandler.get`.
+    open = _open  # type: Callable[..., Optional[Awaitable[None]]]
+    """Invoked when a new WebSocket is opened.
 
-        `open` may be a coroutine. `on_message` will not be called until
-        `open` has returned.
+    The arguments to `open` are extracted from the `tornado.web.URLSpec`
+    regular expression, just like the arguments to
+    `tornado.web.RequestHandler.get`.
 
-        .. versionchanged:: 5.1
+    `open` may be a coroutine. `on_message` will not be called until
+    `open` has returned.
 
-           ``open`` may be a coroutine.
-        """
-        pass
+    .. versionchanged:: 5.1
+
+        ``open`` may be a coroutine.
+    """
 
     def on_message(self, message: Union[str, bytes]) -> Optional[Awaitable[None]]:
         """Handle incoming messages on the WebSocket