MCPcopy Create free account
hub / github.com/ZeroIntensity/pointers.py / attempt_decode

Function attempt_decode

src/pointers/_utils.py:74–79  ·  view source on GitHub ↗

Attempt to decode a string of bytes.

(data: bytes)

Source from the content-addressed store, hash-verified

72
73
74def attempt_decode(data: bytes) -> Union[str, bytes]:
75 """Attempt to decode a string of bytes."""
76 try:
77 return data.decode()
78 except UnicodeDecodeError:
79 return data
80
81
82def map_type(data: Any) -> "ctypes._CData":

Callers 2

__getattribute__Method · 0.85
make_pyFunction · 0.85

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected