Type-check scripts/

This commit is contained in:
Alexander Hess 2026-12-01 13:57:42 +01:00
commit d6b798a736
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -14,6 +14,7 @@ import json
import pathlib
import textwrap
import tomllib
import typing as t
PKG_CONSIDERED_OLD = 2 # years after release when a package is considered "old"
@ -23,7 +24,7 @@ PROJECT_ROOT = pathlib.Path(__file__).resolve().parent.parent
REPORT_FILE = PROJECT_ROOT / ".cache/dependencies_checked.txt"
def get_direct_dependencies(lock_file: dict) -> dict[str, str]:
def get_direct_dependencies(lock_file: dict[str, t.Any]) -> dict[str, str]:
"""Map the direct dependencies to "main" or their extra or group.
`lock_file` is a mapping as returned from `load_lock_file()`.
@ -41,7 +42,7 @@ def get_direct_dependencies(lock_file: dict) -> dict[str, str]:
return labels
def get_pinned_packages(lock_file: dict) -> dict[str, str]:
def get_pinned_packages(lock_file: dict[str, t.Any]) -> dict[str, str]:
"""Map all packages from PyPI to their versions.
`lock_file` is a mapping as returned from `load_lock_file()`.
@ -84,7 +85,7 @@ def get_years_since_release(
return round(years_since_release, 1), latest_version
def load_lock_file() -> dict:
def load_lock_file() -> dict[str, t.Any]:
"""Load the uv.lock file."""
return tomllib.loads((PROJECT_ROOT / "uv.lock").read_text())