Decode the AMQP table passed in from the encoded value returning the decoded result and the number of bytes read plus the offset. :param str encoded: The binary encoded data to decode :param int offset: The starting byte offset :rtype: tuple
(encoded: bytes,
offset: int)
| 144 | |
| 145 | |
| 146 | def decode_table(encoded: bytes, |
| 147 | offset: int) -> Tuple[Dict[Union[str, bytes], Any], int]: |
| 148 | """Decode the AMQP table passed in from the encoded value returning the |
| 149 | decoded result and the number of bytes read plus the offset. |
| 150 | |
| 151 | :param str encoded: The binary encoded data to decode |
| 152 | :param int offset: The starting byte offset |
| 153 | :rtype: tuple |
| 154 | |
| 155 | """ |
| 156 | result = {} |
| 157 | tablesize = struct.unpack_from('>I', encoded, offset)[0] |
| 158 | offset += 4 |
| 159 | limit = offset + tablesize |
| 160 | while offset < limit: |
| 161 | key, offset = decode_short_string(encoded, offset) |
| 162 | value, offset = decode_value(encoded, offset) |
| 163 | result[key] = value |
| 164 | return result, offset |
| 165 | |
| 166 | |
| 167 | def decode_value(encoded: bytes, offset: int) -> Tuple[Any, int]: # pylint: disable=R0912,R0915 |
no test coverage detected
searching dependent graphs…