parameters: (buf, signed=True, strict=True)
return_statement: return leading
docstring: Decode an integer.
  
      Args:
          buf: a string or string buffer.
          signed: if True, decode in two's complement form. If False, decode as
              an unsigned integer.
  
      Raises:
          ASN1Error.
  
      Returns:
          an integer.
docstring_summary: Decode an integer.
docstring_tokens: Decode an integer .
function: def decode_int(buf, signed=True, strict=True):
      """Decode an integer.
  
      Args:
          buf: a string or string buffer.
          signed: if True, decode in two's complement form. If False, decode as
              an unsigned integer.
  
      Raises:
          ASN1Error.
  
      Returns:
          an integer.
      """
      if not buf:
          raise error.ASN1Error("Invalid integer encoding: empty value")
  
      leading = ord(buf[0])
      int_bytes = bytearray(buf[1:])
  
      if int_bytes:
        if strict and leading == 0 and int_bytes[0] < 128:
          # 0x00 0x42 == 0x42
          raise error.ASN1Error("Extra leading 0-bytes in integer "
                                "encoding")
        elif strict and signed and leading == 0xff and int_bytes[0] >= 128:
          # 0xff 0x82 == 0x82
          raise error.ASN1Error("Extra leading 0xff-bytes in negative "
                                "integer encoding")
  
      if signed and leading > 127:
              leading -= 256
  
      for b in int_bytes:
          leading <<= 8
          leading += b
  
      return leading
function_tokens: def decode_int ( buf , signed = True , strict = True ) : if not buf : raise error . ASN1Error ( "Invalid integer encoding: empty value" ) leading = ord ( buf [ 0 ] ) int_bytes = bytearray ( buf [ 1 : ] ) if int_bytes : if strict and leading == 0 and int_bytes [ 0 ] < 128 : # 0x00 0x42 == 0x42 raise error . ASN1Error ( "Extra leading 0-bytes in integer " "encoding" ) elif strict and signed and leading == 0xff and int_bytes [ 0 ] >= 128 : # 0xff 0x82 == 0x82 raise error . ASN1Error ( "Extra leading 0xff-bytes in negative " "integer encoding" ) if signed and leading > 127 : leading -= 256 for b in int_bytes : leading <<= 8 leading += b return leading