Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
31
def
cast_bytes(s, encoding=None):
32
if
not isinstance(s, bytes):
33
return
encode(s, encoding)
34
return
s
35
36
def
buffer_to_bytes(buf):
37
""
"Cast a buffer object to bytes"
""
Callers
nothing calls this directly
Calls
1
encode
Function · 0.85
Tested by
no test coverage detected