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

Function make_message

tests/test_pubsub.py:55–61  ·  view source on GitHub ↗
(type, channel, data, pattern=None)

Source from the content-addressed store, hash-verified

53
54
55def make_message(type, channel, data, pattern=None):
56 return {
57 "type": type,
58 "pattern": pattern and pattern.encode("utf-8") or None,
59 "channel": channel and channel.encode("utf-8") or None,
60 "data": data.encode("utf-8") if isinstance(data, str) else data,
61 }
62
63
64def make_subscribe_test_data(pubsub, type):

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected