mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
Fixes #2665. Regenerated by tabbott with `lint --fix` after a rebase and change in parameters. Note from tabbott: In a few cases, this converts technical debt in the form of unsorted imports into different technical debt in the form of our largest files having very long, ugly import sequences at the start. I expect this change will increase pressure for us to split those files, which isn't a bad thing. Signed-off-by: Anders Kaseorg <anders@zulip.com>
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union
|
|
|
|
from django.http import HttpResponse
|
|
from typing_extensions import TypedDict
|
|
|
|
ViewFuncT = TypeVar('ViewFuncT', bound=Callable[..., HttpResponse])
|
|
|
|
# See zerver/lib/validator.py for more details of Validators,
|
|
# including many examples
|
|
Validator = Callable[[str, object], Optional[str]]
|
|
ExtendedValidator = Callable[[str, str, object], Optional[str]]
|
|
RealmUserValidator = Callable[[int, List[int], bool], Optional[str]]
|
|
|
|
ProfileDataElement = TypedDict('ProfileDataElement', {
|
|
'id': int,
|
|
'name': str,
|
|
'type': int,
|
|
'hint': Optional[str],
|
|
'field_data': Optional[str],
|
|
'order': int,
|
|
'value': str,
|
|
'rendered_value': Optional[str],
|
|
}, total=False) # TODO: Can we remove this requirement?
|
|
ProfileData = List[ProfileDataElement]
|
|
|
|
FieldElement = Tuple[int, str, Validator, Callable[[Any], Any], str]
|
|
ExtendedFieldElement = Tuple[int, str, ExtendedValidator, Callable[[Any], Any], str]
|
|
UserFieldElement = Tuple[int, str, RealmUserValidator, Callable[[Any], Any], str]
|
|
|
|
ProfileFieldData = Dict[str, Union[Dict[str, str], str]]
|
|
|
|
class UserDisplayRecipient(TypedDict):
|
|
email: str
|
|
full_name: str
|
|
short_name: str
|
|
id: int
|
|
is_mirror_dummy: bool
|
|
DisplayRecipientT = Union[str, List[UserDisplayRecipient]]
|