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

Method create_ustar_header

Lib/tarfile.py:1049–1060  ·  view source on GitHub ↗

Return the object as a ustar header block.

(self, info, encoding, errors)

Source from the content-addressed store, hash-verified

1047 raise ValueError("invalid format")
1048
1049 def create_ustar_header(self, info, encoding, errors):
1050 """Return the object as a ustar header block.
1051 """
1052 info["magic"] = POSIX_MAGIC
1053
1054 if len(info["linkname"].encode(encoding, errors)) > LENGTH_LINK:
1055 raise ValueError("linkname is too long")
1056
1057 if len(info["name"].encode(encoding, errors)) > LENGTH_NAME:
1058 info["prefix"], info["name"] = self._posix_split_name(info["name"], encoding, errors)
1059
1060 return self._create_header(info, USTAR_FORMAT, encoding, errors)
1061
1062 def create_gnu_header(self, info, encoding, errors):
1063 """Return the object as a GNU header block sequence.

Callers 1

tobufMethod · 0.95

Calls 3

_posix_split_nameMethod · 0.95
_create_headerMethod · 0.95
encodeMethod · 0.45

Tested by

no test coverage detected