(py)
| 265 | |
| 266 | |
| 267 | def 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() |
no test coverage detected