mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
ruff: Fix UP007 Use X | Y for type annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
e08a24e47f
commit
531b34cb4c
@@ -6,7 +6,6 @@ import traceback
|
||||
from contextlib import suppress
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from logging import Logger
|
||||
from typing import Optional, Union
|
||||
|
||||
import orjson
|
||||
from django.conf import settings
|
||||
@@ -120,7 +119,7 @@ class RequireReallyDeployed(logging.Filter):
|
||||
return settings.PRODUCTION
|
||||
|
||||
|
||||
def find_log_caller_module(record: logging.LogRecord) -> Optional[str]:
|
||||
def find_log_caller_module(record: logging.LogRecord) -> str | None:
|
||||
"""Find the module name corresponding to where this record was logged.
|
||||
|
||||
Sadly `record.module` is just the innermost component of the full
|
||||
@@ -224,7 +223,7 @@ class ZulipWebhookFormatter(ZulipFormatter):
|
||||
|
||||
@override
|
||||
def format(self, record: logging.LogRecord) -> str:
|
||||
request: Optional[HttpRequest] = getattr(record, "request", None)
|
||||
request: HttpRequest | None = getattr(record, "request", None)
|
||||
if request is None:
|
||||
record.user = None
|
||||
record.client = None
|
||||
@@ -235,7 +234,7 @@ class ZulipWebhookFormatter(ZulipFormatter):
|
||||
return super().format(record)
|
||||
|
||||
if request.content_type == "application/json":
|
||||
payload: Union[str, bytes] = request.body
|
||||
payload: str | bytes = request.body
|
||||
else:
|
||||
payload = request.POST["payload"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user