mypy: Upgrade from 0.720 to 0.730.

Fixes #13269.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-11-12 18:24:14 -08:00 committed by Tim Abbott
parent 43bba63549
commit 40f4ead738
12 changed files with 42 additions and 43 deletions

View File

@ -485,18 +485,18 @@ mypy-extensions==0.4.3 \
--hash=sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d \
--hash=sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8 \
# via mypy
mypy==0.720 \
--hash=sha256:0107bff4f46a289f0e4081d59b77cef1c48ea43da5a0dbf0005d54748b26df2a \
--hash=sha256:07957f5471b3bb768c61f08690c96d8a09be0912185a27a68700f3ede99184e4 \
--hash=sha256:10af62f87b6921eac50271e667cc234162a194e742d8e02fc4ddc121e129a5b0 \
--hash=sha256:11fd60d2f69f0cefbe53ce551acf5b1cec1a89e7ce2d47b4e95a84eefb2899ae \
--hash=sha256:15e43d3b1546813669bd1a6ec7e6a11d2888db938e0607f7b5eef6b976671339 \
--hash=sha256:352c24ba054a89bb9a35dd064ee95ab9b12903b56c72a8d3863d882e2632dc76 \
--hash=sha256:437020a39417e85e22ea8edcb709612903a9924209e10b3ec6d8c9f05b79f498 \
--hash=sha256:49925f9da7cee47eebf3420d7c0e00ec662ec6abb2780eb0a16260a7ba25f9c4 \
--hash=sha256:6724fcd5777aa6cebfa7e644c526888c9d639bd22edd26b2a8038c674a7c34bd \
--hash=sha256:7a17613f7ea374ab64f39f03257f22b5755335b73251d0d253687a69029701ba \
--hash=sha256:cdc1151ced496ca1496272da7fc356580e95f2682be1d32377c22ddebdf73c91
mypy==0.730 \
--hash=sha256:1d98fd818ad3128a5408148c9e4a5edce6ed6b58cc314283e631dd5d9216527b \
--hash=sha256:22ee018e8fc212fe601aba65d3699689dd29a26410ef0d2cc1943de7bec7e3ac \
--hash=sha256:3a24f80776edc706ec8d05329e854d5b9e464cd332e25cde10c8da2da0a0db6c \
--hash=sha256:42a78944e80770f21609f504ca6c8173f7768043205b5ac51c9144e057dcf879 \
--hash=sha256:4b2b20106973548975f0c0b1112eceb4d77ed0cafe0a231a1318f3b3a22fc795 \
--hash=sha256:591a9625b4d285f3ba69f541c84c0ad9e7bffa7794da3fa0585ef13cf95cb021 \
--hash=sha256:5b4b70da3d8bae73b908a90bb2c387b977e59d484d22c604a2131f6f4397c1a3 \
--hash=sha256:84edda1ffeda0941b2ab38ecf49302326df79947fa33d98cdcfbf8ca9cf0bb23 \
--hash=sha256:b2b83d29babd61b876ae375786960a5374bba0e4aba3c293328ca6ca5dc448dd \
--hash=sha256:cc4502f84c37223a1a5ab700649b5ab1b5e4d2bf2d426907161f20672a21930b \
--hash=sha256:e29e24dd6e7f39f200a5bb55dcaa645d38a397dd5a6674f6042ef02df5795046
oauthlib==3.1.0 \
--hash=sha256:bee41cc35fcca6e988463cacc3bcb8a96224f470ca547e697b604cc697b2f889 \
--hash=sha256:df884cd6cbe20e32633f1db1072e9356f53638e4361bef4e8b03c9127c9328ea \

View File

@ -2,4 +2,4 @@
# /tools/update-locked-requirements to update requirements/dev.txt
# and requirements/mypy.txt.
# See requirements/README.md for more detail.
mypy==0.720 # https://github.com/zulip/zulip/issues/13269
mypy==0.730

View File

