(input_value: str)
| 58 | |
| 59 | |
| 60 | def ensure_record(input_value: str) -> dict[str, Any]: |
| 61 | record = maybe_load_json_record(input_value) |
| 62 | if record is not None: |
| 63 | return dict(record) |
| 64 | path = Path(input_value).expanduser() |
| 65 | if path.exists() and path.is_file() and path.suffix.lower() == ".pdf": |
| 66 | return { |
| 67 | "paper_id": f"local:{path.stem}", |
| 68 | "title": path.stem, |
| 69 | "pdf_path": str(path.resolve()), |
| 70 | "source_type": "local_pdf", |
| 71 | } |
| 72 | return enrich_metadata(resolve_reference(input_value)) |
| 73 | |
| 74 | |
| 75 | def resolve_pdf_path(record: dict[str, Any]) -> Path | None: |
no test coverage detected