Download projects/oui-max/tools/docs.py from LevelUp2x/adaptai: direct link, hf CLI and curl.
- Browser
- Download file 766 Bytes
-
https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/main/projects/oui-max/tools/docs.py
- Command line
-
hf download hf://datasets/LevelUp2x/adaptai/projects/oui-max/tools/docs.py
-
curl -L -o docs.py https://huggingface.co/datasets/LevelUp2x/adaptai/resolve/main/projects/oui-max/tools/docs.py
766 Bytes
| """ | |
| id: docs | |
| title: Docs & Changelog | |
| author: admin | |
| description: Generate changelog and update README snippets. | |
| version: 0.1.0 | |
| license: Proprietary | |
| """ | |
| import subprocess | |
| import io | |
| class Tools: | |
| def changelog( | |
| self, repo: str = "/data/adaptai/projects/oui-max", max_lines: int = 200 | |
| ) -> dict: | |
| cmd = f"git -C {repo} log --oneline -n {max_lines}" | |
| p = subprocess.run(["bash", "-lc", cmd], capture_output=True, text=True) | |
| return {"stdout": p.stdout, "stderr": p.stderr, "exit_code": p.returncode} | |
| def update_readme_append(self, repo: str, text: str) -> dict: | |
| p = f"{repo}/README.md" | |
| with io.open(p, "a", encoding="utf-8") as f: | |
| f.write("\n" + text + "\n") | |
| return {"ok": True, "path": p} | |