mirror of
https://github.com/zulip/zulip.git
synced 2025-10-28 10:33:54 +00:00
typing: Broaden type annotations for QuerySet compatibility.
To explain the rationale of this change, for example, there is `get_user_activity_summary` which accepts either a `Collection[UserActivity]`, where `QuerySet[T]` is not strictly `Sequence[T]` because its slicing behavior is different from the `Protocol`, making `Collection` necessary. Similarily, we should have `Iterable[T]` instead of `List[T]` so that `QuerySet[T]` will also be an acceptable subtype, or `Sequence[T]` when we also expect it to be indexed. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
committed by
Tim Abbott
parent
40fcf5a633
commit
ab1bbdda65
@@ -7,7 +7,7 @@ from email.headerregistry import Address
|
||||
from email.parser import Parser
|
||||
from email.policy import default
|
||||
from email.utils import formataddr, parseaddr
|
||||
from typing import Any, Dict, List, Mapping, Optional, Sequence, Tuple, Union
|
||||
from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union
|
||||
|
||||
import backoff
|
||||
import orjson
|
||||
@@ -497,7 +497,7 @@ def get_header(option: Optional[str], header: Optional[str], name: str) -> str:
|
||||
|
||||
|
||||
def send_custom_email(
|
||||
users: List[UserProfile], *, target_emails: Sequence[str] = [], options: Dict[str, Any]
|
||||
users: Iterable[UserProfile], *, target_emails: Sequence[str] = [], options: Dict[str, Any]
|
||||
) -> None:
|
||||
"""
|
||||
Helper for `manage.py send_custom_email`.
|
||||
|
||||
Reference in New Issue
Block a user