Given an iterator (k1, k2), returns a function that when called
        with an object obj returns a tuple of the form:
        ((k1, obj.parameters[k1]), (k2, obj.parameters[k2]))
513539
def _get_params_value(params):
    
    # sort params for consistency
    ord_params = sorted(params)

    def fn(obj):
        l = []
        for p in ord_params:
            try:
                l.append((p, obj.parameters[p]))
            except:
                raise ValueError('{} is not a valid parameter'.format(p))
        return tuple(l)
    return fn
976058
def to_iter(obj):
    
    if isinstance(obj, type(None)):
        return None
    elif isinstance(obj, six.string_types):
        return [obj]
    else:
        # Nesting here since symmetry is broken in isinstance checks.
        # Strings are iterables in python 3, so the relative order of if statements is important.
        if isinstance(obj, collections.Iterable):
            return obj
        else:
            return [obj]
1152254
function (iterator, accumulator, context) {
        return _.reduce(this.members, _.isFunction(iterator) ? iterator.bind(context || this) : iterator, accumulator);
    }
226467
function(initial) {

        return {

            a: initial || [],

            // Add items
            s: function() {

                for (var i$3 = 0; i$3 < arguments.length; ++i$3)
                    this.a.push(arguments[i$3]);

                return this;
            },

            // Add the contents of iterables
            i: function(list) {

                if (Array.isArray(list)) {

                    this.a.push.apply(this.a, list);

                } else {

                    for (var __$0 = (list)[Symbol.iterator](), __$1; __$1 = __$0.next(), !__$1.done;)
                        { var item$0 = __$1.value; this.a.push(item$0); }
                }

                return this;
            }

        };
    }
219316
def iterator_from_slice(s):
    
    import numpy as np
    start = s.start if s.start is not None else 0
    step = s.step if s.step is not None else 1

    if s.stop is None:
        # Infinite iterator.
        return itertools.count(start=start, step=step)
    else:
        # xrange-like iterator that supports float.
        return iter(np.arange(start, s.stop, step))
500779
def make_tuple(obj, cast=True):
    
    if isinstance(obj, tuple):
        return tuple(obj)
    elif is_lazy_iterable(obj):
        return tuple(obj)
    elif isinstance(obj, (list, set)) and cast:
        return tuple(obj)
    else:
        return (obj,)
820794
def map(self, callable):
        
        for k,v in self.iteritems():
            self[k] = callable(v)
576970
function (obj, iterator, context) {
    var results = [];
    if (!obj) return results;
    if (Array.prototype.map && obj.map === Array.prototype.map) {
      return obj.map(iterator, context);
    }
    each(obj, function (value, index, list) {
      results[results.length] = iterator.call(context, value, index, list);
    });
    if (obj.length === +obj.length) results.length = obj.length;
    return results;
  }
1300724
def iterator(n: Union[Node, CompatNodeIterator, dict],
        order: TreeOrder = TreeOrder.PRE_ORDER) -> CompatNodeIterator:
    

    if isinstance(n, CompatNodeIterator):
        return CompatNodeIterator(n._nodeit.iterate(order), only_nodes=True)
    elif isinstance(n, Node):
        nat_it = native_iterator(n.internal_node, order)
        return CompatNodeIterator(NodeIterator(nat_it), only_nodes=True)
    elif isinstance(n, dict):
        nat_it = native_iterator(n, order)
        return CompatNodeIterator(NodeIterator(nat_it, uast()), only_nodes=True)
    else:
        raise WrongTypeException(
            "iterator on non node or iterator type (%s)" % str(type(n))
        )
150270
function tuple4Of(a, b, c, d) {
    var self = getInstance(this, tuple4Of);
    self.types = rest(arguments);
    return self;
}
829972
function mapValues(obj, iteratee) {
  const result = {}
  for (const k in obj) {
    result[k] = iteratee(obj[k])
  }
  return result
}
1144190
def _structure_tuple(self, obj, tup):
        """"""
        tup_params = tup.__args__
        has_ellipsis = tup_params and tup_params[-1] is Ellipsis
        if tup_params is None or (has_ellipsis and tup_params[0] is Any):
            # Just a Tuple. (No generic information.)
            return tuple(obj)
        if has_ellipsis:
            # We're dealing with a homogenous tuple, Tuple[int, ...]
            tup_type = tup_params[0]
            conv = self._structure_func.dispatch(tup_type)
            return tuple(conv(e, tup_type) for e in obj)
        else:
            # We're dealing with a heterogenous tuple.
            return tuple(
                self._structure_func.dispatch(t)(e, t)
                for t, e in zip(tup_params, obj)
            )
1371112
def coerce_tuples(cls, generator):
        
        for k, v in generator:
            yield k, cls.coerce_value(v)
766046
public Iterable<Tuple2<String, Obj>> asKeyObjSeq(final @Nullable Obj obj) {
		return new Iterable<Tuple2<String, Obj>>() {
			@Override public Iterator<Tuple2<String, Obj>> iterator() {
				if (obj != null) {
					final Iterator<Entry<String, Object>> i = obj.iterator();
					return new Iterator<Tuple2<String, Obj>>() {
						@Override public boolean hasNext() {
							return i.hasNext();
						}
						@Override public Tuple2<String, Obj> next() {
							Entry<String, Object> entry = i.next();
							return new Tuple2<String, Obj>(entry.getKey(), (Obj) entry.getValue());
						}
						@Override public void remove() {
							Check.unsupportedoperation.fail();
						}
					};
				}
				return java.util.Collections.emptyIterator();
			}
		};
	}
524739
def iterator(self, *argv):
        
        for arg in argv:
            if hasattr(self, arg):
                for item in getattr(self, arg):
                    yield item
891663
def tuple_of(*generators):
    

    class TupleOfGenerators(ArbitraryInterface):
        """
        A closure class around the generators specified above, which
        generates a tuple of the generators.
        """

        @classmethod
        def arbitrary(cls):
            """
            Generate a tuple of the enclosed generators.
            """
            return tuple([
                arbitrary(generator) for generator in generators
                if generator is not tuple
            ])

    TupleOfGenerators.__name__ = ''.join([
        'tuple_of(', ', '.join(generator.__name__ for generator in generators),
        ')'
    ])
    return TupleOfGenerators
783893
def map(self, f, preservesPartitioning=False):
        
        def func(_, iterator):
            return map(fail_on_stopiteration(f), iterator)
        return self.mapPartitionsWithIndex(func, preservesPartitioning)