MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / extract

Method extract

tools/python-3.11.9-amd64/Lib/tarfile.py:2281–2298  ·  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 attribute

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

Source from the content-addressed store, hash-verified

2279 self._handle_nonfatal_error(e)
2280
2281 def extract(self, member, path="", set_attrs=True, *, numeric_owner=False,
2282 filter=None):
2283 """Extract a member from the archive to the current working directory,
2284 using its full name. Its file information is extracted as accurately
2285 as possible. `member' may be a filename or a TarInfo object. You can
2286 specify a different directory using `path'. File attributes (owner,
2287 mtime, mode) are set unless `set_attrs' is False. If `numeric_owner`
2288 is True, only the numbers for user/group names are used and not
2289 the names.
2290
2291 The `filter` function will be called before extraction.
2292 It can return a changed TarInfo or None to skip the member.
2293 String names of common filters are accepted.
2294 """
2295 filter_function = self._get_filter_function(filter)
2296 tarinfo = self._get_extract_tarinfo(member, filter_function, path)
2297 if tarinfo is not None:
2298 self._extract_one(tarinfo, path, set_attrs, numeric_owner)
2299
2300 def _get_extract_tarinfo(self, member, filter_function, path):
2301 """Get filtered TarInfo (or None) from member, which might be a str"""

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