chore: merge origin/main

This commit is contained in:
Abdessamad Derraz committed 2026-11-06 22:53:00 +01:00
commit 544df4326b
4 files changed
+10 -13

No files matched your search

+2
View File
@@ -899,6 +899,8 @@ scripts/scraper/targets/rocknix_targets_scraper.py:0: error: Name "github_header
scripts/scraper/targets/rocknix_targets_scraper.py:0: error: Name "standalone_emulators" already defined (possibly by an import) [no-redef]
scripts/sect233r1.py:0: error: Incompatible types in assignment (expression has type "Optional[tuple[int, int]]", variable has type "tuple[int, int]") [assignment]
scripts/site_insights.py:0: error: Item "list[Any]" of "Union[dict[Any, Any], list[Any]]" has no attribute "get" [union-attr]
scripts/site_insights.py:0: error: Item "list[Any]" of "Union[dict[Any, Any], list[Any]]" has no attribute "get" [union-attr]
scripts/site_insights.py:0: error: Item "list[Any]" of "Union[dict[Any, Any], list[Any]]" has no attribute "get" [union-attr]
scripts/sitediagrams.py:0: error: "AST" has no attribute "value" [attr-defined]
scripts/sitediagrams.py:0: error: Argument 1 to "lstrip" of "bytes" has incompatible type "str"; expected "Optional[Buffer]" [arg-type]
scripts/sitediagrams.py:0: error: If x = b'abc' then f"{x}" or "{}".format(x) produces "b'abc'", not "abc". If this is desired behavior, use f"{x!r}" or "{!r}".format(x). Otherwise, decode the bytes [str-bytes-safe]
+1 -1
View File
@@ -5018,7 +5018,7 @@ def _print_triage(
) -> bool:
"""Profiles ranked by drift, worst first. False when Ctrl-C cut the
scoring short: the ranking then covers the profiles scored."""
ranked: list[tuple] = []
ranked: list[tuple[int, ProfileReport, str]] = []
sampled = 0
progress = _Progress(len(reports), "scored", args.offline or len(reports) < 2)
complete = True
+6 -12
View File
@@ -123,15 +123,7 @@ def fetch_queries(start: dt.date, end: dt.date) -> list[Query]:
return rows
def _get_object(url: str, headers: dict[str, str] | None = None) -> dict:
"""A JSON answer that must be an object: GoatCounter's stats endpoints."""
answer = _get_json(url, headers)
if not isinstance(answer, dict):
raise ValueError(f"{url} answered {type(answer).__name__}, not an object")
return answer
def fetch_goatcounter(start: dt.date, end: dt.date) -> dict[str, list[tuple[str, int]] | int]:
def fetch_goatcounter(start: dt.date, end: dt.date) -> dict:
"""Paths and events with their visit counts, and the referring domains."""
token = (CONFIG / "goatcounter-api-token.txt").read_text(encoding="utf-8").strip()
auth = {"Authorization": f"Bearer {token}"}
@@ -140,14 +132,16 @@ def fetch_goatcounter(start: dt.date, end: dt.date) -> dict[str, list[tuple[str,
exclude: list[str] = []
while True:
params = urllib.parse.urlencode({**span, "limit": 100, "exclude_paths": ",".join(exclude)})
answer = _get_object(f"{GOATCOUNTER}/stats/hits?{params}", auth)
answer = _get_json(f"{GOATCOUNTER}/stats/hits?{params}", auth)
for hit in answer.get("hits", []):
hits.append((hit["path"] + (" [404]" if hit.get("title") == "404" else ""), int(hit["count"])))
exclude.append(str(hit["path_id"]))
if not answer.get("more"):
break
refs = _get_object(f"{GOATCOUNTER}/stats/toprefs?{urllib.parse.urlencode({**span, 'limit': 50})}", auth)
total = _get_object(f"{GOATCOUNTER}/stats/total?{urllib.parse.urlencode(span)}", auth)
refs = _get_json(f"{GOATCOUNTER}/stats/toprefs?{urllib.parse.urlencode({**span, 'limit': 50})}", auth)
total = _get_json(f"{GOATCOUNTER}/stats/total?{urllib.parse.urlencode(span)}", auth)
if not isinstance(refs, dict) or not isinstance(total, dict):
raise SystemExit("GoatCounter answered with something other than an object")
# An action carries no referrer, and GoatCounter files it as a direct
# visit: 592 of the first day's 1,145 "direct" were clicks.
events = int(total.get("total_events", 0))
+1
View File
@@ -323,6 +323,7 @@ class TheManifestCarriesTheArchiveSize(unittest.TestCase):
_manifest_data_directories(members, refs, registry, "")}
self.assertEqual(listed["pak"]["archive_size"], 21_360_579)
self.assertNotIn("archive_size", listed["old"])
self.assertNotIn("optional", listed["pak"])
if __name__ == "__main__":