*required virtual method* This class method, part of the sub-class
        API, converts a generator of ``(K, V)`` tuples (the *tuple protocol*)
        to one of the underlying collection type.
966753
def tuples_to_coll(cls, generator, coerce=False):
        
        if cls != Collection:
            raise exc.CollectionDefinitionError(
                property='tuples_to_coll',
                coll='Collection',
            )
375111
async def tuple(self, elem=None, elem_type=None, params=None, obj=None):
        
        if hasattr(elem_type, 'kv_serialize'):
            container = elem_type() if elem is None else elem
            return await container.kv_serialize(self, elem=elem, elem_type=elem_type, params=params, obj=obj)

        # TODO: if modeled return as 0=>, 1=>, ...
        if self.writing:
            return await self.dump_tuple(elem, elem_type, params, obj=obj)
        else:
            return await self.load_tuple(elem_type, params=params, elem=elem, obj=obj)
1036353
def pymongo_class_wrapper(f, pymongo_class):
    
    @functools.wraps(f)
    @coroutine
    def _wrapper(self, *args, **kwargs):
        result = yield f(self, *args, **kwargs)

        # Don't call isinstance(), not checking subclasses.
        if result.__class__ == pymongo_class:
            # Delegate to the current object to wrap the result.
            raise gen.Return(self.wrap(result))
        else:
            raise gen.Return(result)

    return _wrapper
606482
def to_tuple(self):
        
        return self._body, self._channel, self._method, self._properties
1219462
public static <T, P, A> Collection<A> collectWith(
            Iterable<T> iterable,
            Function2<? super T, ? super P, ? extends A> function,
            P parameter)
    {
        if (iterable instanceof MutableCollection)
        {
            return ((MutableCollection<T>) iterable).collectWith(function, parameter);
        }
        if (iterable instanceof ArrayList)
        {
            return ArrayListIterate.collectWith((ArrayList<T>) iterable, function, parameter);
        }
        if (iterable instanceof List<?>)
        {
            return ListIterate.collectWith((List<T>) iterable, function, parameter);
        }
        if (iterable instanceof Collection)
        {
            return IterableIterate.collectWith(
                    iterable,
                    function,
                    parameter,
                    DefaultSpeciesNewStrategy.INSTANCE.<A>speciesNew(
                            (Collection<T>) iterable,
                            ((Collection<T>) iterable).size()));
        }
        if (iterable != null)
        {
            return IterableIterate.collectWith(iterable, function, parameter);
        }
        throw new IllegalArgumentException("Cannot perform a collectWith on null");
    }
1173751
function tupleToArray(tuple) {
  if(isFunction(tuple)) {
    return function(x) {
      const m = tuple(x)

      if(!isFunction(m.tupleLength)) {
        throw new TypeError('tupleToArray: Tuple returning function required')
      }

      return m.toArray()
    }
  }

  if(isFunction(tuple.tupleLength)) {
    return tuple.toArray()
  }

  throw new TypeError('tupleToArray: Tuple or Tuple returning function required')
}
1313871
def var_set(k, v)
      varget = proc { instance_variable_get("@#{k}") }
      varset = proc { |y| instance_variable_set("@#{k}", y) }
      v.is_a?(Hash) ? convert(v) : instance_variable_set("@#{k}", v)
      self.class.send(:define_method, k, varget)
      self.class.send(:define_method, "#{k}=", varset)
    end
954712
def call(cls, iterable, *a, **kw):
    

    return cls(x(*a, **kw) for x in iterable)
249638
def to_tuple(self):
        '''
        '''
        if self.closed():
            raise ValueError("Attempt to call to_tuple() on a closed Queryable.")

        if isinstance(self._iterable, tuple):
            return self._iterable
        tup = tuple(self)
        # Ideally we would close here
        #self.close()
        return tup
929552
def produce(cls, mapped_props, aggregated, value_type, visitor):
        
        kwargs = {} if not mapped_props else dict(
            (k.name, v) for k, v in mapped_props
        )
        if issubclass(value_type, Collection):
            kwargs['values'] = aggregated
        return value_type(**kwargs)
1213765
function tuple2Of(a, b) {
    var self = getInstance(this, tuple2Of);
    self.types = rest(arguments);
    return self;
}
766154
def _mapping_to_tuple_pairs(d):
    
    # order the keys, this will prevent different implementations of Python,
    # return different results from the same dictionary since the order of
    # iteration depends on it
    t = []
    ord_keys = sorted(d.keys())
    for k in ord_keys:
        t.append(_product(k, d[k]))
    return tuple(product(*t))
1319933
def as_tuple(obj):
    "  "

    if not obj:
        return tuple()

    if isinstance(obj, (tuple, set, list)):
        return tuple(obj)

    if hasattr(obj, '__iter__') and not isinstance(obj, dict):
        return obj

    return obj,
901696
def generative(func):
    
    def wrap(inst, *args, **kw):
        clone = type(inst).__new__(type(inst))
        clone.__dict__ = inst.__dict__.copy()
        return func(clone, *args, **kw)
    return update_wrapper(wrap, func)
393082
def types(cls):
        
        redundant_types = \
            set(cls.types_mapping) & set(cls._types_from_methods)
        if redundant_types:
            warn("These types are defined both with a method and in the"
                 "'types_mapping' property of this validator: %s"
                 % redundant_types)

        return tuple(cls.types_mapping) + cls._types_from_methods
529809
function tuple5Of(a, b, c, d, e) {
    var self = getInstance(this, tuple5Of);
    self.types = rest(arguments);
    return self;
}
788357
def subclass(cls, vt_code, vt_args):
        
        return type(vt_code.replace('/', '_'), (cls,), {'vt_code': vt_code, 'vt_args': vt_args})