MCPcopy Create free account
hub / github.com/ipython/ipython / cast_bytes

Function cast_bytes

IPython/utils/py3compat.py:31–34  ·  view source on GitHub ↗
(s, encoding=None)

Source from the content-addressed store, hash-verified

29 return s
30
31def cast_bytes(s, encoding=None):
32 if not isinstance(s, bytes):
33 return encode(s, encoding)
34 return s
35
36def buffer_to_bytes(buf):
37 """Cast a buffer object to bytes"""

Callers

nothing calls this directly

Calls 1

encodeFunction · 0.85

Tested by

no test coverage detected