style: ruff-format two dev scripts; marimo stamps sample.py with 0.23.13
Some checks failed
CI / lint (push) Successful in 57s
CI / test (push) Has been cancelled
CI / notebooks-smoke (push) Has been cancelled
Deploy / changes (push) Has been cancelled
Deploy / notebooks (push) Has been cancelled
Deploy / zotero (push) Has been cancelled
Deploy / docs (push) Has been cancelled
Deploy / api (push) Has been cancelled
Deploy / bcda (push) Has been cancelled
Deploy / llm (push) Has been cancelled
Deploy / mc (push) Has been cancelled
Deploy / report (push) Has been cancelled
Infra CI / api (push) Has been cancelled
Infra CI / bcda (push) Has been cancelled
Infra CI / llm (push) Has been cancelled
Infra CI / mc (push) Has been cancelled
Infra CI / notebooks (push) Has been cancelled
Infra CI / zotero (push) Has been cancelled
Infra CI / docs (push) Has been cancelled

This commit is contained in:
kert
2026-10-27 14:32:39 -04:00
parent d1165cde45
commit 409fc6f59b
3 changed files with 20 additions and 8 deletions

View File

@@ -92,8 +92,12 @@ def _folder_matches(folder: str, entries: list[dict]) -> dict | None:
def _folder_entry(folder: str) -> dict: def _folder_entry(folder: str) -> dict:
"""A synthetic entry for a landed book no OpenLibrary title covers.""" """A synthetic entry for a landed book no OpenLibrary title covers."""
year = _year_of(folder) year = _year_of(folder)
return {"key": f"/local/{_norm(folder).replace(' ', '-')}", "title": folder, return {
"year": int(year) if year else None, "isbns": []} "key": f"/local/{_norm(folder).replace(' ', '-')}",
"title": folder,
"year": int(year) if year else None,
"isbns": [],
}
def _index_books(books_dir: Path) -> dict[str, list[Path]]: def _index_books(books_dir: Path) -> dict[str, list[Path]]:
@@ -125,7 +129,9 @@ def _attach(db: Db, parent_id: int, src: Path, *, dry_run: bool) -> None:
return return
subprocess.run(["sudo", "mkdir", "-p", str(storage_dir)], check=True) subprocess.run(["sudo", "mkdir", "-p", str(storage_dir)], check=True)
subprocess.run(["sudo", "cp", str(src), str(storage_dir / src.name)], check=True) subprocess.run(["sudo", "cp", str(src), str(storage_dir / src.name)], check=True)
subprocess.run(["sudo", "chown", "-R", "100999:100999", str(storage_dir)], check=True) subprocess.run(
["sudo", "chown", "-R", "100999:100999", str(storage_dir)], check=True
)
att_id = db.add_attachment( att_id = db.add_attachment(
parent_id, parent_id,
key=att_key, key=att_key,
@@ -136,7 +142,9 @@ def _attach(db: Db, parent_id: int, src: Path, *, dry_run: bool) -> None:
print(f" attached {src.name} ({att_key})") print(f" attached {src.name} ({att_key})")
def _ensure_item(db: Db, entry: dict, collection_key: str, *, dry_run: bool) -> int | None: def _ensure_item(
db: Db, entry: dict, collection_key: str, *, dry_run: bool
) -> int | None:
url = _ol_url(entry["key"]) url = _ol_url(entry["key"])
item_id = db.find_item_by_url(url) item_id = db.find_item_by_url(url)
if item_id is not None: if item_id is not None:
@@ -223,8 +231,10 @@ def main() -> None:
db.commit() db.commit()
print() print()
print(f"collection '{args.collection}' ({collection_key}): " print(
f"{created} created, {existing} already present, {attached} files attached") f"collection '{args.collection}' ({collection_key}): "
f"{created} created, {existing} already present, {attached} files attached"
)
if not args.dry_run: if not args.dry_run:
print("Restart Zotero so the desktop reloads the database.") print("Restart Zotero so the desktop reloads the database.")

View File

@@ -399,7 +399,9 @@ def main() -> None:
print(f" {key} — {doc['title'][:60]}") print(f" {key} — {doc['title'][:60]}")
# ── Forward snowball from anchor publications ───────────────── # ── Forward snowball from anchor publications ─────────────────
print(f"\nSnowballing {len(SNOWBALL_SEEDS)} anchor publications (elink cited-by) ...") print(
f"\nSnowballing {len(SNOWBALL_SEEDS)} anchor publications (elink cited-by) ..."
)
cited_by = elink_cited_by(list(SNOWBALL_SEEDS)) cited_by = elink_cited_by(list(SNOWBALL_SEEDS))
seen_pmids = set(merged) seen_pmids = set(merged)
snowball_new: dict[str, list[str]] = {} snowball_new: dict[str, list[str]] = {}

View File

@@ -2,7 +2,7 @@
import marimo import marimo
__generated_with = "0.21.1" __generated_with = "0.23.13"
app = marimo.App() app = marimo.App()