MCPcopy Create free account
hub / github.com/apache/qpid-proton / py2msgid

Function py2msgid

python/cproton.py:267–281  ·  view source on GitHub ↗
(py)

Source from the content-addressed store, hash-verified

265
266
267def py2msgid(py):
268 if py is None:
269 return {'type': PN_NULL}
270 elif isinstance(py, int):
271 return {'type': PN_ULONG, 'u': {'as_ulong': py}}
272 elif isinstance(py, str):
273 return {'type': PN_STRING, 'u': {'as_bytes': string2bytes(py)}}
274 elif isinstance(py, bytes):
275 return {'type': PN_BINARY, 'u': {'as_bytes': py2bytes(py)}}
276 elif isinstance(py, UUID):
277 return {'type': PN_UUID, 'u': {'as_uuid': {'bytes': py.bytes}}}
278 elif isinstance(py, tuple):
279 if py[0] == PN_UUID:
280 return {'type': PN_UUID, 'u': {'as_uuid': {'bytes': py[1]}}}
281 return {'type': PN_NULL}
282
283
284@ffi.def_extern()

Callers 2

pn_message_set_idFunction · 0.85

Calls 2

string2bytesFunction · 0.85
py2bytesFunction · 0.85

Tested by

no test coverage detected