(msgid)
| 239 | |
| 240 | |
| 241 | def msgid2py(msgid): |
| 242 | t = msgid.type |
| 243 | if t == PN_NULL: |
| 244 | return None |
| 245 | elif t == PN_ULONG: |
| 246 | return msgid.u.as_ulong |
| 247 | elif t == PN_BINARY: |
| 248 | return bytes2py(msgid.u.as_bytes) |
| 249 | elif t == PN_STRING: |
| 250 | return bytes2string(msgid.u.as_bytes) |
| 251 | elif t == PN_UUID: |
| 252 | return UUID(bytes=uuid2bytes(msgid.u.as_uuid)) |
| 253 | # These two cases are for compatibility with the broken ruby binding |
| 254 | elif t == PN_INT: |
| 255 | v = msgid.u.as_int |
| 256 | if v >= 0: |
| 257 | return v |
| 258 | return None |
| 259 | elif t == PN_LONG: |
| 260 | v = msgid.u.as_long |
| 261 | if v >= 0: |
| 262 | return v |
| 263 | return None |
| 264 | return None |
| 265 | |
| 266 | |
| 267 | def py2msgid(py): |
no test coverage detected