mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 00:18:12 +00:00
ruff: Fix UP006 Use list instead of List for type annotation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
c2214b3904
commit
e08a24e47f
@@ -1,6 +1,6 @@
|
||||
import time
|
||||
from functools import wraps
|
||||
from typing import Any, Callable, Dict, List, Literal, Union
|
||||
from typing import Any, Callable, Literal, Union
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
@@ -25,7 +25,7 @@ class DraftData(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
type: Literal["private", "stream", ""]
|
||||
to: List[int]
|
||||
to: list[int]
|
||||
topic: str
|
||||
content: Annotated[str, RequiredStringConstraint()]
|
||||
timestamp: Union[int, float, None] = None
|
||||
@@ -33,7 +33,7 @@ class DraftData(BaseModel):
|
||||
|
||||
def further_validated_draft_dict(
|
||||
draft_dict: DraftData, user_profile: UserProfile
|
||||
) -> Dict[str, Any]:
|
||||
) -> dict[str, Any]:
|
||||
"""Take a DraftData object that was already validated by the @typed_endpoint
|
||||
decorator then further sanitize, validate, and transform it.
|
||||
Ultimately return this "further validated" draft dict.
|
||||
@@ -96,7 +96,7 @@ def draft_endpoint(
|
||||
return draft_view_func
|
||||
|
||||
|
||||
def do_create_drafts(drafts: List[DraftData], user_profile: UserProfile) -> List[Draft]:
|
||||
def do_create_drafts(drafts: list[DraftData], user_profile: UserProfile) -> list[Draft]:
|
||||
"""Create drafts in bulk for a given user based on the DraftData objects. Since
|
||||
currently, the only place this method is being used (apart from tests) is from
|
||||
the create_draft view, we assume that these are syntactically valid
|
||||
|
||||
Reference in New Issue
Block a user