parse b6 output with sorting
354304
def numBlast_sort(blast, numHits, evalueT, bitT):
    
    header = ['#query', 'target', 'pident', 'alen', 'mismatch', 'gapopen',
              'qstart', 'qend', 'tstart', 'tend', 'evalue', 'bitscore']
    yield header
    hmm = {h:[] for h in header}
    for line in blast:
        if line.startswith('#'):
            continue
        line = line.strip().split('\t')
        # Evalue and Bitscore thresholds
        line[10], line[11] = float(line[10]), float(line[11])
        evalue, bit = line[10], line[11]
        if evalueT is not False and evalue > evalueT:
            continue
        if bitT is not False and bit < bitT:
            continue
        for i, h in zip(line, header):
            hmm[h].append(i)
    hmm = pd.DataFrame(hmm)
    for query, df in hmm.groupby(by = ['#query']):
        df = df.sort_values(by = ['bitscore'], ascending = False)
        for hit in df[header].values[0:numHits]:
            yield hit
875751
def parse(raw_status, strip_units=False):
    
    lines = split(raw_status)
    if strip_units:
        lines = strip_units_from_lines(lines)
    # Split each line on the SEP character, strip extraneous whitespace and
    # create an OrderedDict out of the keys/values.
    return OrderedDict([[x.strip() for x in x.split(SEP, 1)] for x in lines])
375079
def parse_output(self, s):
        '''
        
        '''

        for x in s.splitlines():
            if '%' in x:
                name = x.split(':')[0].strip().lower()
                nbytes = x.split(':')[1].split('b')[0].strip()
                nbytes = int(nbytes)
                perc = x.split('(')[1].split('%')[0].strip()
                perc = float(perc)
                if name == 'program':
                    self.program_bytes = nbytes
                    self.program_percentage = perc
                else:
                    self.data_bytes = nbytes
                    self.data_percentage = perc
1039056
function lexSort(a, b) {
            var astr = a.toString();
            var bstr = b.toString();
            if(astr < bstr) {
                return -1;
            }
            if(astr > bstr) {
                return 1;
            }
            return 0;
        }
345199
def parse
      parsed_output = []

      File.open(@filename).each_line.with_index do |line, num|
        next if line.lstrip[0] != "#"

        if expr = line.match(EXPRESSION)
          parsed_output.push [num, expr["expression"]]
        elsif result = line.match(RESULT)
          parsed_output.last.push(result["result"])
        end
      end
      parsed_output
    end
1096978
function parse_BrtCellBool(data) {
	var cell = parse_XLSBCell(data);
	var fBool = data.read_shift(1);
	return [cell, fBool, 'b'];
}
1149557
private int parseInt()
        throws IOException
    {
        int b32 = read();
        int b24 = read();
        int b16 = read();
        int b8 = read();

        return (b32 << 24) + (b24 << 16) + (b16 << 8) + b8;
    }
679007
def _construct_output_to_match(output_block):
    """"""
    output_block.validate()

    selections = (
        u'%s AS `%s`' % (output_block.fields[key].to_match(), key)
        for key in sorted(output_block.fields.keys())  # Sort keys for deterministic output order.
    )

    return u'SELECT %s FROM' % (u', '.join(selections),)
1103306
def _get_full_output(node, for_output=False):
    '''
    
    '''
    ret = {}
    for item in six.iterkeys(node):
        value = node[item]
        if value is not None and for_output:
            value = six.text_type(value)
        ret[item] = value
    return ret
676656
def _normalize_sort(sort=None):
    

    if sort==None:
        return FlatList.EMPTY

    output = FlatList()
    for s in listwrap(sort):
        if is_text(s):
            output.append({"value": jx_expression(s), "sort": 1})
        elif is_expression(s):
            output.append({"value": s, "sort": 1})
        elif mo_math.is_integer(s):
            output.append({"value": jx_expression({"offset": s}), "sort": 1})
        elif not s.sort and not s.value and all(d in sort_direction for d in s.values()):
            for v, d in s.items():
                output.append({"value": jx_expression(v), "sort": sort_direction[d]})
        elif not s.sort and not s.value:
            Log.error("`sort` clause must have a `value` property")
        else:
            output.append({"value": jx_expression(coalesce(s.value, s.field)), "sort": sort_direction[s.sort]})
    return output
128185
def _parse_fmdump(output):
    '''
    
    '''
    result = []
    output = output.split("\n")

    # extract header
    header = [field for field in output[0].lower().split(" ") if field]
    del output[0]

    # parse entries
    for entry in output:
        entry = [item for item in entry.split(" ") if item]
        entry = ['{0} {1} {2}'.format(entry[0], entry[1], entry[2])] + entry[3:]

        # prepare faults
        fault = OrderedDict()
        for field in header:
            fault[field] = entry[header.index(field)]

        result.append(fault)

    return result
181947
def _parse_jing_output(output):
    
    output = output.strip()
    values = [_parse_jing_line(l) for l in output.split('\n') if l]
    return tuple(values)
865038
def parse(self, ascii_listing):
        
        self.parsed_lines = ParsedBASIC()
        for match in self.regex_line_no.finditer(ascii_listing):
            log.info("_" * 79)
            log.info("parse line >>>%r<<<", match.group())
            line_no = int(match.group("no"))
            line_content = match.group("content")

            self.line_data = []
            self._parse_code(line_content)
            log.info("*** line %s result: %r", line_no, self.line_data)

            self.parsed_lines[line_no] = self.line_data

        return self.parsed_lines
837115
function parse_Format(blob, length, opts) {
	var numFmtId = blob.read_shift(2);
	var fmtstr = parse_XLUnicodeString2(blob, 0, opts);
	return [numFmtId, fmtstr];
}
1297178
function basicParser(condition, str) {
    let result = [];

    for (let i = 0; i < str.length; ++i) {
        if (condition(str[i])) {
            result.push(str[i]);
        }
    }

    return result;
}
1188514
def _sorter(generated):
    """"""
    pairs = [(os.path.dirname(f), os.path.basename(f))
             for f in set(list(generated))]

    pairs.sort()

    return [os.path.join(pair[0], pair[1]) for pair in pairs]
898889
def parse_sorting_param(sorting_param, model)
      return {} unless sorting_param.present?

      sorting_params = CSV.parse_line(URI.unescape(sorting_param)).collect do |sort|
        sorting_param = if sort.start_with?('-')
                          { field: sort[1..-1].to_s.to_sym, direction: :desc }
                        else
                          { field: sort.to_s.to_sym, direction: :asc }
                        end

        check_sorting_param(model, sorting_param)
        sorting_param
      end
      sorting_params.map { |par| [par[:field], par[:direction]] }.to_h
    end