ruff: Fix UP036 Version block is outdated for minimum Python version.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-04-01 15:29:38 -07:00 committed by Tim Abbott
parent a82a3eb4d7
commit 6e871e7731
7 changed files with 8 additions and 38 deletions

View File

@ -19,6 +19,8 @@ from datetime import datetime, timedelta
from typing import IO, Any, Dict, List, Optional, Sequence, Set, Union, overload
from urllib.parse import SplitResult
import zoneinfo
DEPLOYMENTS_DIR = "/home/zulip/deployments"
LOCK_DIR = os.path.join(DEPLOYMENTS_DIR, "lock")
TIMESTAMP_FORMAT = "%Y-%m-%d-%H-%M-%S"
@ -470,11 +472,6 @@ def os_families() -> Set[str]:
def get_tzdata_zi() -> IO[str]:
if sys.version_info < (3, 9): # nocoverage
from backports import zoneinfo
else: # nocoverage
import zoneinfo
for path in zoneinfo.TZPATH:
filename = os.path.join(path, "tzdata.zi")
if os.path.exists(filename):

View File

@ -3,9 +3,6 @@ import json
import os
import sys
if sys.version_info < (3, 9):
from backports import zoneinfo
else:
import zoneinfo
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../")

View File

@ -12,6 +12,7 @@ from email.headerregistry import Address
from typing import Any, Dict, List, Optional, Tuple, Union
import lxml.html
import zoneinfo
from bs4 import BeautifulSoup
from django.conf import settings
from django.contrib.auth import get_backends
@ -42,11 +43,6 @@ from zerver.models.messages import get_context_for_message
from zerver.models.scheduled_jobs import NotificationTriggers
from zerver.models.users import get_user_profile_by_id
if sys.version_info < (3, 9): # nocoverage
from backports import zoneinfo
else: # nocoverage
import zoneinfo
logger = logging.getLogger(__name__)

View File

@ -29,7 +29,6 @@ for any particular type of object.
"""
import re
import sys
from dataclasses import dataclass
from datetime import datetime, timezone
from decimal import Decimal
@ -52,6 +51,7 @@ from typing import (
)
import orjson
import zoneinfo
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator, validate_email
from django.utils.translation import gettext as _
@ -63,11 +63,6 @@ from zerver.lib.exceptions import InvalidJSONError, JsonableError
from zerver.lib.timezone import canonicalize_timezone
from zerver.lib.types import ProfileFieldData, Validator
if sys.version_info < (3, 9): # nocoverage
from backports import zoneinfo
else: # nocoverage
import zoneinfo
ResultT = TypeVar("ResultT")

View File

@ -1,6 +1,6 @@
import sys
from typing import Any, Optional
import zoneinfo
from django.conf import settings
from django.contrib.auth.signals import user_logged_in, user_logged_out
from django.dispatch import receiver
@ -14,11 +14,6 @@ from zerver.lib.send_email import FromAddress
from zerver.lib.timezone import canonicalize_timezone
from zerver.models import UserProfile
if sys.version_info < (3, 9): # nocoverage
from backports import zoneinfo
else: # nocoverage
import zoneinfo
JUST_CREATED_THRESHOLD = 60

View File

@ -1,8 +1,8 @@
import sys
from datetime import datetime, timedelta, timezone
from typing import Sequence
import time_machine
import zoneinfo
from django.conf import settings
from django.core import mail
from django.test import override_settings
@ -18,11 +18,6 @@ from zerver.models import Message, Realm, Recipient, Stream, UserProfile
from zerver.models.realms import get_realm
from zerver.signals import JUST_CREATED_THRESHOLD, get_device_browser, get_device_os
if sys.version_info < (3, 9): # nocoverage
from backports import zoneinfo
else: # nocoverage
import zoneinfo
class SendLoginEmailTest(ZulipTestCase):
"""

View File

@ -1,16 +1,11 @@
import sys
from datetime import datetime, timezone
import zoneinfo
from django.utils.timezone import now as timezone_now
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timezone import canonicalize_timezone, common_timezones
if sys.version_info < (3, 9): # nocoverage
from backports import zoneinfo
else: # nocoverage
import zoneinfo
class TimeZoneTest(ZulipTestCase):
def test_canonicalize_timezone(self) -> None: