Converts the given input data to the Blast format.

 @param [Array] data The data we wish to convert

 @param [Boolean] Is this the first output batch?

 @return [String] The converted input data in the Blast format
496476
def convert(data, _first)
      data
        .reject { |o| o['refseq_protein_ids'].empty? }
        .map do |o|
          "#{o['peptide']}\tref|#{o['refseq_protein_ids']}|\t100\t10\t0\t0\t0\t10\t0\t10\t1e-100\t100\n"
        end
        .join
    end
159970
function format(data) {
    const time = util.formatTime(new Date());
    const outputArray = data.toString().replace(/^\s+|\s+$/g, '').split(/\s+/);
    const outputValues = [];
    for (let i = 0, counter = 0; i < outputArray.length; i++) {
        if (!isNaN(outputArray[i])) {
            outputValues[counter] = parseFloat(outputArray[i]);
            counter++;
        }
    }
    if (outputValues.length > 0) {
        return {
            date: time,
            disk: {
                kb_read: outputValues[9],
                kb_wrtn: outputValues[10],
                kb_read_per: outputValues[7],
                kb_wrtn_per: outputValues[8],
                tps: outputValues[6]
            },
            cpu: {
                cpu_user: outputValues[0],
                cpu_nice: outputValues[1],
                cpu_system: outputValues[2],
                cpu_iowait: outputValues[3],
                cpu_steal: outputValues[4],
                cpu_idle: outputValues[5]
            }
        };
    }
    return false;
}
1163298
function(data) {

		return data instanceof Object && (
		(this.domInstance('input', data) && data.type === 'file') ||
		('FileList' in window && data instanceof window.FileList) ||
		('File' in window && data instanceof window.File) ||
		('Blob' in window && data instanceof window.Blob));

	}
1001742
def print_or_write(data)
      if opts[:output_file]
        File.open(opts[:output_file], "w") { |f| f.write(data) }
      else
        puts data
      end
    end
1054098
def parse(data)
      return unless data
      data.each do |line|
        key, value = line.split(':', 2)
        if key =~ /^FRU.*/
          if value =~ /([\w\s]*)\(.*\)/
            self[:name] = $~[1].strip.gsub(/\ /, '_').downcase
          end
        else
          key = key.strip.gsub(/\ /, '_').downcase.gsub(/fru_/, '')
          self[key] = value.strip unless value.nil?
        end
      end
    end
137285
def convert_results(data, **kwargs):
    
    if kwargs.get("multiprocessing", False):
        manager = SharedManager()
        manager.register("BaseRdfDataType", BaseRdfDataType)
        manager.register("Uri", Uri)

        data_l = len(data)
        group_size = data_l // pool_size
        if data_l % pool_size:
            group_size += 1
        split_data = [data[i:i + group_size]
                      for i in range(0, data_l, group_size)]
        output = manager.Queue()
        # output = manager.list()
        # output_data = POOL.map(convert_row, split_data)
        workers = [mp.Process(target=convert_batch, args=(item, output,))
                   for item in split_data]
        for worker in workers:
            # worker.Daemon = True
            worker.start()
        results = []
        while True:
            running = any(p.is_alive() for p in workers)
            while not output.empty():
               results += output.get()
            if not running:
                break
        print("Finished - workers not stoped")
        for worker in workers:
            worker.join()
        # pdb.set_trace()
        # return output
        for i in range(output.qsize()):
            results += output.get()
        return results
    else:
        return [{key:pyrdf(value) for key, value in row.items()}
                for row in data]
552787
def decompress(self, data):
        
        chunks = []

        available_in = ffi.new("size_t *", len(data))
        in_buffer = ffi.new("uint8_t[]", data)
        next_in = ffi.new("uint8_t **", in_buffer)

        while True:
            # Allocate a buffer that's hopefully overlarge, but if it's not we
            # don't mind: we'll spin around again.
            buffer_size = 5 * len(data)
            available_out = ffi.new("size_t *", buffer_size)
            out_buffer = ffi.new("uint8_t[]", buffer_size)
            next_out = ffi.new("uint8_t **", out_buffer)

            rc = lib.BrotliDecoderDecompressStream(self._decoder,
                                                   available_in,
                                                   next_in,
                                                   available_out,
                                                   next_out,
                                                   ffi.NULL)

            # First, check for errors.
            if rc == lib.BROTLI_DECODER_RESULT_ERROR:
                error_code = lib.BrotliDecoderGetErrorCode(self._decoder)
                error_message = lib.BrotliDecoderErrorString(error_code)
                raise Error(
                    "Decompression error: %s" % ffi.string(error_message)
                )

            # Next, copy the result out.
            chunk = ffi.buffer(out_buffer, buffer_size - available_out[0])[:]
            chunks.append(chunk)

            if rc == lib.BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:
                assert available_in[0] == 0
                break
            elif rc == lib.BROTLI_DECODER_RESULT_SUCCESS:
                break
            else:
                # It's cool if we need more output, we just loop again.
                assert rc == lib.BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT

        return b''.join(chunks)
909900
def output(data = {}, indent = 0)
      case @options['format']
      when 'json'
        puts JSON.pretty_generate(data)
      when 'yaml'
        puts data.to_yaml
      else
        # rubocop:disable Metrics/BlockNesting
        if data.class == Hash
          data.each do |k, v|
            if v.class == Hash || v.class == Array
              puts "#{' ' * indent}#{k.nil? ? 'nil' : k}:"
              output(v, indent + 2)
            else
              puts "#{' ' * indent}#{k.nil? ? 'nil' : k}: #{v.nil? ? 'nil' : v}"
            end
          end
        elsif data.class == Array
          data.each do |d|
            if d.class == Hash || d.class == Array
              output(d, indent + 2)
            else
              puts "#{' ' * indent}#{d.nil? ? 'nil' : d}"
            end
          end
          puts "\nTotal: #{data.size}" if indent < 1
        else
          puts "#{' ' * indent}#{data.nil? ? 'nil' : data}"
        end
        # rubocop:enable Metrics/BlockNesting
      end
    end
760056
function(data) {
    for (var n in data) {
      if (data[n] instanceof Blob) {
        return true;
      }
      if ((angular.isObject(data[n]) || angular.isArray(data[n])) && hasFile(data[n])) {
        return true;
      }
    }
    return false;
  }
850660
public static byte[] decodeBZRaw(byte[] data) {
    try {
      ByteArrayInputStream output = new ByteArrayInputStream(data);
      BZip2CompressorInputStream compresser = new BZip2CompressorInputStream(output);
      return IOUtils.toByteArray(compresser);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
469646
public static byte[] encodeBZ(byte[] data) {
    try {
      int blockSize = 4;
      ByteArrayOutputStream output = new ByteArrayOutputStream();
      BZip2CompressorOutputStream compresser = new BZip2CompressorOutputStream(output, blockSize);
      compresser.write(data);
      compresser.close();
      byte[] bytes = output.toByteArray();
      return bytes;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
30184
def to_a
      if @order == :ascending
        @data.sort { |a, b| a[@sort_by] <=> b[@sort_by] }
      else
        @data.sort { |a, b| b[@sort_by] <=> a[@sort_by] }
      end
    end
1008830
def build_blast_db_data
      # Create necessary directories and return.
      if @empty
        make_directories
        return
      end

      if @dir.blank?
        raise "DIR must be set to continue. Execute `rake -D` for more information."
      end

      unless VALID_TYPES.include?(@type)
        raise "Unknown type: #{@type}. " <<
          "Please provide one: both, nucl or prot."
      end

      check_dependencies

      make_directories

      begin
        @dir.split(':').each do |d|
          unless File.directory?(d)
            raise "Directory not found: #{d}"
          end

          @data = Dir.glob("#{d}/*.{tgz,tar.gz,tbz,tar.bz2}")

          if @data.blank?
            raise "Data not found. Please check your directory and try " <<
            "again.\nDirectory Entered: #{d}"
          end

          @data.each do |s|
            if s =~ GZIP
              files = `tar -tzf #{s}`
              flag  = "z"
            elsif s =~ BZIP
              files = `tar -tjf #{s}`
              flag  = "j"
            end
            files = files.split(/\n/)
            files.each do |f|
              if f.include?(@prot_file)
                file_name = create_file_name(f, @blastdb_dir)
                extract_files(s, f, flag, File.join(@blastdb_dir, file_name, "peptides.fa"))
              elsif f.include?(@nucl_file)
                file_name = create_file_name(f, @blastdb_dir)
                extract_files(s, f, flag, File.join(@blastdb_dir, file_name, "contigs.fa"))
              elsif f.include?("gff")
                file_name = create_file_name(f, @gff_dir)
                extract_files(s, f, flag, File.join(@gff_dir, file_name, "annots.gff"))
              end
            end
          end
        end
        build_blast_db(@blastdb_dir)
      rescue Exception => e
        # Remove empty directories.
        `rm -rf #{@blastdb_dir}/*` if File.directory?(@blastdb_dir)
        `rm -rf #{@gff_dir}/*` if File.directory?(@gff_dir)
        raise e
      end
      readme
    end
1022319
def input(self, data):
        
        self.buf += data
        while len(self.buf) > HEADER_SIZE:
            data_len = struct.unpack('i', self.buf[0:HEADER_SIZE])[0]
            if len(self.buf) >= data_len + HEADER_SIZE:
                content = self.buf[HEADER_SIZE:data_len + HEADER_SIZE]
                self.buf = self.buf[data_len + HEADER_SIZE:]
                yield content
            else:
                break
31477
def to_h
      hash = {}
      @data.each_pair do |key, value|
        hash[key] = value.to_h
      end
      
      hash      
    end
306703
def parse(self, data):
        
        parsed_data = self.yacc.parse(
            data, lexer=self.lexer.get_yacc_compat_lexer(), debug=self.debug)
        self.errors = self.lexer.errors + self.errors
        return parsed_data, self.errors
475014
def to_h
      @data.reduce({}) do |h, (k, v)|
        h[k] = v.is_a?(__class__) ? v.to_h : v

        h
      end
    end