Skip to content

Commit

Permalink
deps: Bump mypy to 0.701
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarnell committed May 5, 2019
1 parent 731bc5c commit 5fdadf5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions maint/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 12 additions & 7 deletions tornado/curl_httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import collections
import functools
import logging
import pycurl # type: ignore
import pycurl
import threading
import time
from io import BytesIO
Expand Down Expand Up @@ -50,7 +50,8 @@ def initialize( # type: ignore
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)]
Expand Down Expand Up @@ -219,7 +220,8 @@ def _process_queue(self) -> None:
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,
Expand All @@ -230,7 +232,10 @@ def _process_queue(self) -> None:
}
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
Expand All @@ -252,8 +257,8 @@ def _process_queue(self) -> None:
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"]
Expand Down Expand Up @@ -469,7 +474,7 @@ def write_function(b: Union[bytes, bytearray]) -> int:
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)
Expand Down
4 changes: 2 additions & 2 deletions tornado/test/curl_httpclient_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@


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
Expand Down
2 changes: 1 addition & 1 deletion tornado/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def __rethrow(self) -> None:
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
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5fdadf5

Please sign in to comment.