mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
ruff: Fix UP033 Use @functools.cache.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
fd970e0520
commit
a82a3eb4d7
@@ -14,7 +14,7 @@ import subprocess
|
||||
import tempfile
|
||||
from contextlib import suppress
|
||||
from datetime import datetime
|
||||
from functools import lru_cache
|
||||
from functools import cache
|
||||
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Set, Tuple, TypedDict
|
||||
|
||||
import orjson
|
||||
@@ -2232,7 +2232,7 @@ def chunkify(lst: List[int], chunk_size: int) -> List[List[int]]:
|
||||
def export_messages_single_user(
|
||||
user_profile: UserProfile, *, output_dir: Path, reaction_message_ids: Set[int]
|
||||
) -> None:
|
||||
@lru_cache(maxsize=None)
|
||||
@cache
|
||||
def get_recipient(recipient_id: int) -> str:
|
||||
recipient = Recipient.objects.get(id=recipient_id)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import logging
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from email.headerregistry import Address
|
||||
from functools import lru_cache
|
||||
from functools import cache
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
@@ -162,7 +162,7 @@ def has_apns_credentials() -> bool:
|
||||
return settings.APNS_TOKEN_KEY_FILE is not None or settings.APNS_CERT_FILE is not None
|
||||
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
@cache
|
||||
def get_apns_context() -> Optional[APNsContext]:
|
||||
# We lazily do this import as part of optimizing Zulip's base
|
||||
# import time.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from functools import lru_cache
|
||||
from functools import cache
|
||||
from typing import Dict
|
||||
|
||||
from scripts.lib.zulip_tools import get_tzdata_zi
|
||||
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
@cache
|
||||
def get_canonical_timezone_map() -> Dict[str, str]:
|
||||
canonical = {}
|
||||
with get_tzdata_zi() as f:
|
||||
|
||||
@@ -9,7 +9,7 @@ import traceback
|
||||
import uuid
|
||||
from collections import deque
|
||||
from contextlib import suppress
|
||||
from functools import lru_cache
|
||||
from functools import cache
|
||||
from typing import (
|
||||
AbstractSet,
|
||||
Any,
|
||||
@@ -1110,7 +1110,7 @@ def process_message_event(
|
||||
recipient_type_name: str = wide_dict["type"]
|
||||
sending_client: str = wide_dict["client"]
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
@cache
|
||||
def get_client_payload(
|
||||
apply_markdown: bool, client_gravatar: bool, can_access_sender: bool
|
||||
) -> Dict[str, Any]:
|
||||
|
||||
Reference in New Issue
Block a user