ruff: Fix UP006 Use list instead of List for type annotation.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-07-11 17:30:17 -07:00
committed by Tim Abbott
parent c2214b3904
commit e08a24e47f
457 changed files with 3588 additions and 3857 deletions

View File

@@ -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