Fix list_builder.py to be compatible with Python 3.9
This commit is contained in:
parent
f1e7901e52
commit
43f3495257
2 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue