MCPcopy
hub / github.com/redis/redis-py / str_if_bytes

Function str_if_bytes

redis/utils.py:71–74  ·  view source on GitHub ↗
(value: Union[str, bytes])

Source from the content-addressed store, hash-verified

69
70
71def str_if_bytes(value: Union[str, bytes]) -> str:
72 return (
73 value.decode("utf-8", errors="replace") if isinstance(value, bytes) else value
74 )
75
76
77def safe_str(value):

Calls 1

decodeMethod · 0.80