#!/usr/bin/env python3 """Scan both stage roots (read-only): which non-media files contain local absolute paths / internal host names, and which 64-hex hashes each file contains. Output: work/scan.json.""" import json, os, re, sys, collections as C from concurrent.futures import ProcessPoolExecutor from pathlib import Path H = Path('${LOCAL}/simulation-workspace/runs/hf-release-20261120') ROOTS = [H / 'stage', Path('${LOCAL}/shm/ent400/hf-release-20261120/stage')] MEDIA = {'.mp4', '.png', '.jpg', '.jpeg', '.ktx2', '.glb', '.bin', '.stl'} ABS = re.compile(rb'(?:${LOCAL}|${LOCAL}|${LOCAL}/data|${LOCAL}/shm|/home/[a-z]|/root/\.cache|/tmp/)[^"\'\s<>|,;)\]}\\]*') HOST = re.compile(rb'||.\d+|-|dsw-\d+') HEX = re.compile(rb'(?/', x['rel']); k = k.split('/')[0] + '/.../' + Path(x['rel']).name if k.count('/') > 3 else k by[k] += 1; sz[k] += x['size'] print('by file kind:'); [print(f' {n:6d} {sz[k]/1e6:9.1f} MB {k}') for k, n in by.most_common(40)] if __name__ == "__main__": main()