Repository: zulip/zulip

Issue:
Upgrade mypy to 0.560
There's a new mypy release!
http://mypy-lang.blogspot.com/2017/12/mypy-0560-released.html

It'd be cool to upgrade -- I don't think the headline feature matters to us, but this sounds pretty neat:
> Speed improvements in incremental mode

and there are several improvements in error messages, and bugfixes, that will be nice improvements to the experience.

@neiljp , would you be up for doing this upgrade?



Discussion:
Hello @zulip/server-tooling members, this issue was labeled with the **area: tooling** label, so you may want to check it out!

<!-- areaLabelNotification -->
@gnprice I'd like to, but on my personal system the tools are rather demanding (wrt root) and my disk is rather small; this seems like the appropriate time to re-request a droplet? I think mine was destroyed at the end of PyCon.
(I appreciate the desire to operate in a consistent dev environment to run the tools, but it'd be useful to not require this)
@neiljp Yeah, you'd definitely be quite welcome to a new droplet!

Just make a request in chat per the instructions at https://zulip.readthedocs.io/en/latest/development/request-remote.html , and someone will set you up.

For the broader question of how the dev environment is designed, I think it'd be tough to have a full dev environment (with database, rabbitmq, etc.) without installing system software. And I think it's pretty uncommon for people to be doing development on Zulip and not need a dev environment where the app can actually run. So it probably makes sense for us to keep handling those situations with our current strategy of liberally providing remote dev VMs.

@zulipbot claim

Resolving patch:
diff --git a/version.py b/version.py
--- a/version.py
+++ b/version.py
@@ -1,3 +1,3 @@
 ZULIP_VERSION = "1.7.1+git"
 
-PROVISION_VERSION = '14.2'
+PROVISION_VERSION = '14.3'
diff --git a/zerver/lib/email_mirror.py b/zerver/lib/email_mirror.py
--- a/zerver/lib/email_mirror.py
+++ b/zerver/lib/email_mirror.py
@@ -1,9 +1,9 @@
-from typing import Any, Dict, List, Optional, Text
+from typing import Any, Dict, List, Optional, Text, Union
 
 import logging
 import re
 
-from email.header import decode_header
+from email.header import decode_header, Header
 import email.message as message
 
 from django.conf import settings
@@ -284,7 +284,7 @@ def find_emailgateway_recipient(message: message.Message) -> Text:
     # it is more accurate, so try to find the most-accurate
     # recipient list in descending priority order
     recipient_headers = ["X-Gm-Original-To", "Delivered-To", "To"]
-    recipients = []  # type: List[Text]
+    recipients = []  # type: List[Union[Text, Header]]
     for recipient_header in recipient_headers:
         r = message.get_all(recipient_header, None)
         if r:
@@ -293,7 +293,7 @@ def find_emailgateway_recipient(message: message.Message) -> Text:
 
     pattern_parts = [re.escape(part) for part in settings.EMAIL_GATEWAY_PATTERN.split('%s')]
     match_email_re = re.compile(".*?".join(pattern_parts))
-    for recipient_email in recipients:
+    for recipient_email in [str(recipient) for recipient in recipients]:
         if match_email_re.match(recipient_email):
             return recipient_email
 


Test patch: