mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +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
@@ -1,7 +1,6 @@
|
||||
import calendar
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpRequest
|
||||
@@ -39,7 +38,7 @@ class UserPermissionInfo:
|
||||
show_webathena: bool
|
||||
|
||||
|
||||
def get_furthest_read_time(user_profile: Optional[UserProfile]) -> Optional[float]:
|
||||
def get_furthest_read_time(user_profile: UserProfile | None) -> float | None:
|
||||
if user_profile is None:
|
||||
return time.time()
|
||||
|
||||
@@ -50,7 +49,7 @@ def get_furthest_read_time(user_profile: Optional[UserProfile]) -> Optional[floa
|
||||
return calendar.timegm(user_activity.last_visit.utctimetuple())
|
||||
|
||||
|
||||
def get_bot_types(user_profile: Optional[UserProfile]) -> list[dict[str, object]]:
|
||||
def get_bot_types(user_profile: UserProfile | None) -> list[dict[str, object]]:
|
||||
bot_types: list[dict[str, object]] = []
|
||||
if user_profile is None:
|
||||
return bot_types
|
||||
@@ -75,7 +74,7 @@ def promote_sponsoring_zulip_in_realm(realm: Realm) -> bool:
|
||||
return realm.plan_type in [Realm.PLAN_TYPE_STANDARD_FREE, Realm.PLAN_TYPE_SELF_HOSTED]
|
||||
|
||||
|
||||
def get_billing_info(user_profile: Optional[UserProfile]) -> BillingInfo:
|
||||
def get_billing_info(user_profile: UserProfile | None) -> BillingInfo:
|
||||
# See https://zulip.com/help/roles-and-permissions for clarity.
|
||||
show_billing = False
|
||||
show_plans = False
|
||||
@@ -114,7 +113,7 @@ def get_billing_info(user_profile: Optional[UserProfile]) -> BillingInfo:
|
||||
)
|
||||
|
||||
|
||||
def get_user_permission_info(user_profile: Optional[UserProfile]) -> UserPermissionInfo:
|
||||
def get_user_permission_info(user_profile: UserProfile | None) -> UserPermissionInfo:
|
||||
if user_profile is not None:
|
||||
return UserPermissionInfo(
|
||||
color_scheme=user_profile.color_scheme,
|
||||
@@ -135,12 +134,12 @@ def get_user_permission_info(user_profile: Optional[UserProfile]) -> UserPermiss
|
||||
|
||||
def build_page_params_for_home_page_load(
|
||||
request: HttpRequest,
|
||||
user_profile: Optional[UserProfile],
|
||||
user_profile: UserProfile | None,
|
||||
realm: Realm,
|
||||
insecure_desktop_app: bool,
|
||||
narrow: list[NarrowTerm],
|
||||
narrow_stream: Optional[Stream],
|
||||
narrow_topic_name: Optional[str],
|
||||
narrow_stream: Stream | None,
|
||||
narrow_topic_name: str | None,
|
||||
needs_tutorial: bool,
|
||||
) -> tuple[int, dict[str, object]]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user