From 409fc6f59be7c74be7953968c9ffa73bc502e761 Mon Sep 17 00:00:00 2001 From: kert Date: Tue, 27 Oct 2026 14:32:39 -0400 Subject: [PATCH] style: ruff-format two dev scripts; marimo stamps sample.py with 0.23.13 --- dev/scripts/add_ama_coding_to_zotero.py | 22 +++++++++++++++------ dev/scripts/search_pubmed_palliative_rfi.py | 4 +++- notebooks/sample.py | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dev/scripts/add_ama_coding_to_zotero.py b/dev/scripts/add_ama_coding_to_zotero.py index c9588a9..8f8d004 100644 --- a/dev/scripts/add_ama_coding_to_zotero.py +++ b/dev/scripts/add_ama_coding_to_zotero.py @@ -92,8 +92,12 @@ def _folder_matches(folder: str, entries: list[dict]) -> dict | None: def _folder_entry(folder: str) -> dict: """A synthetic entry for a landed book no OpenLibrary title covers.""" year = _year_of(folder) - return {"key": f"/local/{_norm(folder).replace(' ', '-')}", "title": folder, - "year": int(year) if year else None, "isbns": []} + return { + "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]]: @@ -125,7 +129,9 @@ def _attach(db: Db, parent_id: int, src: Path, *, dry_run: bool) -> None: return 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", "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( parent_id, 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})") -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"]) item_id = db.find_item_by_url(url) if item_id is not None: @@ -223,8 +231,10 @@ def main() -> None: db.commit() print() - print(f"collection '{args.collection}' ({collection_key}): " - f"{created} created, {existing} already present, {attached} files attached") + print( + f"collection '{args.collection}' ({collection_key}): " + f"{created} created, {existing} already present, {attached} files attached" + ) if not args.dry_run: print("Restart Zotero so the desktop reloads the database.") diff --git a/dev/scripts/search_pubmed_palliative_rfi.py b/dev/scripts/search_pubmed_palliative_rfi.py index 2235713..67442a2 100644 --- a/dev/scripts/search_pubmed_palliative_rfi.py +++ b/dev/scripts/search_pubmed_palliative_rfi.py @@ -399,7 +399,9 @@ def main() -> None: print(f" {key} — {doc['title'][:60]}") # ── 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)) seen_pmids = set(merged) snowball_new: dict[str, list[str]] = {} diff --git a/notebooks/sample.py b/notebooks/sample.py index 0fdbeb6..c409537 100644 --- a/notebooks/sample.py +++ b/notebooks/sample.py @@ -2,7 +2,7 @@ import marimo -__generated_with = "0.21.1" +__generated_with = "0.23.13" app = marimo.App()