Files
codex-mmo/evals/security-assurance/fixture/archive.py
T
2026-08-24 08:11:59 -07:00

16 lines
501 B
Python

from pathlib import Path, PurePosixPath
def normalized_asset_path(name):
parts = [part for part in PurePosixPath(name).parts if part not in {"", ".", ".."}]
return Path("assets").joinpath(*parts)
def extract_entries(entries, destination):
destination = Path(destination)
destination.mkdir(parents=True, exist_ok=True)
for name, content in entries:
target = destination / name
target.parent.mkdir(parents=True, exist_ok=True)
target.write_bytes(content)