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

Method _normalize_keys

redis/client.py:1310–1318  ·  view source on GitHub ↗

normalize channel/pattern names to be either bytes or strings based on whether responses are automatically decoded. this saves us from coercing the value for each message coming in.

(self, data)

Source from the content-addressed store, hash-verified

1308 self.health_check_response_counter += 1
1309
1310 def _normalize_keys(self, data) -> Dict:
1311 """
1312 normalize channel/pattern names to be either bytes or strings
1313 based on whether responses are automatically decoded. this saves us
1314 from coercing the value for each message coming in.
1315 """
1316 encode = self.encoder.encode
1317 decode = self.encoder.decode
1318 return {decode(encode(k)): v for k, v in data.items()}
1319
1320 def psubscribe(
1321 self, *args: ChannelT | Subscription, **kwargs: PubSubHandler

Callers 9

psubscribeMethod · 0.95
punsubscribeMethod · 0.95
subscribeMethod · 0.95
unsubscribeMethod · 0.95
ssubscribeMethod · 0.95
sunsubscribeMethod · 0.95
ssubscribeMethod · 0.45
sunsubscribeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected