amkkk's picture
download
raw
1.13 kB
"""Pin the scorecard (first) and conclusion cells on their pages."""
import re
from pathlib import Path
import trackio.logbook as lb
PROJ = Path(".trackio")
LOGBOOK_DIR = PROJ / "logbook"
for page_slug, page_file in [("00-scorecard", "pages/00-scorecard/page.md"),
("conclusion", "pages/conclusion/page.md")]:
p = LOGBOOK_DIR / page_file
content = p.read_text(encoding="utf-8")
matches = re.findall(r'"id":\s*"(cell_[^"]+)"', content)
if not matches:
print(f" {page_slug}: NO cell ids found")
continue
cell_id = matches[-1] # the latest cell on the page
print(f" {page_slug}: pinning cell_id = {cell_id}")
lb.set_cell_pinned(PROJ, cell_id, page=page_slug)
print(f" {page_slug}: pinned.")
# Verify
for page_slug, page_file in [("00-scorecard", "pages/00-scorecard/page.md"),
("conclusion", "pages/conclusion/page.md")]:
p = LOGBOOK_DIR / page_file
content = p.read_text(encoding="utf-8")
is_pinned = '"pinned": true' in content or '"pinned":true' in content
print(f" {page_slug}: pinned={is_pinned}")

Xet Storage Details

Size:
1.13 kB
·
Xet hash:
ef2ac6d19934eb70ac890b4d7b0d6fddd004e929ce4cab0955e3759edde214b8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.