Skip to content

Commit a6c9a36

Browse files
rahulkeerthiclaude
andcommitted
fix: add --output flag to stream script to prevent clobbering data/json/
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f4f1933 commit a6c9a36

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

scripts/stream-wikidata-dump.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ def main():
454454
parser.add_argument("--file", type=str, help="Local dump file path (default: stream from web)")
455455
parser.add_argument("--limit", type=int, help="Max lines to process (for testing)")
456456
parser.add_argument("--dry-run", action="store_true", help="Count entities without writing files")
457+
parser.add_argument("--output", type=str, help="Output directory (default: data/json/)")
457458
args = parser.parse_args()
458459

459460
players: list[dict] = []
@@ -576,10 +577,11 @@ def main():
576577
print("\nDry run — no files written.")
577578
return
578579

579-
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
580+
out_dir = Path(args.output) if args.output else OUTPUT_DIR
581+
out_dir.mkdir(parents=True, exist_ok=True)
580582

581583
for name, data in [("players", players), ("teams", teams), ("coachs", coaches)]:
582-
path = OUTPUT_DIR / f"{name}.json"
584+
path = out_dir / f"{name}.json"
583585
with open(path, "w", encoding="utf-8") as f:
584586
json.dump(data, f, ensure_ascii=False)
585587
print(f"Wrote {len(data):,} entities to {path}")

0 commit comments

Comments
 (0)