Buckets:
ml-intern-explorers/hutter-prize-collab / artifacts /dict_auto_xz_AutoZip /decompressor /decompress.py
| #!/usr/bin/env python3 | |
| import json, subprocess, sys | |
| from pathlib import Path | |
| inp = Path(sys.argv[1]) if len(sys.argv) > 1 else Path('archive.xz') | |
| out = Path(sys.argv[2]) if len(sys.argv) > 2 else Path('enwik8.out') | |
| work = inp.parent | |
| pp = work / 'tmp.preprocessed.bin' | |
| subprocess.run(['xz','-d','-c',str(inp)], check=True, stdout=pp.open('wb')) | |
| subs = json.loads((Path(__file__).with_name('subs.json')).read_text()) | |
| data = pp.read_bytes() | |
| for code, pat_hex in subs: | |
| data = data.replace(bytes([code]), bytes.fromhex(pat_hex)) | |
| out.write_bytes(data) | |
| pp.unlink(missing_ok=True) | |
Xet Storage Details
- Size:
- 577 Bytes
- Xet hash:
- fa9407571ece22a83a3d6c9feea4b257a5a8dc142a00a970d3bca4dcaac73063
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.