Spaces:
Runtime error
Runtime error
Download utils/docgen.py from NexusInstruments/omniscientframework: direct link, hf CLI and curl.
- Browser
- Download file 806 Bytes
-
https://huggingface.co/spaces/NexusInstruments/omniscientframework/resolve/main/utils/docgen.py
- Command line
-
hf download hf://spaces/NexusInstruments/omniscientframework/utils/docgen.py
-
curl -L -o docgen.py https://huggingface.co/spaces/NexusInstruments/omniscientframework/resolve/main/utils/docgen.py
806 Bytes
| import hashlib | |
| def generate_doc(name: str, path: str, content: str) -> str: | |
| """Generate basic README-style documentation for a script.""" | |
| sha1 = hashlib.sha1(content.encode()).hexdigest() | |
| usage = "bash " + name if name.endswith(".sh") else f"python {name}" | |
| preview = content[:300] | |
| # Build output line by line to avoid triple-quote issues | |
| lines = [] | |
| lines.append(f"# {name}") | |
| lines.append("") | |
| lines.append(f"**Path:** `{path}` ") | |
| lines.append(f"**SHA1:** `{sha1}` ") | |
| lines.append("") | |
| lines.append("## Usage") | |
| lines.append("```") | |
| lines.append(usage) | |
| lines.append("```") | |
| lines.append("") | |
| lines.append("## Preview (first 300 chars)") | |
| lines.append("```") | |
| lines.append(preview) | |
| lines.append("```") | |
| return "\n".join(lines) | |