mypy: Upgrade to new package name and version 0.571.

Fixes #3448.
This commit is contained in:
Tim Abbott 2017-02-10 18:18:39 -08:00
parent f944ac8902
commit bb5d81281c
6 changed files with 14 additions and 9 deletions

View File

@ -1,3 +1,3 @@
six==1.10.0
mypy-lang==0.4.6
mypy==0.471
typed-ast==0.6.1

View File

@ -93,7 +93,11 @@ if six.PY2 and os.path.exists(MYPY_VENV_PATH):
else:
mypy_command = "mypy"
extra_args = ["--fast-parser", "--silent-imports", "--check-untyped-defs", "--scripts-are-modules", "-i", "--cache-dir=var/mypy-cache"]
extra_args = ["--fast-parser",
"--silent-imports",
"--check-untyped-defs",
"--scripts-are-modules",
"-i", "--cache-dir=var/mypy-cache"]
if py_version == 2:
extra_args.append("--py2")
if args.linecoverage_report:

View File

@ -19,6 +19,6 @@ except IndexError:
''')
sys.exit(1)
p = pstats.Stats(fn)
p.strip_dirs().sort_stats('cumulative').print_stats(25)
p.strip_dirs().sort_stats('time').print_stats(25)
p = pstats.Stats(fn) # type: ignore # stats stubs are broken
p.strip_dirs().sort_stats('cumulative').print_stats(25) # type: ignore # stats stubs are broken
p.strip_dirs().sort_stats('time').print_stats(25) # type: ignore # stats stubs are broken

View File

@ -640,7 +640,7 @@ def profiled(func):
# type: (*Any, **Any) -> Any
fn = func.__name__ + ".profile"
prof = cProfile.Profile()
retval = prof.runcall(func, *args, **kwargs)
retval = prof.runcall(func, *args, **kwargs) # type: Any
prof.dump_stats(fn)
return retval
return wrapped_func # type: ignore # https://github.com/python/mypy/issues/1927

View File

@ -18,6 +18,7 @@ from boto.s3.key import Key
from boto.s3.connection import S3Connection
from mimetypes import guess_type, guess_extension
from zerver.lib.str_utils import force_bytes, force_str
from zerver.models import get_user_profile_by_email, get_user_profile_by_id
from zerver.models import Attachment
from zerver.models import Realm, UserProfile, Message
@ -152,7 +153,7 @@ def upload_image_to_s3(
else:
headers = None
key.set_contents_from_string(contents, headers=headers)
key.set_contents_from_string(force_str(contents), headers=headers)
def get_file_info(request, user_file):
# type: (HttpRequest, File) -> Tuple[Text, Optional[Text]]
@ -276,7 +277,7 @@ class S3UploadBackend(ZulipUploadBackend):
conn = S3Connection(settings.S3_KEY, settings.S3_SECRET_KEY)
bucket = get_bucket(conn, bucket_name)
key = bucket.get_key(email_hash)
image_data = key.get_contents_as_string()
image_data = force_bytes(key.get_contents_as_string())
resized_medium = resize_avatar(image_data, MEDIUM_AVATAR_SIZE)
upload_image_to_s3(

View File

@ -29,7 +29,7 @@ def environment(**options):
'minified_js': minified_js,
})
env.install_gettext_translations(translation, True)
env.install_gettext_translations(translation, True) # type: ignore # https://github.com/python/typeshed/issues/927
env.filters['slugify'] = slugify
env.filters['pluralize'] = pluralize