pack a FD FDM buffer from current values
544184
def pack(self):
        ''''''
        for i in range(len(self.values)):
            if math.isnan(self.values[i]):
                self.values[i] = 0
        return struct.pack(self.pack_string, *self.values)
1301938
def SaveDataToFD(self, raw_data, fd):
    """"""
    for key, value in iteritems(raw_data):
      # TODO(hanuszczak): Incorrect type specification for `set`.
      # pytype: disable=wrong-arg-types
      self.set("", key, value=value)
      # pytype: enable=wrong-arg-types

    self.write(fd)
698069
def attach_to_fbo(self):
        """"""
        gl.glFramebufferTexture2DEXT(gl.GL_FRAMEBUFFER_EXT, self.attachment_point, self.target0, self.id, 0)
1310986
def read_cz_lsm_info(fd, byte_order, dtype, count):
    """"""
    result = numpy.rec.fromfile(fd, CZ_LSM_INFO, 1,
                                byteorder=byte_order)[0]
    {50350412: '1.3', 67127628: '2.0'}[result.magic_number]  # validation
    return result
812067
def getDMCparam(fn: Path, xyPix, xyBin,
                FrameIndReq=None, ut1req=None, kineticsec=None, startUTC=None, nHeadBytes=4, verbose=0):
    
    Nmetadata = nHeadBytes // 2  # FIXME for DMCdata version 1 only

    if not fn.is_file():  # leave this here, getsize() doesn't fail on directory
        raise ValueError(f'{fn} is not a file!')

    print(f'reading {fn}')

    # int() in case we are fed a float or int
    SuperX = int(xyPix[0] // xyBin[0])
    SuperY = int(xyPix[1] // xyBin[1])

    PixelsPerImage, BytesPerImage, BytesPerFrame = howbig(
        SuperX, SuperY, nHeadBytes)

    (firstRawInd, lastRawInd) = getRawInd(
        fn, BytesPerImage, nHeadBytes, Nmetadata)

    FrameIndRel = whichframes(fn, FrameIndReq, kineticsec, ut1req, startUTC, firstRawInd, lastRawInd,
                              BytesPerImage, BytesPerFrame, verbose)

    return {'superx': SuperX, 'supery': SuperY, 'nmetadata': Nmetadata,
            'bytesperframe': BytesPerFrame, 'pixelsperimage': PixelsPerImage,
            'nframeextract': FrameIndRel.size,
            'frameindrel': FrameIndRel}
1131543
def dbus_readBytesTwoFDs(self, fd1, fd2, byte_count):
        
        result = bytearray()
        for fd in (fd1, fd2):
            f = os.fdopen(fd, 'rb')
            result.extend(f.read(byte_count))
            f.close()
        return result
673373
public synchronized static void read(int fd, ByteBuffer buffer) throws IOException{
        byte[] data = read(fd);
        buffer.put(data);
    }
521362
def output_to_fd(self, fd):
        
        for library in self.libraries_found:
            fd.write("%s==%s\n" % (library.key, library.version))
116475
def _parse_fmdump_verbose(output):
    '''
    
    '''
    result = []
    output = output.split("\n")

    fault = []
    verbose_fault = {}
    for line in output:
        if line.startswith('TIME'):
            fault.append(line)
            if verbose_fault:
                result.append(verbose_fault)
                verbose_fault = {}
        elif len(fault) == 1:
            fault.append(line)
            verbose_fault = _parse_fmdump("\n".join(fault))[0]
            fault = []
        elif verbose_fault:
            if 'details' not in verbose_fault:
                verbose_fault['details'] = ""
            if line.strip() == '':
                continue
            verbose_fault['details'] = '{0}{1}\n'.format(
                verbose_fault['details'],
                line
            )
    if verbose_fault:
        result.append(verbose_fault)

    return result
88839
function updateGreyColorBuffer(buf) {
  for (let i = 0; i < buf.length; ++i) {
    buf[i] = 0.5;
  }
  return buf;
}
938309
def raw(mime='application/octet-stream'):
    '''
    
    '''
    def dfn(fn):
        tags = getattr(fn, 'tags', set())
        tags.add('raw')
        fn.tags = tags
        fn.mime = getattr(fn, 'mime', mime)
        return fn
    return dfn
279320
def pack_value(self, val):
        """"""
        if isinstance(val, bytes):
            val = list(iterbytes(val))

        slen = len(val)

        if self.pad:
            pad = b'\0\0' * (slen % 2)
        else:
            pad = b''

        return struct.pack('>' + 'H' * slen, *val) + pad, slen, None
579391
def dumpb(obj, container_count=False, sort_keys=False, no_float32=True, default=None):
    """"""
    with BytesIO() as fp:
        dump(obj, fp, container_count=container_count, sort_keys=sort_keys, no_float32=no_float32, default=default)
        return fp.getvalue()
172678
def pack(cls, data):
        ''''''
        return struct.pack('>ll', len(data) + 4, cls.FRAME_TYPE) + data
942079
public final void fstp(Mem dst)
  {
    assert(dst.size() == 4 || dst.size() == 8 || dst.size() == 10);
    emitX86(INST_FSTP, dst);
  }
79387
def from_fptr(cls, label, type_, fptr):
        """"""
        return FSEntry(
            label=label,
            type=type_,
            path=fptr.path,
            use=fptr.use,
            file_uuid=fptr.file_uuid,
            derived_from=fptr.derived_from,
            checksum=fptr.checksum,
            checksumtype=fptr.checksumtype,
        )
658688
def read(self, ulBuffer, pDst, unBytes):
        """"""

        fn = self.function_table.read
        punRead = c_uint32()
        result = fn(ulBuffer, pDst, unBytes, byref(punRead))
        return result, punRead.value