Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
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
71
def
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
77
def
safe_str(value):
Callers
15
test_change_username_password_on_existing_connection
Method · 0.90
test_empty_startup_nodes
Method · 0.90
test_handling_cluster_failover_to_a_replica
Method · 0.90
test_cluster_shards
Method · 0.90
test_cluster_links
Method · 0.90
test_change_username_password_on_existing_connection
Method · 0.90
test_empty_startup_nodes
Method · 0.90
test_cluster_links
Method · 0.90
handle_message
Method · 0.90
fix_server
Function · 0.90
parse_cluster_shards_unified
Function · 0.90
on_connect
Method · 0.90
Calls
1
decode
Method · 0.80
Tested by
8
test_change_username_password_on_existing_connection
Method · 0.72
test_empty_startup_nodes
Method · 0.72
test_handling_cluster_failover_to_a_replica
Method · 0.72
test_cluster_shards
Method · 0.72
test_cluster_links
Method · 0.72
test_change_username_password_on_existing_connection
Method · 0.72
test_empty_startup_nodes
Method · 0.72
test_cluster_links
Method · 0.72