CoolFace
Apppublic

apodex/frontier-agent-demo

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
14likes
_create_file.py23 linesDownload Raw Back to tools
1#!/usr/bin/env python32"""office_writer local standalone entry point: concatenates _writer_{core,docx,xlsx,pptx}.py into one script and runs it.3(Mirrors read_file's _doc_reader.py; inside the sandbox the create_file tool uses the same bundle.)4 5Usage: python3 _create_file.py <path> <op> '<args_json>'6"""7from pathlib import Path8 9_PARTS = ("_writer_core.py", "_writer_docx.py", "_writer_xlsx.py", "_writer_pptx.py",10          "_writer_text.py")11_TAIL = '\n\nif __name__ == "__main__":\n    main()\n'12 13 14def writer_src() -> str:15    d = Path(__file__).parent16    avail = [p for p in _PARTS if (d / p).exists()]  # skip format fragments that do not exist yet17    return "\n\n\n".join((d / p).read_text(encoding="utf-8") for p in avail) + _TAIL18 19 20if __name__ == "__main__":21    exec(compile(writer_src(), "<create_file_bundle>", "exec"),22         {"__name__": "__main__", "__file__": __file__})23