MCPcopy Index your code
hub / github.com/tinode/chat / encode_to_bytes

Function encode_to_bytes

tn-cli/utils.py:152–157  ·  view source on GitHub ↗
(src)

Source from the content-addressed store, hash-verified

150# An object/dictionary is first converted to json string then it's converted to bytes.
151# A string is directly converted to bytes.
152def encode_to_bytes(src):
153 if src == None:
154 return None
155 if isinstance(src, str):
156 return ('"' + src + '"').encode()
157 return json.dumps(src).encode('utf-8')
158
159
160# Parse credentials

Callers 4

accMsgFunction · 0.90
subMsgFunction · 0.90
pubMsgFunction · 0.90
setMsgFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…