MCPcopy Index your code
hub / github.com/python/cpython / extract

Method extract

Lib/tarfile.py:2480–2498  ·  view source on GitHub ↗

Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. 'member' may be a filename or a TarInfo object. You can specify a different directory using 'path'. File attributes (

(self, member, path="", set_attrs=True, *, numeric_owner=False,
                filter=None)

Source from the content-addressed store, hash-verified

2478 (member.name, reason))
2479
2480 def extract(self, member, path="", set_attrs=True, *, numeric_owner=False,
2481 filter=None):
2482 """Extract a member from the archive to the current working directory,
2483 using its full name. Its file information is extracted as accurately
2484 as possible. 'member' may be a filename or a TarInfo object. You can
2485 specify a different directory using 'path'. File attributes (owner,
2486 mtime, mode) are set unless 'set_attrs' is False. If 'numeric_owner'
2487 is True, only the numbers for user/group names are used and not
2488 the names.
2489
2490 The 'filter' function will be called before extraction.
2491 It can return a changed TarInfo or None to skip the member.
2492 String names of common filters are accepted.
2493 """
2494 filter_function = self._get_filter_function(filter)
2495 tarinfo, unfiltered = self._get_extract_tarinfo(
2496 member, filter_function, path)
2497 if tarinfo is not None:
2498 self._extract_one(tarinfo, path, set_attrs, numeric_owner)
2499
2500 def _get_extract_tarinfo(self, member, filter_function, path):
2501 """Get (filtered, unfiltered) TarInfos from *member*

Callers

nothing calls this directly

Calls 3

_get_filter_functionMethod · 0.95
_get_extract_tarinfoMethod · 0.95
_extract_oneMethod · 0.95

Tested by

no test coverage detected