Skip to content

Commit

Permalink
Fix type annotations for older Python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiX committed Oct 30, 2023
1 parent af20ca7 commit 9163317
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dosagelib/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-FileCopyrightText: © 2015 Tobias Gruetzmacher
import os
import re
from typing import Any
from typing import Any, Dict, Optional, Tuple

import dosagelib
from . import http
Expand All @@ -18,7 +18,7 @@
}


def check_update() -> None | tuple[str, None | str]:
def check_update() -> Optional[Tuple[str, Optional[str]]]:
"""Return the following values:
throws exception - online version could not be determined
None - user has newest version
Expand All @@ -36,11 +36,11 @@ def check_update() -> None | tuple[str, None | str]:
return (version, None)


def asset_key(asset: dict[str, Any]) -> int:
def asset_key(asset: Dict[str, Any]) -> int:
return EXTPRIO.get(os.path.splitext(asset['browser_download_url'])[1], 99)


def get_online_version() -> tuple[str, None | str]:
def get_online_version() -> Tuple[str, Optional[str]]:
"""Download update info and parse it."""
response = http.default_session.get(UPDATE_URL)
response.raise_for_status()
Expand All @@ -57,7 +57,7 @@ def get_online_version() -> tuple[str, None | str]:
return version, url


def version_nums(ver: str) -> tuple[int, ...]:
def version_nums(ver: str) -> Tuple[int, ...]:
"""Extract all numeric "sub-parts" of a version string. Not very exact, but
works for our use case."""
return tuple(int(s) for s in re.split(r'\D+', ver + '0'))
Expand Down

0 comments on commit 9163317

Please sign in to comment.