mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
types: Define UserDisplayRecipient type using TypedDict.
Since the display_recipients dictionaries corresponding to users are always dictionaries with keys email, full_name, short_name, id, is_mirror_dummy - instead of using the overly general Dict[str, Any] type, we can define a UserDisplayRecipient type, using an appropriate TypedDict. The type definitions are moved from display_recipient.py to types.py, so that they can be imported in models.py. Appropriate type adjustments are made in various places in the code where we operate on display_recipients.
This commit is contained in:
committed by
Tim Abbott
parent
c779bb1959
commit
3ba0a37a92
@@ -27,3 +27,7 @@ ExtendedFieldElement = Tuple[int, str, ExtendedValidator, Callable[[Any], Any],
|
||||
UserFieldElement = Tuple[int, str, RealmUserValidator, Callable[[Any], Any], str]
|
||||
|
||||
ProfileFieldData = Dict[str, Union[Dict[str, str], str]]
|
||||
|
||||
UserDisplayRecipient = TypedDict('UserDisplayRecipient', {'email': str, 'full_name': str, 'short_name': str,
|
||||
'id': int, 'is_mirror_dummy': bool})
|
||||
DisplayRecipientCacheT = Union[str, List[UserDisplayRecipient]]
|
||||
|
||||
Reference in New Issue
Block a user