MCPcopy Index your code
hub / github.com/aws/aws-cli / _parse_unsigned_integer

Method _parse_unsigned_integer

awscli/botocore/parsers.py:827–845  ·  view source on GitHub ↗
(self, stream, additional_info)

Source from the content-addressed store, hash-verified

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):

Callers 5

_parse_byte_stringMethod · 0.95
_parse_arrayMethod · 0.95
_parse_mapMethod · 0.95
_parse_tagMethod · 0.95

Calls 2

_read_bytes_as_intMethod · 0.95
ResponseParserErrorClass · 0.85

Tested by

no test coverage detected