MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / _extract_tar

Function _extract_tar

monai/apps/utils.py:289–300  ·  view source on GitHub ↗
(filepath, output_dir)

Source from the content-addressed store, hash-verified

287
288
289def _extract_tar(filepath, output_dir):
290 with tarfile.open(filepath, "r") as tar_file:
291 for member in tar_file.getmembers():
292 safe_path = safe_extract_member(member, output_dir)
293 if not member.isfile():
294 continue
295 os.makedirs(os.path.dirname(safe_path), exist_ok=True)
296 source = tar_file.extractfile(member)
297 if source is not None:
298 with source:
299 with open(safe_path, "wb") as target:
300 shutil.copyfileobj(source, target)
301
302
303def extractall(

Callers 1

extractallFunction · 0.85

Calls 1

safe_extract_memberFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…