python: Add missing TypeAlias annotations.

See commit c2c96eb0cf (#26405).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-04-01 14:16:52 -07:00 committed by Anders Kaseorg
parent 9e7bf865cd
commit ae47de36c9
3 changed files with 7 additions and 4 deletions

View File

@ -76,7 +76,7 @@ ZilencerConfirmationObjT: TypeAlias = Union[
"PreregistrationRemoteRealmBillingUser", "PreregistrationRemoteRealmBillingUser",
] ]
ConfirmationObjT = Union[NoZilencerConfirmationObjT, ZilencerConfirmationObjT] ConfirmationObjT: TypeAlias = Union[NoZilencerConfirmationObjT, ZilencerConfirmationObjT]
def get_object_from_key( def get_object_from_key(

View File

@ -15,6 +15,7 @@ from django.utils.translation import get_language
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from pydantic import Json from pydantic import Json
from typing_extensions import TypeAlias
from confirmation.models import ( from confirmation.models import (
Confirmation, Confirmation,
@ -71,7 +72,9 @@ billing_logger = logging.getLogger("corporate.stripe")
VALID_NEXT_PAGES = [None, "sponsorship", "upgrade", "billing", "plans", "deactivate"] 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 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 # We use units of hours here so that we can pass this through to the

View File

@ -6,7 +6,7 @@ from django.http import HttpRequest, HttpResponse
from pydantic import BaseModel, ConfigDict, Json, StringConstraints, ValidationInfo, WrapValidator from pydantic import BaseModel, ConfigDict, Json, StringConstraints, ValidationInfo, WrapValidator
from pydantic.dataclasses import dataclass from pydantic.dataclasses import dataclass
from pydantic.functional_validators import ModelWrapValidatorHandler 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.exceptions import ApiParamValidationError, JsonableError
from zerver.lib.request import RequestConfusingParamsError, RequestVariableMissingError 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.lib.validator import WildValue, check_bool
from zerver.models import UserProfile from zerver.models import UserProfile
ParamTypes = Literal["none", "json_only", "both"] ParamTypes: TypeAlias = Literal["none", "json_only", "both"]
T = TypeVar("T") T = TypeVar("T")