MCPcopy
hub / github.com/geldata/gel / deserialize

Function deserialize

tests/test_pgext.py:487–503  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

485
486
487def deserialize(data):
488 buf = memoryview(data)
489
490 while buf:
491 msg_type = bytes(buf[:1])
492 msg_size = struct.unpack("!I", buf[1:5])[0]
493 payload = buf[5 : msg_size + 1]
494 cls = messages_by_type.get(msg_type)
495 if cls is None:
496 if DEBUG:
497 print(PID, "< ", "skipping:", bytes(buf[: msg_size + 1]))
498 else:
499 rv = cls.deserialize(payload)
500 if DEBUG:
501 print(PID, "< ", rv)
502 yield rv
503 buf = buf[msg_size + 1:]
504
505
506class PgProtocol(asyncio.Protocol):

Callers 1

data_receivedMethod · 0.70

Calls 3

printFunction · 0.85
getMethod · 0.45
deserializeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…