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

Method _proc_gnulong

Lib/tarfile.py:1397–1422  ·  view source on GitHub ↗

Process the blocks that hold a GNU longname or longlink member.

(self, tarfile)

Source from the content-addressed store, hash-verified

1395 return self
1396
1397 def _proc_gnulong(self, tarfile):
1398 """Process the blocks that hold a GNU longname
1399 or longlink member.
1400 """
1401 buf = tarfile.fileobj.read(self._block(self.size))
1402
1403 # Fetch the next header and process it.
1404 try:
1405 next = self.fromtarfile(tarfile)
1406 except HeaderError as e:
1407 raise SubsequentHeaderError(str(e)) from None
1408
1409 # Patch the TarInfo object from the next header with
1410 # the longname information.
1411 next.offset = self.offset
1412 if self.type == GNUTYPE_LONGNAME:
1413 next.name = nts(buf, tarfile.encoding, tarfile.errors)
1414 elif self.type == GNUTYPE_LONGLINK:
1415 next.linkname = nts(buf, tarfile.encoding, tarfile.errors)
1416
1417 # Remove redundant slashes from directories. This is to be consistent
1418 # with frombuf().
1419 if next.isdir():
1420 next.name = next.name.removesuffix("/")
1421
1422 return next
1423
1424 def _proc_sparse(self, tarfile):
1425 """Process a GNU sparse header plus extra headers.

Callers 1

_proc_memberMethod · 0.95

Calls 8

_blockMethod · 0.95
fromtarfileMethod · 0.95
strFunction · 0.85
ntsFunction · 0.85
readMethod · 0.45
isdirMethod · 0.45
removesuffixMethod · 0.45

Tested by

no test coverage detected