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

Method _proc_sparse

Lib/tarfile.py:1424–1450  ·  view source on GitHub ↗

Process a GNU sparse header plus extra headers.

(self, tarfile)

Source from the content-addressed store, hash-verified

1422 return next
1423
1424 def _proc_sparse(self, tarfile):
1425 """Process a GNU sparse header plus extra headers.
1426 """
1427 # We already collected some sparse structures in frombuf().
1428 structs, isextended, origsize = self._sparse_structs
1429 del self._sparse_structs
1430
1431 # Collect sparse structures from extended header blocks.
1432 while isextended:
1433 buf = tarfile.fileobj.read(BLOCKSIZE)
1434 pos = 0
1435 for i in range(21):
1436 try:
1437 offset = nti(buf[pos:pos + 12])
1438 numbytes = nti(buf[pos + 12:pos + 24])
1439 except ValueError:
1440 break
1441 if offset and numbytes:
1442 structs.append((offset, numbytes))
1443 pos += 24
1444 isextended = bool(buf[504])
1445 self.sparse = structs
1446
1447 self.offset_data = tarfile.fileobj.tell()
1448 tarfile.offset = self.offset_data + self._block(self.size)
1449 self.size = origsize
1450 return self
1451
1452 def _proc_pax(self, tarfile):
1453 """Process an extended or global header as described in

Callers 1

_proc_memberMethod · 0.95

Calls 5

_blockMethod · 0.95
ntiFunction · 0.85
readMethod · 0.45
appendMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected