Return the header_little_endian attribute of the BFD file being
        processed.
163583
def header_little_endian(self):
        
        if not self._ptr:
            raise BfdException("BFD not initialized")

        return _bfd.get_bfd_attribute(
            self._ptr, BfdAttributes.HEADER_LITTLE_ENDIAN)
404102
def getheaderAnim(self, im):
        
        bb = "GIF89a"
        bb += intToBin(im.size[0])
        bb += intToBin(im.size[1])
        bb += "\x87\x00\x00"
        return bb
311953
def write_int8(self, value, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.pack('%sb' % endian, value)
570322
def read_uint32(self, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.unpack('%sI' % endian, 4)
1031844
def bytes2guid(s):
    """"""

    assert isinstance(s, bytes)

    u = struct.unpack
    v = []
    v.extend(u("<IHH", s[:8]))
    v.extend(u(">HQ", s[8:10] + b"\x00\x00" + s[10:]))
    return "%08X-%04X-%04X-%04X-%012X" % tuple(v)
973239
def size(self) -> Optional[int]:
        """"""
        if not self._parts:
            return 0

        total = 0
        for part, encoding, te_encoding in self._parts:
            if encoding or te_encoding or part.size is None:
                return None

            total += int(
                2 + len(self._boundary) + 2 +  # b'--'+self._boundary+b'\r\n'
                part.size + len(part._binary_headers) +
                2  # b'\r\n'
            )

        total += 2 + len(self._boundary) + 4  # b'--'+self._boundary+b'--\r\n'
        return total
795367
def read_int64(self, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.unpack('%sq' % endian, 8)
1025251
def read_float(self, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.unpack("%sf" % endian, 4)
169216
def getheaderAnim(self, im):
        
        bb = b'GIF89a'
        bb += intToBin(im.size[0])
        bb += intToBin(im.size[1])
        bb += b'\x87\x00\x00'
        return bb
44251
def write_uint16(self, value, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.pack('%sH' % endian, value)
116099
def _get_header(self):
        """"""
        fh = self._src
        obj = _make_object("Header")

        # first part of the header
        obj.Signature = sign = "".join(chr(unpack_ui8(fh)) for _ in range(3))
        obj.Version = self._version = unpack_ui8(fh)
        obj.FileLength = file_length = unpack_ui32(fh)

        # deal with compressed content
        if sign[0] == 'C':
            uncompressed = zlib.decompress(fh.read())
            if len(uncompressed) + 8 != file_length:
                raise ValueError("Problems dealing with compressed content")
            fh = self._src = io.BytesIO(uncompressed)

        # second part of the header
        obj.FrameSize = self._get_struct_rect()
        obj.FrameRate = unpack_ui16(fh)
        obj.FrameCount = unpack_ui16(fh)
        return obj
1226670
def _parse_header(self, data):
        

        (magic, word_size, byte_order, version, osabi, abi_version, _), data = \
            unpack('4sBBBBB7s', data[:16]), data[16:]

        assert magic == self._ELF_MAGIC, 'Missing ELF magic'
        assert word_size in (1, 2), 'Invalid word size'
        assert byte_order in (1, 2), 'Invalid byte order'

        assert version == 1, 'Invalid version'

        self.osabi = self.OSABI(osabi)
        self.abi_version = abi_version

        endian = Target.Endian(byte_order - 1)
        (type_, machine, version), data = unpack('HHI', data[:8], endian=endian), data[8:]

        try:
            self.type = self.Type(type_)
        except ValueError:
            self.type = self.Type.unknown

        try:
            self.machine = ELF.Machine(machine)
        except ValueError:
            self.machine = ELF.Machine.unknown

        assert version == 1, 'Invalid version'

        if self.machine is ELF.Machine.i386:
            arch = Target.Arch.x86
            assert word_size == 1, 'Unexpected ELF64 for machine type x86'
            assert endian is Target.Endian.little, 'Unexpected big-endian for machine type x86'
        elif self.machine is ELF.Machine.x86_64:
            arch = Target.Arch.x86
            assert word_size == 2, 'Unexpected ELF32 for machine type x64_64'
            assert endian is Target.Endian.little, 'Unexpected big-endian for machine type x86'
        elif self.machine is ELF.Machine.arm:
            arch = Target.Arch.arm
            assert word_size == 1, 'Unexpected ELF64 for machine type arm'
        elif self.machine is ELF.Machine.aarch64:
            arch = Target.Arch.arm
            assert word_size == 2, 'Unexpected ELF32 for machine type aarch64'
        else:
            arch = Target.Arch.unknown

        self.arch = arch
        self.bits = 32 * word_size
        self.endian = endian

        if self.bits == 32:
            fmt = 'IIIIHHHHHH'
        else:
            fmt = 'QQQIHHHHHH'

        fmt_size = pack_size(fmt)
        (self.entry, self.phoff, self.shoff, self.flags, self.hsize, self.phentsize,
            self.phnum, self.shentsize, self.shnum, self.shstrndx) = \
            unpack(fmt, data[:fmt_size], target=self)
396783
def read_data(file, endian, num=1):
    
    res = struct.unpack(endian + 'L' * num, file.read(num * 4))
    if len(res) == 1:
        return res[0]
    return res
913607
def read_uint8(self, little_endian=True):
        
        if little_endian:
            endian = "<"
        else:
            endian = ">"
        return self.unpack('%sB' % endian)
603304
def _header_bytefmt_byteorder(geom_type, num_dims, big_endian, meta=None):
    
    dim = _INT_TO_DIM_LABEL.get(num_dims)
    if dim is None:
        pass  # TODO: raise

    type_byte_str = _WKB[dim][geom_type]
    srid = meta.get('srid')
    if srid is not None:
        # Add the srid flag
        type_byte_str = SRID_FLAG + type_byte_str[1:]

    if big_endian:
        header = BIG_ENDIAN
        byte_fmt = b'>'
        byte_order = '>'
    else:
        header = LITTLE_ENDIAN
        byte_fmt = b'<'
        byte_order = '<'
        # reverse the byte ordering for little endian
        type_byte_str = type_byte_str[::-1]

    header += type_byte_str
    if srid is not None:
        srid = int(srid)

        if big_endian:
            srid_header = struct.pack('>i', srid)
        else:
            srid_header = struct.pack('<i', srid)
        header += srid_header
    byte_fmt += b'd' * num_dims

    return header, byte_fmt, byte_order
1106569
def record_little_endian(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Path Table Record not yet initialized')

        return self._record(self.extent_location, self.parent_directory_num)
1152269
def has_gap_in_elf_shndx(self):
        
        if not self._ptr:
            raise BfdException("BFD not initialized")

        return _bfd.get_bfd_attribute(
            self._ptr, BfdAttributes.HAS_GAP_IN_ELF_SHNDX)