Datasets:
Formats:
json
Languages:
English
Size:
< 1K
Tags:
mathematical-physics
arrow-of-time
temporal-irreversibility
time-reversal-symmetry
quantum-information
quantum-foundations
Download verification/fetch_additional_sources.py from PureOne/Neixarua-Operational-Temporal-Orientation: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/datasets/PureOne/Neixarua-Operational-Temporal-Orientation/resolve/main/verification/fetch_additional_sources.py
- Command line
-
hf download hf://datasets/PureOne/Neixarua-Operational-Temporal-Orientation/verification/fetch_additional_sources.py
-
curl -L -o fetch_additional_sources.py https://huggingface.co/datasets/PureOne/Neixarua-Operational-Temporal-Orientation/resolve/main/verification/fetch_additional_sources.py
1.57 kB
| """Optionally acquire pinned additional source bytes and verify every hash.""" | |
| import argparse | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| import urllib.request | |
| def main(): | |
| parser=argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--output",type=Path,default=Path("external_sources/additional")) | |
| args=parser.parse_args() | |
| manifest=Path(__file__).resolve().parents[1]/"provenance/v2_additional_source_files.json" | |
| records=json.loads(manifest.read_text())["files"] | |
| root=args.output.resolve() | |
| root.mkdir(parents=True,exist_ok=True) | |
| for r in records: | |
| relative=Path(r["repository"].split("/")[-1])/r["path"] | |
| dest=(root/relative).resolve() | |
| if not dest.is_relative_to(root): | |
| raise ValueError("Source path escapes requested destination") | |
| if dest.exists(): | |
| data=dest.read_bytes() | |
| else: | |
| request=urllib.request.Request(r["url"],headers={"User-Agent":"Neixarua-source-reproduction/2"}) | |
| with urllib.request.urlopen(request,timeout=60) as response: | |
| data=response.read(r["bytes"]+1) | |
| if len(data)!=r["bytes"] or hashlib.sha256(data).hexdigest()!=r["sha256"]: | |
| raise ValueError("Source byte/hash mismatch: "+r["repository"]+"/"+r["path"]) | |
| if not dest.exists(): | |
| dest.parent.mkdir(parents=True,exist_ok=True) | |
| dest.write_bytes(data) | |
| print("Verified:",relative) | |
| print("All pinned additional source files verified:",len(records)) | |
| if __name__=="__main__": | |
| main() | |