1
0
forked from Mirrors/itch-dl

Upgrade to Python 3.10+

We can use fancier type annotations now, newer deps, more checkers.
This commit is contained in:
Ryszard Knop
2025-02-14 14:55:54 +01:00
parent d307ae8db7
commit cb08443778
8 changed files with 67 additions and 70 deletions

View File

@@ -1,11 +1,10 @@
import logging
from typing import Dict, List, Tuple
from .api import ItchApiClient
KEYS_CACHED: bool = False
DOWNLOAD_KEYS: Dict[int, str] = {}
GAME_URLS: List[str] = []
DOWNLOAD_KEYS: dict[int, str] = {}
GAME_URLS: list[str] = []
def load_keys_and_urls(client: ItchApiClient) -> None:
@@ -36,21 +35,21 @@ def load_keys_and_urls(client: ItchApiClient) -> None:
KEYS_CACHED = True
def get_owned_keys(client: ItchApiClient) -> Tuple[Dict[int, str], List[str]]:
def get_owned_keys(client: ItchApiClient) -> tuple[dict[int, str], list[str]]:
if not KEYS_CACHED:
load_keys_and_urls(client)
return DOWNLOAD_KEYS, GAME_URLS
def get_download_keys(client: ItchApiClient) -> Dict[int, str]:
def get_download_keys(client: ItchApiClient) -> dict[int, str]:
if not KEYS_CACHED:
load_keys_and_urls(client)
return DOWNLOAD_KEYS
def get_owned_games(client: ItchApiClient) -> List[str]:
def get_owned_games(client: ItchApiClient) -> list[str]:
if not KEYS_CACHED:
load_keys_and_urls(client)