Skip to content

Commit 6319ac7

Browse files
fix: lint
1 parent fbb0c58 commit 6319ac7

File tree

2 files changed

+41
-29
lines changed

2 files changed

+41
-29
lines changed

paperbanana/cli.py

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -556,11 +556,13 @@ def batch(
556556
settings = Settings.from_yaml(config, **overrides)
557557
else:
558558
from dotenv import load_dotenv
559+
559560
load_dotenv()
560561
settings = Settings(**overrides)
561562

562563
if auto_download_data:
563564
from paperbanana.data.manager import DatasetManager
565+
564566
dm = DatasetManager(cache_dir=settings.cache_dir)
565567
if not dm.is_downloaded():
566568
console.print(" [dim]Downloading expanded reference set...[/dim]")
@@ -590,14 +592,16 @@ def batch(
590592
input_path = Path(item["input"])
591593
if not input_path.exists():
592594
console.print(f"[red]Skipping item '{item_id}': input not found: {input_path}[/red]")
593-
report["items"].append({
594-
"id": item_id,
595-
"input": item["input"],
596-
"caption": item["caption"],
597-
"run_id": None,
598-
"output_path": None,
599-
"error": "input file not found",
600-
})
595+
report["items"].append(
596+
{
597+
"id": item_id,
598+
"input": item["input"],
599+
"caption": item["caption"],
600+
"run_id": None,
601+
"output_path": None,
602+
"error": "input file not found",
603+
}
604+
)
601605
continue
602606
source_context = input_path.read_text(encoding="utf-8")
603607
gen_input = GenerationInput(
@@ -609,25 +613,29 @@ def batch(
609613
pipeline = PaperBananaPipeline(settings=settings)
610614
try:
611615
result = asyncio.run(pipeline.generate(gen_input))
612-
report["items"].append({
613-
"id": item_id,
614-
"input": item["input"],
615-
"caption": item["caption"],
616-
"run_id": result.metadata.get("run_id"),
617-
"output_path": result.image_path,
618-
"iterations": len(result.iterations),
619-
})
616+
report["items"].append(
617+
{
618+
"id": item_id,
619+
"input": item["input"],
620+
"caption": item["caption"],
621+
"run_id": result.metadata.get("run_id"),
622+
"output_path": result.image_path,
623+
"iterations": len(result.iterations),
624+
}
625+
)
620626
console.print(f" [green]✓[/green] [dim]{result.image_path}[/dim]\n")
621627
except Exception as e:
622628
console.print(f" [red]✗[/red] {e}\n")
623-
report["items"].append({
624-
"id": item_id,
625-
"input": item["input"],
626-
"caption": item["caption"],
627-
"run_id": None,
628-
"output_path": None,
629-
"error": str(e),
630-
})
629+
report["items"].append(
630+
{
631+
"id": item_id,
632+
"input": item["input"],
633+
"caption": item["caption"],
634+
"run_id": None,
635+
"output_path": None,
636+
"error": str(e),
637+
}
638+
)
631639

632640
total_elapsed = time.perf_counter() - total_start
633641
report["total_seconds"] = round(total_elapsed, 1)

paperbanana/core/batch.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ def load_batch_manifest(manifest_path: Path) -> list[dict[str, Any]]:
3838
if suffix in (".yaml", ".yml"):
3939
try:
4040
import yaml
41+
4142
data = yaml.safe_load(raw)
4243
except ImportError:
4344
raise RuntimeError(
4445
"PyYAML is required for YAML manifests. Install with: pip install pyyaml"
4546
)
4647
elif suffix == ".json":
4748
import json
49+
4850
data = json.loads(raw)
4951
else:
5052
raise ValueError(f"Manifest must be .yaml, .yml, or .json. Got: {manifest_path.suffix}")
@@ -69,9 +71,11 @@ def load_batch_manifest(manifest_path: Path) -> list[dict[str, Any]]:
6971
input_path = Path(inp)
7072
if not input_path.is_absolute():
7173
input_path = (parent / input_path).resolve()
72-
result.append({
73-
"input": str(input_path),
74-
"caption": str(caption),
75-
"id": entry.get("id", f"item_{i + 1}"),
76-
})
74+
result.append(
75+
{
76+
"input": str(input_path),
77+
"caption": str(caption),
78+
"id": entry.get("id", f"item_{i + 1}"),
79+
}
80+
)
7781
return result

0 commit comments

Comments
 (0)