@ -11,18 +11,18 @@ mypy-extensions==0.4.3 \
--hash=sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d \
--hash=sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8 \
# via mypy
mypy==0.720 \
--hash=sha256:0107bff4f46a289f0e4081d59b77cef1c48ea43da5a0dbf0005d54748b26df2a \
--hash=sha256:07957f5471b3bb768c61f08690c96d8a09be0912185a27a68700f3ede99184e4 \
--hash=sha256:10af62f87b6921eac50271e667cc234162a194e742d8e02fc4ddc121e129a5b0 \
--hash=sha256:11fd60d2f69f0cefbe53ce551acf5b1cec1a89e7ce2d47b4e95a84eefb2899ae \
--hash=sha256:15e43d3b1546813669bd1a6ec7e6a11d2888db938e0607f7b5eef6b976671339 \
--hash=sha256:352c24ba054a89bb9a35dd064ee95ab9b12903b56c72a8d3863d882e2632dc76 \
--hash=sha256:437020a39417e85e22ea8edcb709612903a9924209e10b3ec6d8c9f05b79f498 \
--hash=sha256:49925f9da7cee47eebf3420d7c0e00ec662ec6abb2780eb0a16260a7ba25f9c4 \
--hash=sha256:6724fcd5777aa6cebfa7e644c526888c9d639bd22edd26b2a8038c674a7c34bd \
--hash=sha256:7a17613f7ea374ab64f39f03257f22b5755335b73251d0d253687a69029701ba \
--hash=sha256:cdc1151ced496ca1496272da7fc356580e95f2682be1d32377c22ddebdf73c91
mypy==0.730 \
--hash=sha256:1d98fd818ad3128a5408148c9e4a5edce6ed6b58cc314283e631dd5d9216527b \
--hash=sha256:22ee018e8fc212fe601aba65d3699689dd29a26410ef0d2cc1943de7bec7e3ac \
--hash=sha256:3a24f80776edc706ec8d05329e854d5b9e464cd332e25cde10c8da2da0a0db6c \
--hash=sha256:42a78944e80770f21609f504ca6c8173f7768043205b5ac51c9144e057dcf879 \
--hash=sha256:4b2b20106973548975f0c0b1112eceb4d77ed0cafe0a231a1318f3b3a22fc795 \
--hash=sha256:591a9625b4d285f3ba69f541c84c0ad9e7bffa7794da3fa0585ef13cf95cb021 \
--hash=sha256:5b4b70da3d8bae73b908a90bb2c387b977e59d484d22c604a2131f6f4397c1a3 \
--hash=sha256:84edda1ffeda0941b2ab38ecf49302326df79947fa33d98cdcfbf8ca9cf0bb23 \
--hash=sha256:b2b83d29babd61b876ae375786960a5374bba0e4aba3c293328ca6ca5dc448dd \
--hash=sha256:cc4502f84c37223a1a5ab700649b5ab1b5e4d2bf2d426907161f20672a21930b \
--hash=sha256:e29e24dd6e7f39f200a5bb55dcaa645d38a397dd5a6674f6042ef02df5795046
typed-ast==1.4.0 \
--hash=sha256:1170afa46a3799e18b4c977777ce137bb53c7485379d9706af8a59f2ea1aa161 \
--hash=sha256:18511a0b3e7922276346bcb47e2ef9f38fb90fd31cb9223eed42c85d1312344e \

View File

@ -9,8 +9,8 @@ def get_json_filename(locale: str) -> str:
return "locale/{}/mobile.json".format(locale)
def get_locales() -> List[str]:
tracked_files = check_output(['git', 'ls-files', 'locale'])
tracked_files = tracked_files.decode().split()
output = check_output(['git', 'ls-files', 'locale'])
tracked_files = output.decode().split()
regex = re.compile(r'locale/(\w+)/LC_MESSAGES/django.po')
locales = ['en']
for tracked_file in tracked_files:

View File

@ -32,7 +32,7 @@ def set_up_django(external_host):
os.environ['PYTHONUNBUFFERED'] = 'y'
def assert_server_running(server, log_file):
# type: (subprocess.Popen, Optional[str]) -> None
# type: (subprocess.Popen[bytes], Optional[str]) -> None
"""Get the exit code of the server, or None if it is still running."""
if server.poll() is not None:
message = 'Server died unexpectedly!'
@ -41,7 +41,7 @@ def assert_server_running(server, log_file):
raise RuntimeError(message)
def server_is_up(server, log_file):
# type: (subprocess.Popen, Optional[str]) -> bool
# type: (subprocess.Popen[bytes], Optional[str]) -> bool
assert_server_running(server, log_file)
try:
# We could get a 501 error if the reverse proxy is up but the Django app isn't.

View File

