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:
Zixuan James Li
2022-09-19 15:43:34 -04:00
committed by Tim Abbott
parent df18bbbd48
commit a4eaa770f0
6 changed files with 23 additions and 45 deletions

View File

@@ -1,5 +1,5 @@
import datetime
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Set
from typing import Any, Dict, Iterable, List, Optional, Set
from django.conf import settings
from django.db import transaction
@@ -8,6 +8,7 @@ from django.utils.timezone import now as timezone_now
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
from django.utils.translation import override as override_language
from django_stubs_ext import StrPromise
from zerver.actions.message_delete import DeleteMessagesEvent
from zerver.actions.message_flags import do_update_mobile_push_notification
@@ -65,9 +66,6 @@ from zerver.models import (
)
from zerver.tornado.django_api import send_event
if TYPE_CHECKING:
from django.utils.functional import _StrPromise as StrPromise
def subscriber_info(user_id: int) -> Dict[str, Any]:
return {"id": user_id, "flags": ["read"]}
@@ -200,10 +198,10 @@ def send_message_moved_breadcrumbs(
user_profile: UserProfile,
old_stream: Stream,
old_topic: str,
old_thread_notification_string: Optional["StrPromise"],
old_thread_notification_string: Optional[StrPromise],
new_stream: Stream,
new_topic: Optional[str],
new_thread_notification_string: Optional["StrPromise"],
new_thread_notification_string: Optional[StrPromise],
changed_messages_count: int,
) -> None:
# Since moving content between streams is highly disruptive,