]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
deps: Bump mypy to 0.701 2654/head
authorBen Darnell <ben@bendarnell.com>
Sun, 5 May 2019 17:05:34 +0000 (13:05 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 5 May 2019 17:06:48 +0000 (13:06 -0400)
.travis.yml
maint/requirements.txt
tornado/curl_httpclient.py
tornado/test/curl_httpclient_test.py
tornado/testing.py
tox.ini

index 2382943ffe719b4d6235210e301f6dc1422a27ac..5ea318f15018db419923df73741d2bcc2b09f53b 100644 (file)
@@ -36,7 +36,7 @@ install:
     # Ideally we'd run the lint stuff on the latest Python
     # version supported. But Python 3.7 requires slower-to-start VMs,
     # so we run it on 3.6 to minimize total CI run time.
-    - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then travis_retry pip install flake8 mypy==0.630 black; fi
+    - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then travis_retry pip install flake8 mypy==0.701 black; fi
     # We run docs on py37 because we need some bug fixes for introspection of annotations.
     - if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then travis_retry pip install -r docs/requirements.txt; fi
     # On travis the extension should always be built
index be65997c6e18ce1737223ea4687f7890aa7d50b8..81b243cf3a3d82c1a1d54d5486597b80e73bda06 100644 (file)
@@ -22,7 +22,7 @@ incremental==17.5.0
 Jinja2==2.10.1
 MarkupSafe==1.1.1
 mccabe==0.6.1
-mypy==0.630
+mypy==0.701
 mypy-extensions==0.4.1
 packaging==19.0
 pep8==1.7.1
@@ -57,7 +57,7 @@ tox==3.9.0
 tqdm==4.31.1
 twine==1.13.0
 Twisted==19.2.0
-typed-ast==1.1.2
+typed-ast==1.3.5
 urllib3==1.24.3
 virtualenv==16.5.0
 webencodings==0.5.1
index 4119585fd1a8ccfc95e20728ed781e7d82e8f05e..a867d35367ba241b56b6f1ee95c61ea31e5606fb 100644 (file)
@@ -18,7 +18,7 @@
 import collections
 import functools
 import logging
-import pycurl  # type: ignore
+import pycurl
 import threading
 import time
 from io import BytesIO
@@ -50,7 +50,8 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
         self, max_clients: int = 10, defaults: Dict[str, Any] = None
     ) -> None:
         super(CurlAsyncHTTPClient, self).initialize(defaults=defaults)
-        self._multi = pycurl.CurlMulti()
+        # Typeshed is incomplete for CurlMulti, so just use Any for now.
+        self._multi = pycurl.CurlMulti()  # type: Any
         self._multi.setopt(pycurl.M_TIMERFUNCTION, self._set_timeout)
         self._multi.setopt(pycurl.M_SOCKETFUNCTION, self._handle_socket)
         self._curls = [self._curl_create() for i in range(max_clients)]
@@ -219,7 +220,8 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
                 started += 1
                 curl = self._free_list.pop()
                 (request, callback, queue_start_time) = self._requests.popleft()
-                curl.info = {
+                # TODO: Don't smuggle extra data on an attribute of the Curl object.
+                curl.info = {  # type: ignore
                     "headers": httputil.HTTPHeaders(),
                     "buffer": BytesIO(),
                     "request": request,
@@ -230,7 +232,10 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
                 }
                 try:
                     self._curl_setup_request(
-                        curl, request, curl.info["buffer"], curl.info["headers"]
+                        curl,
+                        request,
+                        curl.info["buffer"],  # type: ignore
+                        curl.info["headers"],  # type: ignore
                     )
                 except Exception as e:
                     # If there was an error in setup, pass it on
@@ -252,8 +257,8 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
     def _finish(
         self, curl: pycurl.Curl, curl_error: int = None, curl_message: str = None
     ) -> None:
-        info = curl.info
-        curl.info = None
+        info = curl.info  # type: ignore
+        curl.info = None  # type: ignore
         self._multi.remove_handle(curl)
         self._free_list.append(curl)
         buffer = info["buffer"]
@@ -469,7 +474,7 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
             request_buffer = BytesIO(utf8(request.body or ""))
 
             def ioctl(cmd: int) -> None:
-                if cmd == curl.IOCMD_RESTARTREAD:
+                if cmd == curl.IOCMD_RESTARTREAD:  # type: ignore
                     request_buffer.seek(0)
 
             curl.setopt(pycurl.READFUNCTION, request_buffer.read)
index ccb19fecdf9d681ce5a46919b1cc7c0abd8001a8..d8d42f6bdbbb9095a22ea1fe0a8b5de5d3c597a4 100644 (file)
@@ -9,9 +9,9 @@ from tornado.web import Application, RequestHandler
 
 
 try:
-    import pycurl  # type: ignore
+    import pycurl
 except ImportError:
-    pycurl = None
+    pycurl = None  # type: ignore
 
 if pycurl is not None:
     from tornado.curl_httpclient import CurlAsyncHTTPClient
index ba13a525eededae0a1f43733bea25dffe1435eea..8adbc4ceb2a18e7dbcc3fabe49b0e86bac5d81d0 100644 (file)
@@ -260,7 +260,7 @@ class AsyncTestCase(unittest.TestCase):
             self.__failure = None
             raise_exc_info(failure)
 
-    def run(self, result: unittest.TestResult = None) -> unittest.TestCase:
+    def run(self, result: unittest.TestResult = None) -> Optional[unittest.TestResult]:
         ret = super(AsyncTestCase, self).run(result)
         # As a last resort, if an exception escaped super.run() and wasn't
         # re-raised in tearDown, raise it here.  This will cause the
diff --git a/tox.ini b/tox.ini
index 3796236dd5fe6562e2254c4448e35a95ecb08177..0578c9f14bc8770577e4bef3e32158c25c747a45 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -67,7 +67,7 @@ deps =
      sphinx: -r{toxinidir}/docs/requirements.txt
      lint: flake8
      lint: black
-     mypy: mypy==0.630
+     mypy: mypy==0.701
 
 setenv =
        # The extension is mandatory on cpython.