| |
| from __future__ import annotations |
|
|
| import argparse |
| import json |
| import sys |
| from pathlib import Path |
|
|
| PROJECT_ROOT = Path(__file__).resolve().parents[1] |
| if str(PROJECT_ROOT) not in sys.path: |
| sys.path.insert(0, str(PROJECT_ROOT)) |
|
|
| from dovla_cil.data.datasets import CILDataset, write_cil_collection |
|
|
|
|
| def main(argv: list[str] | None = None) -> int: |
| parser = argparse.ArgumentParser( |
| description="Create a zero-copy collection over multiple CIL datasets." |
| ) |
| parser.add_argument("--sources", nargs="+", type=Path, required=True) |
| parser.add_argument("--out", type=Path, required=True) |
| parser.add_argument("--name", default="dovla_cil_collection") |
| args = parser.parse_args(argv) |
| path = write_cil_collection(args.out, args.sources, dataset_name=args.name) |
| dataset = CILDataset(args.out) |
| print( |
| json.dumps( |
| { |
| "collection": str(path), |
| "num_sources": len(args.sources), |
| "num_groups": len(dataset.group_ids), |
| "num_records": len(dataset), |
| }, |
| indent=2, |
| ) |
| ) |
| return 0 |
|
|
|
|
| if __name__ == "__main__": |
| raise SystemExit(main()) |
|
|