Fix several new errors caught by mypy 0.501.

Clear out a bunch of easy to review errors, so we can focus on the more
complicated ones.
This commit is contained in:
Rishi Gupta
2017-03-03 11:30:49 -08:00
parent 024168d85d
commit 28d3af0965
15 changed files with 22 additions and 13 deletions

View File

@@ -194,20 +194,22 @@ def make_client(name):
return client
def find_key_by_email(address):
# type: (Text) -> Text
# type: (Text) -> Optional[Text]
from django.core.mail import outbox
key_regex = re.compile("accounts/do_confirm/([a-f0-9]{40})>")
for message in reversed(outbox):
if address in message.to:
return key_regex.search(message.body).groups()[0]
return None
def find_pattern_in_email(address, pattern):
# type: (Text, Text) -> Text
# type: (Text, Text) -> Optional[Text]
from django.core.mail import outbox
key_regex = re.compile(pattern)
for message in reversed(outbox):
if address in message.to:
return key_regex.search(message.body).group(0)
return None
def message_ids(result):
# type: (Dict[str, Any]) -> Set[int]