@ -16,7 +16,7 @@ sanity_check.check_venv(__file__)
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
successful_worker_launch = '[process_queue] 20 queue worker threads were launched\n'
def check_worker_launch(run_dev: subprocess.Popen) -> bool:
def check_worker_launch(run_dev: "subprocess.Popen[str]") -> bool:
failed = False
i = 0

View File

@ -13,7 +13,7 @@ sanity_check.check_venv(__file__)
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
def start_server(run_dev: subprocess.Popen) -> Tuple[bool, str]:
def start_server(run_dev: "subprocess.Popen[str]") -> Tuple[bool, str]:
failure = False
i = 0

View File

@ -26,4 +26,4 @@ LATEST_RELEASE_ANNOUNCEMENT = "https://blog.zulip.org/2019/03/01/zulip-2-0-relea
# historical commits sharing the same major version, in which case a
# minor version bump suffices.
PROVISION_VERSION = '65.4'
PROVISION_VERSION = '66.0'

View File

@ -72,8 +72,8 @@ class Command(compilemessages.Command):
raise Exception("Unknown language %s" % (locale,))
def get_locales(self) -> List[str]:
tracked_files = check_output(['git', 'ls-files', 'locale'])
tracked_files = tracked_files.decode().split()
output = check_output(['git', 'ls-files', 'locale'])
tracked_files = output.decode().split()
regex = re.compile(r'locale/(\w+)/LC_MESSAGES/django.po')
locales = ['en']
for tracked_file in tracked_files:

View File

@ -66,12 +66,13 @@ def test_generated_curl_examples_for_success(client: Client) -> None:
generated_curl_command = [
x for x in shlex.split(curl_command_text) if x != "\n"]
response_json = None
response = None
try:
# We split this across two lines so if curl fails and
# returns non-JSON output, we'll still print it.
response = subprocess.check_output(generated_curl_command).decode('utf-8')
response = json.loads(response)
response_json = subprocess.check_output(generated_curl_command).decode('utf-8')
response = json.loads(response_json)
assert(response["result"] == "success")
except (AssertionError, Exception):
error_template = """
@ -100,7 +101,7 @@ To learn more about the test itself, see zerver/openapi/test_curl_examples.py.
file_name=file_name,
line=line,
curl_command=generated_curl_command,
response=json.dumps(response, indent=4)))
response=response_json if response is None else json.dumps(response, indent=4)))
raise
if REGISTERED_GENERATOR_FUNCTIONS != CALLED_GENERATOR_FUNCTIONS:

View File

@ -4,11 +4,9 @@ import re
import sys
import mock
import inspect
import typing
from typing import Dict, Any, Set, Union, List, Callable, Tuple, Optional, Iterable, Mapping, Sequence
from unittest.mock import patch, MagicMock
from django.conf import settings
from django.http import HttpResponse
import zerver.lib.openapi as openapi
@ -315,7 +313,7 @@ so maybe we shouldn't mark it as intentionally undocumented in the urls.
E.g. typing.Union[typing.List[typing.Dict[str, typing.Any]], NoneType]
needs to be mapped to list."""
if sys.version_info < (3, 6) and type(t) == typing.UnionMeta: # nocoverage # in python3.6+
if sys.version_info < (3, 6) and type(t) is type(Union): # nocoverage # in python3.6+
origin = Union
else: # nocoverage # in python3.5. I.E. this is used in python3.6+
origin = getattr(t, "__origin__", None)
@ -456,7 +454,7 @@ do not match the types declared in the implementation of {}.\n""".format(functio
in code.
"""
urlconf = __import__(getattr(settings, "ROOT_URLCONF"), {}, {}, [''])
import zproject.urls as urlconf
# We loop through all the API patterns, looking in particular
# for those using the rest_dispatch decorator; we then parse

View File

@ -295,8 +295,8 @@ class TestServiceBotStateHandler(ZulipTestCase):
self.assertEqual(result.json()['storage'], updated_dict)
# Assert errors on invalid requests.
params = { # type: ignore # Ignore 'incompatible type "str": "List[str]"; expected "str": "str"' for testing
'keys': ["This is a list, but should be a serialized string."]
params = {
'keys': ["This is a list, but should be a serialized string."] # type: ignore # Ignore 'incompatible type "str": "List[str]"; expected "str": "str"' for testing
}
result = self.client_get('/json/bot_storage', params)
self.assert_json_error(result, 'Argument "keys" is not valid JSON.')