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

Method _proc_sparse

tools/python-3.11.9-amd64/Lib/tarfile.py:1371–1397  ·  view source on GitHub ↗

Process a GNU sparse header plus extra headers.

(self, tarfile)

Source from the content-addressed store, hash-verified

1369 return next
1370
1371 def _proc_sparse(self, tarfile):
1372 """Process a GNU sparse header plus extra headers.
1373 """
1374 # We already collected some sparse structures in frombuf().
1375 structs, isextended, origsize = self._sparse_structs
1376 del self._sparse_structs
1377
1378 # Collect sparse structures from extended header blocks.
1379 while isextended:
1380 buf = tarfile.fileobj.read(BLOCKSIZE)
1381 pos = 0
1382 for i in range(21):
1383 try:
1384 offset = nti(buf[pos:pos + 12])
1385 numbytes = nti(buf[pos + 12:pos + 24])
1386 except ValueError:
1387 break
1388 if offset and numbytes:
1389 structs.append((offset, numbytes))
1390 pos += 24
1391 isextended = bool(buf[504])
1392 self.sparse = structs
1393
1394 self.offset_data = tarfile.fileobj.tell()
1395 tarfile.offset = self.offset_data + self._block(self.size)
1396 self.size = origsize
1397 return self
1398
1399 def _proc_pax(self, tarfile):
1400 """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