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

Method _apply_pax_info

Lib/tarfile.py:1634–1655  ·  view source on GitHub ↗

Replace fields with supplemental information from a previous pax extended or global header.

(self, pax_headers, encoding, errors)

Source from the content-addressed store, hash-verified

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
1636 pax extended or global header.
1637 """
1638 for keyword, value in pax_headers.items():
1639 if keyword == "GNU.sparse.name":
1640 setattr(self, "path", value)
1641 elif keyword == "GNU.sparse.size":
1642 setattr(self, "size", int(value))
1643 elif keyword == "GNU.sparse.realsize":
1644 setattr(self, "size", int(value))
1645 elif keyword in PAX_FIELDS:
1646 if keyword in PAX_NUMBER_FIELDS:
1647 try:
1648 value = PAX_NUMBER_FIELDS[keyword](value)
1649 except ValueError:
1650 value = 0
1651 if keyword == "path":
1652 value = value.rstrip("/")
1653 setattr(self, keyword, value)
1654
1655 self.pax_headers = pax_headers.copy()
1656
1657 def _decode_pax_field(self, value, encoding, fallback_encoding, fallback_errors):
1658 """Decode a single field from a pax record.

Callers 2

_proc_builtinMethod · 0.95
_proc_paxMethod · 0.80

Calls 3

itemsMethod · 0.45
rstripMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected