(filepath, output_dir)
| 275 | |
| 276 | |
| 277 | def _extract_zip(filepath, output_dir): |
| 278 | with zipfile.ZipFile(filepath, "r") as zip_file: |
| 279 | for member in zip_file.infolist(): |
| 280 | safe_path = safe_extract_member(member, output_dir) |
| 281 | if member.is_dir(): |
| 282 | continue |
| 283 | os.makedirs(os.path.dirname(safe_path), exist_ok=True) |
| 284 | with zip_file.open(member) as source: |
| 285 | with open(safe_path, "wb") as target: |
| 286 | shutil.copyfileobj(source, target) |
| 287 | |
| 288 | |
| 289 | def _extract_tar(filepath, output_dir): |
no test coverage detected
searching dependent graphs…