Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
models: Fix type annotation with StrPromise.
Zixuan James Liab9279aabe4b
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.pyindex 3bf7eed77c5..9a79dc7319e 100644--- a/zerver/lib/integrations.py+++ b/zerver/lib/integrations.py@@ -1,15 +1,17 @@import osfrom dataclasses import dataclass, field-from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple+from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence, Tuplefrom django.contrib.staticfiles.storage import staticfiles_storagefrom django.urls import URLResolver, path-from django.utils.functional import Promisefrom django.utils.module_loading import import_stringfrom django.utils.translation import gettext_lazyfrom zerver.lib.storage import static_path+if TYPE_CHECKING:+ from django.utils.functional import _StrPromise as StrPromise+"""This module declares all of the (documented) integrations availablein the Zulip server. The Integration class is used as part ofgenerating the documentation on the /integrations page, while the@@ -31,7 +33,7 @@ features for writing and configuring integrations efficiently.OptionValidator = Callable[[str, str], Optional[str]]-CATEGORIES: Dict[str, Promise] = {+CATEGORIES: Dict[str, "StrPromise"] = {"meta-integration": gettext_lazy("Integration frameworks"),"continuous-integration": gettext_lazy("Continuous integration"),"customer-support": gettext_lazy("Customer support"),diff --git a/zerver/models.py b/zerver/models.pyindex ffff63ada36..9fe2ca32029 100644--- a/zerver/models.py+++ b/zerver/models.py@@ -46,7 +46,6 @@ from django.db.models.functions import Upperfrom django.db.models.query import QuerySetfrom django.db.models.signals import post_delete, post_save, pre_deletefrom django.db.models.sql.compiler import SQLCompiler-from django.utils.functional import Promisefrom django.utils.timezone import now as timezone_nowfrom django.utils.translation import gettext as _from django.utils.translation import gettext_lazy@@ -120,6 +119,7 @@ if TYPE_CHECKING:# We use ModelBackend only for typing. Importing it otherwise causes circular dependency.from django.contrib.auth.backends import ModelBackendfrom django.db.models.query import _QuerySet as ValuesQuerySet+ from django.utils.functional import _StrPromise as StrPromiseclass EmojiInfo(TypedDict):@@ -2452,7 +2452,7 @@ class Stream(models.Model):# Who in the organization has permission to send messages to this stream.stream_post_policy: int = models.PositiveSmallIntegerField(default=STREAM_POST_POLICY_EVERYONE)- POST_POLICIES: Dict[int, str] = {+ POST_POLICIES: Dict[int, "StrPromise"] = {# These strings should match the strings in the# stream_post_policy_values object in stream_data.js.STREAM_POST_POLICY_EVERYONE: gettext_lazy("All stream members can post"),