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

@@ -3,7 +3,7 @@ import subprocess
import sys
import time
from contextlib import ExitStack, contextmanager
from typing import Iterator, Optional
from typing import Iterator
# Verify the Zulip venv is available.
from tools.lib import sanity_check
@@ -32,7 +32,7 @@ def set_up_django(external_host: str) -> None:
os.environ["PYTHONUNBUFFERED"] = "y"
def assert_server_running(server: "subprocess.Popen[bytes]", log_file: Optional[str]) -> None:
def assert_server_running(server: "subprocess.Popen[bytes]", log_file: str | None) -> None:
"""Get the exit code of the server, or None if it is still running."""
if server.poll() is not None:
message = "Server died unexpectedly!"
@@ -41,7 +41,7 @@ def assert_server_running(server: "subprocess.Popen[bytes]", log_file: Optional[
raise RuntimeError(message)
def server_is_up(server: "subprocess.Popen[bytes]", log_file: Optional[str]) -> bool:
def server_is_up(server: "subprocess.Popen[bytes]", log_file: str | None) -> bool:
assert_server_running(server, log_file)
try:
# We could get a 501 error if the reverse proxy is up but the Django app isn't.
@@ -55,7 +55,7 @@ def server_is_up(server: "subprocess.Popen[bytes]", log_file: Optional[str]) ->
def test_server_running(
skip_provision_check: bool = False,
external_host: str = "testserver",
log_file: Optional[str] = None,
log_file: str | None = None,
dots: bool = False,
) -> Iterator[None]:
with ExitStack() as stack: