mypy: Fix various errors caught by removing cache_with_key.

This commit is contained in:
Tim Abbott
2017-05-10 14:37:20 -07:00
parent e55b4b0d43
commit e8eaec0a18
4 changed files with 7 additions and 7 deletions

View File

@@ -688,7 +688,7 @@ def render_incoming_message(message, content, message_users, realm):
return rendered_content
def get_recipient_user_profiles(recipient, sender_id):
# type: (Recipient, Text) -> List[UserProfile]
# type: (Recipient, int) -> List[UserProfile]
if recipient.type == Recipient.PERSONAL:
recipients = list(set([get_user_profile_by_id(recipient.type_id),
get_user_profile_by_id(sender_id)]))

View File

@@ -225,10 +225,10 @@ class CustomProfileDataTest(ZulipTestCase):
iago = get_user_profile_by_email('iago@zulip.com')
expected_value = {f['id']: f['value'] for f in data}
for field in iago.profile_data:
self.assertEqual(field['value'], expected_value[field['id']])
for field_dict in iago.profile_data:
self.assertEqual(field_dict['value'], expected_value[field_dict['id']])
for k in ['id', 'type', 'name']:
self.assertIn(k, field)
self.assertIn(k, field_dict)
self.assertEqual(len(iago.profile_data), 4)

View File

@@ -463,7 +463,7 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
# type: () -> None
def create_user(email):
# type: (Text) -> None
# type: (Text) -> UserProfile
self.register(email, 'test')
return get_user_profile_by_email(email)

View File

@@ -1,5 +1,5 @@
from __future__ import absolute_import
from typing import Text, Union, Optional, Dict, Any, List, Tuple
from typing import Callable, Text, Union, Optional, Dict, Any, List, Tuple
import os
import simplejson as json
@@ -120,7 +120,7 @@ def avatar(request, email_or_id, medium=False):
try:
int(email_or_id)
except ValueError:
get_user_func = get_user_profile_by_email
get_user_func = get_user_profile_by_email # type: Callable[..., UserProfile]
else:
get_user_func = get_user_profile_by_id