MCPcopy Index your code
hub / github.com/RustPython/RustPython / _unpack_tarfile

Function _unpack_tarfile

Lib/shutil.py:1339–1351  ·  view source on GitHub ↗

Unpack tar/tar.gz/tar.bz2/tar.xz/tar.zst `filename` to `extract_dir`

(filename, extract_dir, *, filter=None)

Source from the content-addressed store, hash-verified

1337 zip.close()
1338
1339def _unpack_tarfile(filename, extract_dir, *, filter=None):
1340 """Unpack tar/tar.gz/tar.bz2/tar.xz/tar.zst `filename` to `extract_dir`
1341 """
1342 import tarfile # late import for breaking circular dependency
1343 try:
1344 tarobj = tarfile.open(filename)
1345 except tarfile.TarError:
1346 raise ReadError(
1347 "%s is not a compressed or uncompressed tar file" % filename)
1348 try:
1349 tarobj.extractall(extract_dir, filter=filter)
1350 finally:
1351 tarobj.close()
1352
1353# Maps the name of the unpack format to a tuple containing:
1354# * extensions

Callers

nothing calls this directly

Calls 4

ReadErrorClass · 0.70
openMethod · 0.45
extractallMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected