mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
typing: Import StrPromise alias from django_stubs_ext.
This saves us from using a conditional import. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
committed by
Tim Abbott
parent
df18bbbd48
commit
a4eaa770f0
@@ -1,23 +1,10 @@
|
||||
import datetime
|
||||
from dataclasses import dataclass
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
TypedDict,
|
||||
TypeVar,
|
||||
Union,
|
||||
)
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, TypedDict, TypeVar, Union
|
||||
|
||||
from django_stubs_ext import StrPromise
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.utils.functional import _StrPromise as StrPromise
|
||||
|
||||
# See zerver/lib/validator.py for more details of Validators,
|
||||
# including many examples
|
||||
ResultT = TypeVar("ResultT")
|
||||
@@ -51,11 +38,9 @@ class ProfileDataElementUpdateDict(TypedDict):
|
||||
|
||||
ProfileData = List[ProfileDataElement]
|
||||
|
||||
FieldElement = Tuple[
|
||||
int, "StrPromise", Validator[ProfileDataElementValue], Callable[[Any], Any], str
|
||||
]
|
||||
ExtendedFieldElement = Tuple[int, "StrPromise", ExtendedValidator, Callable[[Any], Any], str]
|
||||
UserFieldElement = Tuple[int, "StrPromise", RealmUserValidator, Callable[[Any], Any], str]
|
||||
FieldElement = Tuple[int, StrPromise, Validator[ProfileDataElementValue], Callable[[Any], Any], str]
|
||||
ExtendedFieldElement = Tuple[int, StrPromise, ExtendedValidator, Callable[[Any], Any], str]
|
||||
UserFieldElement = Tuple[int, StrPromise, RealmUserValidator, Callable[[Any], Any], str]
|
||||
|
||||
ProfileFieldData = Dict[str, Union[Dict[str, str], str]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user