Run pyupgrade to update the codebase to python 3.9

Gets rid of a lot of typing ugliness by using type annotations on
builtin types
This commit is contained in:
Kovid Goyal
2024-07-31 07:55:27 +05:30
parent 3aac62f6c7
commit f1d0d0949b
48 changed files with 593 additions and 602 deletions

View File

@@ -5,7 +5,7 @@ import os
import subprocess
import time
from contextlib import suppress
from typing import Dict, NamedTuple, Optional, Tuple
from typing import NamedTuple, Optional
from urllib.request import urlopen
from .config import atomic_save
@@ -55,7 +55,7 @@ def parse_line(line: str) -> Notification:
return Notification(v, float(timestamp), int(count))
def read_cache() -> Dict[Version, Notification]:
def read_cache() -> dict[Version, Notification]:
notified_versions = {}
with suppress(FileNotFoundError):
with open(version_notification_log()) as f:
@@ -68,7 +68,7 @@ def read_cache() -> Dict[Version, Notification]:
return notified_versions
def already_notified(version: Tuple[int, int, int]) -> bool:
def already_notified(version: tuple[int, int, int]) -> bool:
notified_versions = read_cache()
return version in notified_versions