Commit 6c1e3dfcf151
Changed files (2)
tools
readwise-reader
tools/readwise-reader/default.nix
@@ -18,7 +18,12 @@ python3.pkgs.buildPythonApplication {
];
makeWrapperArgs = [
- "--prefix PATH : ${lib.makeBinPath [ google-cloud-sdk passage ]}"
+ "--prefix PATH : ${
+ lib.makeBinPath [
+ google-cloud-sdk
+ passage
+ ]
+ }"
];
dontUnpack = true;
tools/readwise-reader/readwise-reader.py
@@ -19,7 +19,6 @@ import html as html_mod
import json
import os
import subprocess
-import sys
import time
from collections import Counter, defaultdict
from datetime import datetime, timezone
@@ -343,7 +342,7 @@ def analyze(model, reset, batch_size, profile_path):
click.echo(f"๐ Summary: {summary_style}", err=True)
if not LATEST_LINK.exists():
- raise click.ClickException(f"No data found. Run 'readwise-reader fetch' first.")
+ raise click.ClickException("No data found. Run 'readwise-reader fetch' first.")
with open(LATEST_LINK) as f:
data = json.load(f)
@@ -420,7 +419,7 @@ def analyze(model, reset, batch_size, profile_path):
# Stats
rels = Counter(analyzed[k]["relevance"] for k in analyzed if "relevance" in analyzed[k])
if rels:
- click.echo(f"\nRelevance: " + " | ".join(f"{s}โ
={rels.get(s,0)}" for s in [5,4,3,2,1]), err=True)
+ click.echo("\nRelevance: " + " | ".join(f"{s}โ
={rels.get(s,0)}" for s in [5,4,3,2,1]), err=True)
acts = Counter(analyzed[k]["action"] for k in analyzed if "action" in analyzed[k])
if acts:
click.echo("Actions: " + " | ".join(f"{a}={c}" for a,c in acts.most_common()), err=True)
@@ -525,10 +524,10 @@ def _bulk_action(action, max_relevance, min_age, unread_only, dry_run, yes):
rels = Counter(d.get("_analysis", {}).get("relevance", 3) for d in candidates)
click.echo(f"\n{'DRY RUN โ ' if dry_run else ''}{action.upper()}: {len(candidates)} documents")
click.echo(f" Criteria: relevance โค {max_relevance}โ
, age โฅ {min_age}d, unread_only={unread_only}")
- click.echo(f" Relevance breakdown: " + ", ".join(f"{s}โ
={rels.get(s,0)}" for s in sorted(rels.keys())))
+ click.echo(" Relevance breakdown: " + ", ".join(f"{s}โ
={rels.get(s,0)}" for s in sorted(rels.keys())))
# Show sample
- click.echo(f"\n Sample (first 10):")
+ click.echo("\n Sample (first 10):")
for d in candidates[:10]:
a = d.get("_analysis", {})
title = (d.get("title") or "Untitled")[:60]
@@ -537,7 +536,7 @@ def _bulk_action(action, max_relevance, min_age, unread_only, dry_run, yes):
click.echo(f" ... and {len(candidates) - 10} more")
if dry_run:
- click.echo(f"\n๐ Dry run โ no changes made.")
+ click.echo("\n๐ Dry run โ no changes made.")
return
if not yes: