Skip to content

Flag¤

Flag ¤

Bases: IntFlag

Message flags for compression and serialisation.

You may use a single flag or take a bitwise union of one serialisation flag with one compression flag, e.g.,

  • Flag.JSON — JSON serialisation. No compression.
  • Flag.ZLIB — No serialisation. ZLIB compression.
  • Flag.PICKLE | Flag.ZSTD — Pickle serialisation. ZSTD compression.

A KeyError will be raised if you use a flag that is a union of more than one serialisation flag or more than one compression flag when a request or a reply is sent.

Attributes:

Name Type Description
NONE int

Do not apply (de)serialisation or (de)compression. This flag is only useful if a method of a Service returns an object that supports the buffer protocol. As such, this flag is only applicable for a reply and cannot be used for a request.

BZIP2 int

(De)compression using the bzip2 format.

XZ int

(De)compression using the xz format.

ZLIB int

(De)compression using the zlib library.

ZSTD int

(De)compression using the Zstandard algorithm.

PICKLE int

(De)serialisation using the pickle module.

JSON int

(De)serialisation using the builtin json module.

ORJSON int

(De)serialisation using the orjson package. Includes the option OPT_SERIALIZE_NUMPY when serialising.