From 43f34952572a1e5ee0c206d88bf5d7a8af2a9722 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 9 Feb 2024 01:41:33 +0100 Subject: [PATCH] Fix list_builder.py to be compatible with Python 3.9 --- appslib/utils.py | 6 +++--- list_builder.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appslib/utils.py b/appslib/utils.py index d387b1d..546364d 100644 --- a/appslib/utils.py +++ b/appslib/utils.py @@ -2,7 +2,7 @@ import sys import subprocess -from typing import Any, TextIO, Generator +from typing import Any, TextIO, Generator, Optional, Union import time from functools import cache from pathlib import Path @@ -18,7 +18,7 @@ def apps_repo_root() -> Path: return Path(__file__).parent.parent.parent -def git(cmd: list[str], cwd: Path | None = None) -> str: +def git(cmd: list[str], cwd: Optional[Path] = None) -> str: full_cmd = ["git"] if cwd: full_cmd.extend(["-C", str(cwd)]) @@ -29,7 +29,7 @@ def git(cmd: list[str], cwd: Path | None = None) -> str: ).strip().decode("utf-8") -def git_repo_age(path: Path) -> bool | int: +def git_repo_age(path: Path) -> Union[bool, int]: for file in [path / ".git" / "FETCH_HEAD", path / ".git" / "HEAD"]: if file.exists(): return int(time.time() - file.stat().st_mtime) diff --git a/list_builder.py b/list_builder.py index e48ca57..a3fd677 100755 --- a/list_builder.py +++ b/list_builder.py @@ -10,7 +10,7 @@ import time from collections import OrderedDict from functools import cache from pathlib import Path -from typing import Any +from typing import Any, Optional import toml import tqdm @@ -53,7 +53,7 @@ def antifeatures_list(): # Actual list build management # ################################ -def __build_app_dict(data) -> tuple[str, dict[str, Any]] | None: +def __build_app_dict(data) -> Optional[tuple[str, dict[str, Any]]]: name, info = data try: return name, build_app_dict(name, info)