CoolFace
Apppublic

apodex/frontier-agent-demo

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
14likes
_doc_reader.py25 linesDownload Raw Back to tools
1#!/usr/bin/env python32"""Assembler for the read_file parsers + a local standalone entry point."""3from pathlib import Path4 5_PARTS = (6    "_reader_core.py",  # shared pieces (_ensure/_ext) + the dispatching main() (definition only)7    "_reader_xlsx.py",  # _xlsx_to_md: coordinate grid / R1C1 formulas / recalc / chart / pivot / Table8    "_reader_docx.py",  # _docx_to_md: pandoc → md, falling back to python-docx9    "_reader_pptx.py",  # _pptx_to_md: rich extraction / grouping / flow / Needs VLM10    "_reader_pdf.py",   # _pdf_to_md: per-page text via pypdf11)12 13_TAIL = '\n\nif __name__ == "__main__":\n    main()\n'14 15 16def reader_src() -> str:17    """Assemble the single-file parser script shared by the sandbox and local runs (fragment order is the table above; the entry call is appended at the end)."""18    d = Path(__file__).parent19    return "\n\n\n".join((d / p).read_text(encoding="utf-8") for p in _PARTS) + _TAIL20 21 22if __name__ == "__main__":23    exec(compile(reader_src(), "<doc_reader_bundle>", "exec"),24         {"__name__": "__main__", "__file__": __file__})25