MCPcopy Index your code
hub / github.com/RustPython/RustPython / _posix_split_name

Method _posix_split_name

Lib/tarfile.py:1142–1156  ·  view source on GitHub ↗

Split a name longer than 100 chars into a prefix and a name part.

(self, name, encoding, errors)

Source from the content-addressed store, hash-verified

1140 return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf-8")
1141
1142 def _posix_split_name(self, name, encoding, errors):
1143 """Split a name longer than 100 chars into a prefix
1144 and a name part.
1145 """
1146 components = name.split("/")
1147 for i in range(1, len(components)):
1148 prefix = "/".join(components[:i])
1149 name = "/".join(components[i:])
1150 if len(prefix.encode(encoding, errors)) <= LENGTH_PREFIX and \
1151 len(name.encode(encoding, errors)) <= LENGTH_NAME:
1152 break
1153 else:
1154 raise ValueError("name is too long")
1155
1156 return prefix, name
1157
1158 @staticmethod
1159 def _create_header(info, format, encoding, errors):

Callers 1

create_ustar_headerMethod · 0.95

Calls 4

lenFunction · 0.85
splitMethod · 0.45
joinMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected