memory_descriptor: MINIDUMP_MEMORY_DESCRIPTOR
		buff: file_handle
546820
def parse_mini(memory_decriptor, buff):
		
		mms = MinidumpMemorySegment()
		mms.start_virtual_address = memory_decriptor.StartOfMemoryRange
		mms.size = memory_decriptor.Memory.DataSize
		mms.start_file_address = memory_decriptor.Memory.Rva
		mms.end_virtual_address = mms.start_virtual_address + mms.size
		return mms
396892
def write_file_to_descriptor(input_queue, descriptor):
    
    try:
        file_name = input_queue.get(timeout=2)
        descriptor.write("{}\n".format(file_name))
        descriptor.flush()
        input_queue.task_done()
        return True
    except Empty:
        # no more files in queue
        descriptor.close()
        return False
    except IOError:
        return False
483297
def download_image(self, handle, dest):
        
        shutil.copyfile(self._prefixed(handle), dest)
1231099
def getMemoryUse(self):
        
        info_dict = {}
        try:
            fp = open(meminfoFile, 'r')
            data = fp.read()
            fp.close()
        except:
            raise IOError('Failed reading stats from file: %s' % meminfoFile)
        for line in data.splitlines():
            mobj = re.match('^(.+):\s*(\d+)\s*(\w+|)\s*$', line)
            if mobj:
                if mobj.group(3).lower() == 'kb':
                    mult = 1024
                else:
                    mult = 1
                info_dict[mobj.group(1)] = int(mobj.group(2)) * mult
        return info_dict
407379
def load_machine(self, descriptor):
		
		def get_cfg(name):
			if(name in descriptor):
				return descriptor[name]
			else:
				return defaults[name]
		self.processor = Processor(width = get_cfg("width"))
		self.rom = ROM(get_cfg("rom_size"), get_cfg("rom_width"))
		self.processor.register_memory_device(self.rom)
		self.registers = []

		if(get_cfg("ram_enable")):
			self.ram = RAM(get_cfg("ram_size"), get_cfg("ram_width"))
			self.processor.register_memory_device(self.ram)
		else:
			self.ram = None

		if(get_cfg("flash_enable")):
			self.flash = Flash(get_cfg("flash_size"), get_cfg("flash_width"))
			self.processor.register_device(self.flash)
		else:
			self.flash = None

		for register in get_cfg("registers"):
			self.processor.add_register(register)
			self.registers.append(register)
		for command in get_cfg("commands"):
			self.processor.register_command(command)
		self.processor.setup_done()
75282
def get_memory_tar(image_path):
    '''
    '''
    byte_array = Client.image.export(image_path)
    file_object = io.BytesIO(byte_array)
    tar = tarfile.open(mode="r|*", fileobj=file_object)
    return (file_object,tar)
878331
def _get_local_ref(region, ref_file, out_vcf_base):
    
    out_file = "{0}.fa".format(out_vcf_base)
    if not file_exists(out_file):
        with pysam.Fastafile(ref_file) as in_pysam:
            contig, start, end = region
            seq = in_pysam.fetch(contig, int(start), int(end))
            with open(out_file, "w") as out_handle:
                out_handle.write(">{0}-{1}-{2}\n{3}".format(contig, start, end,
                                                              str(seq)))
    with open(out_file) as in_handle:
        in_handle.readline()
        size = len(in_handle.readline().strip())
    return out_file, size
799371
def write_mps(filename)
      ret = GLPK.glp_write_mps @ptr, GLPK::GLP_MPS_FILE, nil, filename
      fail if ret != 0
    end
273525
def memcpy_htod(self, dest, src):
        
        if isinstance(dest, drv.DeviceAllocation):
            drv.memcpy_htod(dest, src)
        else:
            dest = src
331983
def file_handler(self, handler_type, path, prefixed_path, source_storage):
        
        if self.faster:
            if prefixed_path not in self.found_files:
                self.found_files[prefixed_path] = (source_storage, path)

            self.task_queue.put({
                'handler_type': handler_type,
                'path': path,
                'prefixed_path': prefixed_path,
                'source_storage': source_storage
            })
            self.counter += 1
        else:
            if handler_type == 'link':
                super(Command, self).link_file(path, prefixed_path, source_storage)
            else:
                super(Command, self).copy_file(path, prefixed_path, source_storage)
369828
private Snapshot createMemorySnapshot(SnapshotDescriptor descriptor) {
    HeapBuffer buffer = HeapBuffer.allocate(SnapshotDescriptor.BYTES, Integer.MAX_VALUE);
    Snapshot snapshot = new MemorySnapshot(buffer, descriptor.copyTo(buffer), this);
    LOGGER.debug("Created memory snapshot: {}", snapshot);
    return snapshot;
  }
206711
function (storeOrEditor, from, to) {
    debug('Performing inMemoryMove from ' + from + ' to ' + to);
    var store = (storeOrEditor && storeOrEditor.store ? storeOrEditor.store : storeOrEditor);
    var memFsEditor = require('mem-fs-editor').create(store);
    var fromLen = from.length;
    store.each(function (file) {
      var idx = file.path.indexOf(from);
      if (idx === 0 && file.contents !== null && file.state !== 'deleted') {
        var absTo = path.join(to, file.path.substr(fromLen));
        // exact match so we are copying a single file and not a folder
        if (fromLen === file.path.length) {
          absTo = path.join(to, path.basename(file.path));
        }
        debug('IN-MEMORY MOVING FROM: ' + file.path + ' TO: ' + absTo);
        memFsEditor.move(file.path, absTo);
      }
    });
  }
2270
def fix_insert_size(in_bam, config):
    
    fixed_file = os.path.splitext(in_bam)[0] + ".pi_fixed.bam"
    if file_exists(fixed_file):
        return fixed_file
    header_file = os.path.splitext(in_bam)[0] + ".header.sam"
    read_length = bam.estimate_read_length(in_bam)
    bam_handle= bam.open_samfile(in_bam)
    header = bam_handle.header.copy()
    rg_dict = header['RG'][0]
    if 'PI' not in rg_dict:
        return in_bam
    PI = int(rg_dict.get('PI'))
    PI = PI + 2*read_length
    rg_dict['PI'] = PI
    header['RG'][0] = rg_dict
    with pysam.Samfile(header_file, "wb", header=header) as out_handle:
        with bam.open_samfile(in_bam) as in_handle:
            for record in in_handle:
                out_handle.write(record)
    shutil.move(header_file, fixed_file)
    return fixed_file
531105
def getFileHandle(self, dataFile, openMethod):
        
        if dataFile in self._memoTable:
            handle = self._memoTable[dataFile]
            self._update(dataFile, handle)
            return handle
        else:
            try:
                handle = openMethod(dataFile)
            except ValueError:
                raise exceptions.FileOpenFailedException(dataFile)

            self._memoTable[dataFile] = handle
            self._add(dataFile, handle)
            if len(self._memoTable) > self._maxCacheSize:
                dataFile = self._removeLru()
                del self._memoTable[dataFile]
            return handle
459636
def make_variable_handler(dec_f, sized_values, min_size, non_minimal_data_handler):
    
    sized_values = list(sized_values)

    def f(script, pc, verify_minimal_data=False):
        size, pc = dec_f(script, pc)
        data = bytes_as_hex(script[pc:pc+size])
        if len(data) < size:
            return pc+1, None
        if verify_minimal_data:
            if size in sized_values or size <= min_size:
                non_minimal_data_handler("not minimal push of data with size %d" % size)
        return pc+size, data
    return f
196807
def memcpy_dtoh(self, dest, src):
        
        if isinstance(src, cl.Buffer):
            cl.enqueue_copy(self.queue, dest, src)
967594
@Override
    public void memcpyAsync(DataBuffer dstBuffer, Pointer srcPointer, long length, long dstOffset) {
        //        if (dstBuffer.isConstant()) {
        //            this.memoryHandler.memcpySpecial(dstBuffer, srcPointer, length, dstOffset);
        //        } else
        this.memoryHandler.memcpyAsync(dstBuffer, srcPointer, length, dstOffset);
    }