ruff: Fix UP007 Use X | Y for type annotations.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-07-11 17:30:23 -07:00
committed by Tim Abbott
parent e08a24e47f
commit 531b34cb4c
355 changed files with 2759 additions and 3029 deletions

View File

@@ -1,5 +1,5 @@
# Webhooks for external integrations.
from typing import Callable, Optional
from typing import Callable
from django.http import HttpRequest, HttpResponse
@@ -45,7 +45,7 @@ def ticket_started_body(payload: WildValue) -> str:
)
def ticket_assigned_body(payload: WildValue) -> Optional[str]:
def ticket_assigned_body(payload: WildValue) -> str | None:
state = payload["state"].tame(check_string)
kwargs = {
"state": "open" if state == "opened" else state,
@@ -90,7 +90,7 @@ def replied_body(actor: str, action: str, payload: WildValue) -> str:
return body
EVENTS_FUNCTION_MAPPER: dict[str, Callable[[WildValue], Optional[str]]] = {
EVENTS_FUNCTION_MAPPER: dict[str, Callable[[WildValue], str | None]] = {
"ticket_started": ticket_started_body,
"ticket_assigned": ticket_assigned_body,
"agent_replied": partial(replied_body, "agent", "replied to"),