mirror of https://github.com/zulip/zulip.git
mypy: Use TypedDict for UnreadMessageResult.
This commit is contained in:
parent
0519bade1b
commit
0106add546
|
@ -1,6 +1,9 @@
|
||||||
# Django itself; we use a slightly patched version
|
# Django itself; we use a slightly patched version
|
||||||
Django==1.11.4
|
Django==1.11.4
|
||||||
|
|
||||||
|
# needed for mypy TypedDict
|
||||||
|
mypy_extensions==0.3.0
|
||||||
|
|
||||||
# Needed for rendering backend templates
|
# Needed for rendering backend templates
|
||||||
Jinja2==2.9.6
|
Jinja2==2.9.6
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ markdown==2.6.9 # via markdown-include
|
||||||
markupsafe==1.0
|
markupsafe==1.0
|
||||||
mock==2.0.0
|
mock==2.0.0
|
||||||
moto==1.0.1
|
moto==1.0.1
|
||||||
|
mypy_extensions==0.3.0
|
||||||
ndg-httpsclient==0.4.2
|
ndg-httpsclient==0.4.2
|
||||||
oauth2client==4.1.2
|
oauth2client==4.1.2
|
||||||
oauthlib==2.0.2
|
oauthlib==2.0.2
|
||||||
|
|
|
@ -52,6 +52,7 @@ markdown-include==0.5.1
|
||||||
markdown==2.6.9 # via markdown-include
|
markdown==2.6.9 # via markdown-include
|
||||||
markupsafe==1.0
|
markupsafe==1.0
|
||||||
mock==2.0.0
|
mock==2.0.0
|
||||||
|
mypy_extensions==0.3.0
|
||||||
ndg-httpsclient==0.4.2
|
ndg-httpsclient==0.4.2
|
||||||
oauth2client==4.1.2
|
oauth2client==4.1.2
|
||||||
oauthlib==2.0.2
|
oauthlib==2.0.2
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
ZULIP_VERSION = "1.6.0+git"
|
ZULIP_VERSION = "1.6.0+git"
|
||||||
PROVISION_VERSION = '9.5'
|
PROVISION_VERSION = '9.6'
|
||||||
|
|
|
@ -29,9 +29,18 @@ from zerver.models import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from typing import Any, Dict, List, Optional, Set, Tuple, Text, Union
|
from typing import Any, Dict, List, Optional, Set, Tuple, Text, Union
|
||||||
|
from mypy_extensions import TypedDict
|
||||||
|
|
||||||
RealmAlertWords = Dict[int, List[Text]]
|
RealmAlertWords = Dict[int, List[Text]]
|
||||||
|
|
||||||
|
UnreadMessagesResult = TypedDict('UnreadMessagesResult', {
|
||||||
|
'pms': List[Dict[str, Any]],
|
||||||
|
'streams': List[Dict[str, Any]],
|
||||||
|
'huddles': List[Dict[str, Any]],
|
||||||
|
'mentions': List[int],
|
||||||
|
'count': int,
|
||||||
|
})
|
||||||
|
|
||||||
MAX_UNREAD_MESSAGES = 5000
|
MAX_UNREAD_MESSAGES = 5000
|
||||||
|
|
||||||
def extract_message_dict(message_bytes):
|
def extract_message_dict(message_bytes):
|
||||||
|
@ -413,7 +422,7 @@ def get_muted_recipient_ids(user_profile):
|
||||||
return muted_recipient_ids
|
return muted_recipient_ids
|
||||||
|
|
||||||
def get_unread_message_ids_per_recipient(user_profile):
|
def get_unread_message_ids_per_recipient(user_profile):
|
||||||
# type: (UserProfile) -> Dict[str, Any]
|
# type: (UserProfile) -> UnreadMessagesResult
|
||||||
|
|
||||||
excluded_recipient_ids = get_inactive_recipient_ids(user_profile)
|
excluded_recipient_ids = get_inactive_recipient_ids(user_profile)
|
||||||
|
|
||||||
|
@ -510,8 +519,7 @@ def get_unread_message_ids_per_recipient(user_profile):
|
||||||
streams=stream_objects,
|
streams=stream_objects,
|
||||||
huddles=huddle_objects,
|
huddles=huddle_objects,
|
||||||
mentions=mentioned_message_ids,
|
mentions=mentioned_message_ids,
|
||||||
count=count,
|
count=count) # type: UnreadMessagesResult
|
||||||
)
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue