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

Method _proc_gnusparse_00

Lib/tarfile.py:1592–1610  ·  view source on GitHub ↗

Process a GNU tar extended sparse header, version 0.0.

(self, next, raw_headers)

Source from the content-addressed store, hash-verified

1590 return next
1591
1592 def _proc_gnusparse_00(self, next, raw_headers):
1593 """Process a GNU tar extended sparse header, version 0.0.
1594 """
1595 offsets = []
1596 numbytes = []
1597 for _, keyword, value in raw_headers:
1598 if keyword == b"GNU.sparse.offset":
1599 try:
1600 offsets.append(int(value.decode()))
1601 except ValueError:
1602 raise InvalidHeaderError("invalid header")
1603
1604 elif keyword == b"GNU.sparse.numbytes":
1605 try:
1606 numbytes.append(int(value.decode()))
1607 except ValueError:
1608 raise InvalidHeaderError("invalid header")
1609
1610 next.sparse = list(zip(offsets, numbytes))
1611
1612 def _proc_gnusparse_01(self, next, pax_headers):
1613 """Process a GNU tar extended sparse header, version 0.1.

Callers 1

_proc_paxMethod · 0.95

Calls 4

InvalidHeaderErrorClass · 0.85
listClass · 0.85
appendMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected