parses a pair in the form {A, B}
491716
private static String[] parsePair (String pair) {
        String[] tmp = new String[2];
        int indexOfA = pair.indexOf('{')+1;
        int indexOfB = pair.indexOf(',');
        tmp[0] = pair.substring(indexOfA,indexOfB);
        tmp[1] = pair.substring(indexOfB+2,pair.length()-1);

        return tmp;
    }
1361137
def parse_json(pairs):
    
    new_pairs = []
    for key, value in pairs:
        if isinstance(value, unicode):
            value = value.encode('utf-8')
        if isinstance(key, unicode):
            key = key.encode('utf-8')
        new_pairs.append((key, value))
    return dict(new_pairs)
332169
function (obj) {
	
    var pairs = [];
    for (var prop in obj) {
        if (!obj.hasOwnProperty(prop)) {
            continue;
        }
        pairs.push(prop + '=' + obj[prop]);
    }
    return pairs.join('&');	
}
295592
def parse_s2bins(s2bins):
    
    s2b = {}
    b2s = {}
    for line in s2bins:
        line = line.strip().split()
        s, b = line[0], line[1]
        if 'UNK' in b:
            continue
        if len(line) > 2:
            g = ' '.join(line[2:])
        else:
            g = 'n/a'
        b = '%s\t%s' % (b, g)
        s2b[s] = b 
        if b not in b2s:
           b2s[b] = []
        b2s[b].append(s)
    return s2b, b2s
989941
def objparse(ts)
    ts = eat('{', ts)
    obj = {}

    if ts[0][0] == '}'
      return obj, ts[1..-1]
    end

    k, v, ts = pairparse(ts)
    obj[k] = v

    if ts[0][0] == '}'
      return obj, ts[1..-1]
    end

    loop do
      ts = eat(',', ts)

      k, v, ts = pairparse(ts)
      obj[k] = v

      if ts[0][0] == '}'
        return obj, ts[1..-1]
      end
    end
  end
646740
def parse(self, string, parent):
        """"""
        result = {}
        for member in self.RE_MEMBERS.finditer(string):
            mems = self._process_member(member, parent, string)
            #The regex match could contain multiple members that were defined
            #on the same line in the code file.
            for onemem in mems:
                result[onemem.name.lower()] = onemem
                
        return result
162706
function parse(tokens, basePath, iterSuffix) {
  const len = tokens.length;
  const body = [];

  let i = 0;
  while (i < len) {
    const token = tokens[i];
    if (subroutines[token.tokenType]) {
      const rest = tokens.slice(i + 1);
      const [
        branches,
        tokensHandled,
        shouldBreak,
      ] = subroutines[token.tokenType](token, rest, basePath, iterSuffix);

      body.push(...branches);

      i += tokensHandled;

      if (shouldBreak) {
        break;
      }
    } else {
      i += 1;
    }
  }

  return [body, i + 1];
}
1370400
def union(self, *args):
        """"""
        if self._readonly:
            raise AttributeError

        if len(args) == 0:
            return None
        if len(args) == 1:
            return self[args[0]]
        for a, b in zip(args[:-1], args[1:]):
            result = self._union_pair(a, b)
        return result
163437
function objectFromPairs(pairs) {
  var result = {};

  for (let i = 0, len = pairs.length; i < len; i++) {
    let pair = pairs[i];
    result[pair[0]] = pair[1];
  }

  return result;
}
662914
function(w, x, y, z) {

      parse(P, w, x, y, z);

      // dot(Q1, Q2) := w1 * w2 + dot(v1, v2)

      return this['w'] * P['w'] + this['x'] * P['x'] + this['y'] * P['y'] + this['z'] * P['z'];
    }
819692
def parse_set(self):
        """"""
        lineno = next(self.stream).lineno
        target = self.parse_assign_target(with_namespace=True)
        if self.stream.skip_if('assign'):
            expr = self.parse_tuple()
            return nodes.Assign(target, expr, lineno=lineno)
        filter_node = self.parse_filter(None)
        body = self.parse_statements(('name:endset',),
                                     drop_needle=True)
        return nodes.AssignBlock(target, filter_node, body, lineno=lineno)
1326951
function parse(headers) {
    var output = {}, i, p, k, v;
    headers = headers || '';
    headers = headers.replace('\r', '');
    headers = headers.split('\n');
    for(i = 0;i < headers.length;i++) {
      p = headers[i].indexOf(':');
      k = headers[i].substr(0, p);
      v = headers[i].substr(p + 1);
      if(k && v) {
        k = k.replace(/^\s+/, '').replace(/\s+$/, '');
        v = v.replace(/^\s+/, '').replace(/\s+$/, '');
        output[k.toLowerCase()] = v;
      }
    }
    return output;
  }
1275166
def contigsub(a,b):
  ''
  'a and b are token lists'
  common=commonelts(a,b); groupsa=groupelts(a,common); groupsb=groupelts(b,common)
  bestmatch=[None,None,0]; bslice=None
  for i in range(len(groupsb)):
    if not groupsb[i][0]: continue
    if len(groupsb[i])-1<=bestmatch[2]: continue # this whole segment can't beat our best match so far
    for j in range(len(groupsb[i])):
      match=seqingroups(groupsa,groupsb[i][j:])
      if match and match[2]>bestmatch[2]: bestmatch=match; bslice=[i,j,match[2]]
      if match and match[2]>=(len(groupsb[i])/2.0): break # i.e. this is as good as we're going to get for groupsb[i], skip the rest. TODO: write a test for this
  return None if not bestmatch[2] else (ungroupslice(groupsa,bestmatch),ungroupslice(groupsb,bslice))
698787
def parse_string(self, string=''):
        '''
        
        '''
        self.strings = string.splitlines(1)
        self.strings = [self.__parse(line) for line in self.strings]
        return ''.join(self.strings)
282430
def _Pairs(data):
    """"""
    keys = sorted(data)
    return [{'@key': k, '@value': data[k]} for k in keys]
1015833
def hyp_2F1(a, b, c, z):
    
    return mp.hyp2f1(a, b, c, z)
477800
def split_mapping(pair_str):
    
    orig_key, value = pair_str.split("=", 1)
    key = orig_key.strip()
    if key != orig_key:
        warnings.warn(
            "Mapping key {} has leading or trailing space".format(repr(orig_key)),
            LeadingTrailingSpaceInKey,
        )
    return key, value