mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +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
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
from argparse import ArgumentParser
|
||||
from typing import Any, List
|
||||
from typing import Any, Collection
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import CommandError
|
||||
@@ -18,7 +18,7 @@ log_to_file(logger, settings.LDAP_SYNC_LOG_PATH)
|
||||
# Run this on a cron job to pick up on name changes.
|
||||
@transaction.atomic
|
||||
def sync_ldap_user_data(
|
||||
user_profiles: List[UserProfile], deactivation_protection: bool = True
|
||||
user_profiles: Collection[UserProfile], deactivation_protection: bool = True
|
||||
) -> None:
|
||||
logger.info("Starting update.")
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user