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

Function nts

Lib/tarfile.py:164–170  ·  view source on GitHub ↗

Convert a null-terminated bytes object to a string.

(s, encoding, errors)

Source from the content-addressed store, hash-verified

162 return s[:length] + (length - len(s)) * NUL
163
164def nts(s, encoding, errors):
165 """Convert a null-terminated bytes object to a string.
166 """
167 p = s.find(b"\0")
168 if p != -1:
169 s = s[:p]
170 return s.decode(encoding, errors)
171
172def nti(s):
173 """Convert a number field to a python number.

Callers 3

ntiFunction · 0.85
_frombufMethod · 0.85
_proc_gnulongMethod · 0.85

Calls 2

findMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected