MCPcopy Create free account
hub / github.com/numpy/numpy / tobytes_first

Function tobytes_first

numpy/lib/npyio.py:2216–2219  ·  view source on GitHub ↗
(x, conv)

Source from the content-addressed store, hash-verified

2214 # converters may use decode to workaround numpy's old behaviour,
2215 # so encode the string again before passing to the user converter
2216 def tobytes_first(x, conv):
2217 if type(x) is bytes:
2218 return conv(x)
2219 return conv(x.encode("latin1"))
2220 user_conv = functools.partial(tobytes_first, conv=conv)
2221 else:
2222 user_conv = conv

Callers

nothing calls this directly

Calls 2

encodeMethod · 0.80
convFunction · 0.50

Tested by

no test coverage detected