Skip to content

Celery Protocol

lingo.celery.protocol

Serialization protocol for broker-safe task payload transfer.

deserialize_phrase(payload: dict[str, Any]) -> Phrase

Deserialize phrase graph from transport payload.

Source code in lingo/celery/protocol.py
192
193
194
195
196
197
def deserialize_phrase(payload: dict[str, Any]) -> Phrase:
    """Deserialize phrase graph from transport payload."""
    phrase = deserialize_value(payload)
    if not isinstance(phrase, Phrase):
        raise TypeError("Payload did not deserialize to Phrase")
    return phrase

serialize_phrase(phrase: Phrase, *, prefer_local_paths: bool = False) -> dict[str, Any]

Serialize phrase graph for transport.

Source code in lingo/celery/protocol.py
187
188
189
def serialize_phrase(phrase: Phrase, *, prefer_local_paths: bool = False) -> dict[str, Any]:
    """Serialize phrase graph for transport."""
    return serialize_value(phrase, prefer_local_paths=prefer_local_paths)