pamqp.decode
Functions for decoding data of various types including field tables and arrays
- pamqp.decode.by_type(value: bytes, data_type: str, offset: int = 0) Tuple[int, Union[bool, bytearray, decimal.Decimal, List[FieldValue], Dict[str, FieldValue], float, int, None, str, datetime.datetime]][source]
Decodes values using the specified type
- Parameters
value – The binary value to decode
data_type – The data type name of the value
offset – The starting position of the data in the byte stream
- Return type
tuple(int,pamqp.common.FieldValue)- Raises
ValueError – when the data type is unknown
- pamqp.decode.bit(value: bytes, position: int) Tuple[int, bool][source]
Decode a bit value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
position – The position in the byte of the bit value
- Return type
tuple(int,bool)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.boolean(value: bytes) Tuple[int, bool][source]
Decode a boolean value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,bool)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.byte_array(value: bytes) Tuple[int, bytearray][source]
Decode a byte_array value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,bytearray)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.decimal(value: bytes) Tuple[int, decimal.Decimal][source]
Decode a decimal value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,decimal.Decimal)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.double(value: bytes) Tuple[int, float][source]
Decode a double value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,float)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.floating_point(value: bytes) Tuple[int, float][source]
Decode a floating point value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,float)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.long_int(value: bytes) Tuple[int, int][source]
Decode a long integer value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,int)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.long_uint(value: bytes) Tuple[int, int][source]
Decode an unsigned long integer value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,int)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.long_long_int(value: bytes) Tuple[int, int][source]
Decode a long-long integer value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,int)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.long_str(value: bytes) Tuple[int, str][source]
Decode a string value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,str)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.octet(value: bytes) Tuple[int, int][source]
Decode an octet value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,int)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.short_int(value: bytes) Tuple[int, int][source]
Decode a short integer value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,int)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.short_uint(value: bytes) Tuple[int, int][source]
Decode an unsigned short integer value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,int)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.short_short_int(value: bytes) Tuple[int, int][source]
Decode a short-short integer value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,int)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.short_short_uint(value: bytes) Tuple[int, int][source]
Decode a unsigned short-short integer value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,int)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.short_str(value: bytes) Tuple[int, str][source]
Decode a string value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,str)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.timestamp(value: bytes) Tuple[int, datetime.datetime][source]
Decode a timestamp value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,datetime.datetime)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.embedded_value(value: bytes) Tuple[int, Union[bool, bytearray, decimal.Decimal, List[FieldValue], Dict[str, FieldValue], float, int, None, str, datetime.datetime]][source]
Dynamically decode a value based upon the starting byte
- Parameters
value – The binary value to decode
- Return type
tuple(int,pamqp.common.FieldValue)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.field_array(value: bytes) Tuple[int, List[FieldValue]][source]
Decode a field array value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,pamqp.common.FieldArray)- Raises
ValueError – when the binary data can not be unpacked
- pamqp.decode.field_table(value: bytes) Tuple[int, Dict[str, FieldValue]][source]
Decode a field array value, returning bytes consumed and the value.
- Parameters
value – The binary value to decode
- Return type
tuple(int,pamqp.common.FieldTable)- Raises
ValueError – when the binary data can not be unpacked