Download python_lora_dataset_builder/pipeline/utils.py from api-relay/sadASDasd: direct link, hf CLI and curl.
- Browser
- Download file 524 Bytes
-
https://huggingface.co/datasets/api-relay/sadASDasd/resolve/main/python_lora_dataset_builder/pipeline/utils.py
- Command line
-
hf download hf://datasets/api-relay/sadASDasd/python_lora_dataset_builder/pipeline/utils.py
-
curl -L -o utils.py https://huggingface.co/datasets/api-relay/sadASDasd/resolve/main/python_lora_dataset_builder/pipeline/utils.py
524 Bytes
| import json, hashlib, re | |
| from pathlib import Path | |
| def load_json(path): return json.loads(Path(path).read_text(encoding="utf-8")) | |
| def append_jsonl(path,record): | |
| path=Path(path); path.parent.mkdir(parents=True,exist_ok=True) | |
| with path.open("a",encoding="utf-8") as f:f.write(json.dumps(record,ensure_ascii=False)+"\n") | |
| def normalize_code(code): return "\n".join(x.rstrip() for x in code.replace("\r\n","\n").splitlines()).strip() | |
| def sha256_text(text): return hashlib.sha256(text.encode("utf-8","ignore")).hexdigest() | |