Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

python: Add missing TypeAlias annotations.

Anders Kaseorgae47de36c9af
diff --git a/confirmation/models.py b/confirmation/models.py
index 5409e7637f0..fdb343f8e4f 100644
--- a/confirmation/models.py
+++ b/confirmation/models.py
@@ -76,7 +76,7 @@ ZilencerConfirmationObjT: TypeAlias = Union[
"PreregistrationRemoteRealmBillingUser",
]
-ConfirmationObjT = Union[NoZilencerConfirmationObjT, ZilencerConfirmationObjT]
+ConfirmationObjT: TypeAlias = Union[NoZilencerConfirmationObjT, ZilencerConfirmationObjT]
def get_object_from_key(
diff --git a/corporate/views/remote_billing_page.py b/corporate/views/remote_billing_page.py
index 124c70fd671..41bda0279b2 100644
--- a/corporate/views/remote_billing_page.py
+++ b/corporate/views/remote_billing_page.py
@@ -15,6 +15,7 @@ from django.utils.translation import get_language
from django.utils.translation import gettext as _
from django.views.decorators.csrf import csrf_exempt
from pydantic import Json
+from typing_extensions import TypeAlias
from confirmation.models import (
Confirmation,
@@ -71,7 +72,9 @@ billing_logger = logging.getLogger("corporate.stripe")
VALID_NEXT_PAGES = [None, "sponsorship", "upgrade", "billing", "plans", "deactivate"]
-VALID_NEXT_PAGES_TYPE = Literal[None, "sponsorship", "upgrade", "billing", "plans", "deactivate"]
+VALID_NEXT_PAGES_TYPE: TypeAlias = Literal[
+ None, "sponsorship", "upgrade", "billing", "plans", "deactivate"
+]
REMOTE_BILLING_SIGNED_ACCESS_TOKEN_VALIDITY_IN_SECONDS = 2 * 60 * 60
# We use units of hours here so that we can pass this through to the
diff --git a/zerver/tests/test_typed_endpoint.py b/zerver/tests/test_typed_endpoint.py
index d77c9fc147e..a0d9e719ed3 100644
--- a/zerver/tests/test_typed_endpoint.py
+++ b/zerver/tests/test_typed_endpoint.py
@@ -6,7 +6,7 @@ from django.http import HttpRequest, HttpResponse
from pydantic import BaseModel, ConfigDict, Json, StringConstraints, ValidationInfo, WrapValidator
from pydantic.dataclasses import dataclass
from pydantic.functional_validators import ModelWrapValidatorHandler
-from typing_extensions import Annotated, override
+from typing_extensions import Annotated, TypeAlias, override
from zerver.lib.exceptions import ApiParamValidationError, JsonableError
from zerver.lib.request import RequestConfusingParamsError, RequestVariableMissingError
@@ -26,7 +26,7 @@ from zerver.lib.typed_endpoint import (
from zerver.lib.validator import WildValue, check_bool
from zerver.models import UserProfile
-ParamTypes = Literal["none", "json_only", "both"]
+ParamTypes: TypeAlias = Literal["none", "json_only", "both"]
T = TypeVar("T")