Incrementally iterate sorted sets elements and associated scores.
348733
def zscan(self, key, cursor=0, match=None, count=None):
        """"""
        args = []
        if match is not None:
            args += [b'MATCH', match]
        if count is not None:
            args += [b'COUNT', count]
        fut = self.execute(b'ZSCAN', key, cursor, *args)

        def _converter(obj):
            return (int(obj[0]), pairs_int_or_float(obj[1]))

        return wait_convert(fut, _converter)
786519
def priority(s):
    """"""
    # REZ: Previously this value was calculated in place many times which is
    #      expensive.  Do it once early.
    # REZ: Changed this to output a list, so that can nicely sort "validate"
    #      items by the sub-priority of their schema
    type_of_s = type(s)
    if type_of_s in (list, tuple, set, frozenset):
        return [ITERABLE]
    if type_of_s is dict:
        return [DICT]
    if issubclass(type_of_s, type):
        return [TYPE]
    if hasattr(s, 'validate'):
        p = [VALIDATOR]
        if hasattr(s, "_schema"):
            p.extend(priority(s._schema))
        return p
    if callable(s):
        return [CALLABLE]
    else:
        return [COMPARABLE]
159418
public static <T> SortedSet<T> asSynchronized(SortedSet<T> self) {
        return Collections.synchronizedSortedSet(self);
    }
558096
def _compare_rows(from_recs, to_recs, keys):
    ""
    return set(
        k for k in keys
        if sorted(from_recs[k].items()) != sorted(to_recs[k].items())
    )
636116
def cross_lists(*sets):
    """"""
    wheels = [iter(_) for _ in sets]
    digits = [next(it) for it in wheels]
    while True:
        yield digits[:]
        for i in range(len(digits)-1, -1, -1):
            try:
                digits[i] = next(wheels[i])
                break
            except StopIteration:
                wheels[i] = iter(sets[i])
                digits[i] = next(wheels[i])
        else:
            break
253461
def _join_results(self, results, coarse, join):
    '''
    
    '''
    rval = OrderedDict()
    i_keys = set()
    for res in results:
      i_keys.update( res.keys() )
    for i_key in sorted(i_keys):
      if coarse:
        rval[i_key] = join( [res.get(i_key) for res in results] )
      else:
        rval[i_key] = OrderedDict()
        r_keys = set()
        for res in results:
          r_keys.update( res.get(i_key,{}).keys() )
        for r_key in sorted(r_keys):
          rval[i_key][r_key] = join( [res.get(i_key,{}).get(r_key) for res in results] )
    return rval
728173
def _priority(s):
    """"""
    if type(s) in (list, tuple, set, frozenset):
        return ITERABLE
    if type(s) is dict:
        return DICT
    if issubclass(type(s), type):
        return TYPE
    if hasattr(s, "validate"):
        return VALIDATOR
    if callable(s):
        return CALLABLE
    else:
        return COMPARABLE
1190560
private static int[] freq(int[][] itemsets) {
        int[] f = new int[Math.max(itemsets) + 1];
        for (int[] itemset : itemsets) {
            for (int i : itemset) {
                f[i]++;
            }
        }
        return f;
    }
101268
public void process( FastQueue<AssociatedIndex> matches, int sizeDst ) {
		// initialize data structures
		if( bestScores.length < sizeDst )
			bestScores = new AssociatedIndex[sizeDst];

		for( int i = 0; i < matches.size; i++ ) {
			AssociatedIndex match = matches.data[i];

			if( bestScores[match.dst] == null || match.fitScore < bestScores[match.dst].fitScore) {
				bestScores[match.dst] = match;
			}
		}

		// add the best unambiguous pairs back
		unambiguous.reset();
		for( int i = 0; i < sizeDst; i++ ) {
			if( bestScores[i] != null ) {
				unambiguous.add(bestScores[i]);
				// clean up so that you don't have a dangling reference
				bestScores[i] = null;
			}
		}
	}
285456
def powerset(iterable):
    ""
    s = list(set(iterable))
    combs = chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
    res = set(frozenset(x) for x in combs)
    # res = map(frozenset, combs)
    return res
836466
def SortedSet(self, name, initial=None):
        
        return types.SortedSet(name, self.api, initial)
404720
def iteritems_sorted(dict_):
    
    if isinstance(dict_, OrderedDict):
        return six.iteritems(dict_)
    else:
        return iter(sorted(six.iteritems(dict_)))
15877
function each(collection, iterator) {
  for (var i = 0; i < collection.length; i++) {
    iterator(collection[i], i);
  }
}
866910
def process_lists(self):
        """"""
        for l1_idx, obj1 in enumerate(self.l1):
            for l2_idx, obj2 in enumerate(self.l2):
                if self.equal(obj1, obj2):
                    self.matches.add((l1_idx, l2_idx))
821837
def accumulate(iterable):
  "  "
  iterator = iter(iterable)
  sum_data = next(iterator)
  yield sum_data
  for el in iterator:
    sum_data += el
    yield sum_data
786990
def _sorted_keys_items(dobj):
    """"""
    keys = sorted(dobj.keys())
    for key in keys:
        yield key, dobj[key]
1006611
def sorted_product_set(array_a, array_b):
  """"""
  return np.sort(
      np.concatenate(
          [array_a[i] * array_b for i in xrange(len(array_a))], axis=0)
  )[::-1]