(self, stream, additional_info)
| 825 | |
| 826 | # Major type 0 - unsigned integers |
| 827 | def _parse_unsigned_integer(self, stream, additional_info): |
| 828 | additional_info_to_num_bytes = { |
| 829 | 24: 1, |
| 830 | 25: 2, |
| 831 | 26: 4, |
| 832 | 27: 8, |
| 833 | } |
| 834 | # Values under 24 don't need a full byte to be stored; their values are |
| 835 | # instead stored as the "additional info" in the initial byte |
| 836 | if additional_info < 24: |
| 837 | return additional_info |
| 838 | elif additional_info in additional_info_to_num_bytes: |
| 839 | num_bytes = additional_info_to_num_bytes[additional_info] |
| 840 | return self._read_bytes_as_int(stream, num_bytes) |
| 841 | else: |
| 842 | raise ResponseParserError( |
| 843 | "Invalid CBOR integer returned from the service; unparsable " |
| 844 | f"additional info found for major type 0 or 1: {additional_info}" |
| 845 | ) |
| 846 | |
| 847 | # Major type 1 - negative integers |
| 848 | def _parse_negative_integer(self, stream, additional_info): |
no test coverage detected