migration: prove standalone maintenance and correct visual evidence

This commit is contained in:
leefer
2026-08-01 03:40:18 +08:00
parent 1c50cc5bcb
commit deb84c4069
15 changed files with 164 additions and 30 deletions
+9 -7
View File
@@ -75,6 +75,14 @@ def css_layers(html: str) -> list[str]:
return re.findall(r'<link[^>]+rel="stylesheet"[^>]+href="([^"]+)"', html)
def source_metrics(path: Path) -> dict[str, int]:
text = path.read_text(encoding="utf-8")
return {
"bytes": len(text.encode("utf-8")),
"lines": len(text.splitlines()),
}
def code_hotspots() -> list[dict[str, Any]]:
candidates = [
"backend/application.py",
@@ -99,13 +107,7 @@ def code_hotspots() -> list[dict[str, Any]]:
path = ROOT / name
if not path.is_file():
continue
rows.append(
{
"path": name,
"bytes": path.stat().st_size,
"lines": len(path.read_text(encoding="utf-8").splitlines()),
}
)
rows.append({"path": name, **source_metrics(path)})
return sorted(rows, key=lambda item: item["bytes"], reverse=True)