import hashlib
import json
import os
from pathlib import Path
import urllib.request

os.umask(0o077)
root=Path('/tmp/codex/ltb1021/20260909-det-semantic')
revision='3f7748b1783533bc2e62804ca5975fe9b9cfc041'
paths=['src/rfdetr/models/postprocess.py','src/rfdetr/detr.py','src/rfdetr/assets/coco_classes.py']
result={}
for path in paths:
    url=f'https://raw.githubusercontent.com/roboflow/rf-detr/{revision}/{path}'
    with urllib.request.urlopen(url,timeout=20) as response:
        data=response.read()
    (root/Path(path).name).write_bytes(data)
    result[path]={'revision':revision,'sha256':hashlib.sha256(data).hexdigest()}
(root/'reference.json').write_text(json.dumps(result,indent=2))
print(json.dumps(result))
