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

Method _proc_gnusparse_10

Lib/tarfile.py:1618–1632  ·  view source on GitHub ↗

Process a GNU tar extended sparse header, version 1.0.

(self, next, pax_headers, tarfile)

Source from the content-addressed store, hash-verified

1616 next.sparse = list(zip(sparse[::2], sparse[1::2]))
1617
1618 def _proc_gnusparse_10(self, next, pax_headers, tarfile):
1619 """Process a GNU tar extended sparse header, version 1.0.
1620 """
1621 fields = None
1622 sparse = []
1623 buf = tarfile.fileobj.read(BLOCKSIZE)
1624 fields, buf = buf.split(b"\n", 1)
1625 fields = int(fields)
1626 while len(sparse) < fields * 2:
1627 if b"\n" not in buf:
1628 buf += tarfile.fileobj.read(BLOCKSIZE)
1629 number, buf = buf.split(b"\n", 1)
1630 sparse.append(int(number))
1631 next.offset_data = tarfile.fileobj.tell()
1632 next.sparse = list(zip(sparse[::2], sparse[1::2]))
1633
1634 def _apply_pax_info(self, pax_headers, encoding, errors):
1635 """Replace fields with supplemental information from a previous

Callers 1

_proc_paxMethod · 0.95

Calls 5

listClass · 0.85
readMethod · 0.45
splitMethod · 0.45
appendMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected