Yield items from any nested iterable; see REF.
763475
def flatten(items,enter=lambda x:isinstance(x, list)):
    # http://stackoverflow.com/a/40857703
    # https://github.com/ctmakro/canton/blob/master/canton/misc.py
    """"""
    for x in items:
        if enter(x):
            yield from flatten(x)
        else:
            yield x
65515
def iterable(item):
    
    if isinstance(item, collections.Iterable) and not isinstance(item, basestring):
        return item
    else:
        return [item]
1111402
def flatten( iterables ):
    
    for it in iterables:
        if isinstance(it, str):
            yield it
        else:
            for element in it:
                yield element
554887
def chunks(iterable, size=1):
    """"""
    iterator = iter(iterable)

    for element in iterator:
        yield chain([element], islice(iterator, size - 1))
934163
def flatten_once(iterable, check=is_iterable):
    """"""
    for value in iterable:
        if check(value):
            for item in value:
                yield item
        else:
            yield value
700850
def intersperse(iterable, element):
    """"""
    iterable = iter(iterable)
    yield next(iterable)
    while True:
        next_from_iterable = next(iterable)
        yield element
        yield next_from_iterable
1277679
def from_iterable(cls, iterable: Iterable) -> 'List':
        """"""

        iterator = iter(iterable)

        def recurse() -> List:
            try:
                value = next(iterator)
            except StopIteration:

                return List.empty()
            return List.unit(value).append(recurse())
        return List.empty().append(recurse())
259043
def yield_from_handle(self, tokens):
        """"""
        internal_assert(len(tokens) == 1, "invalid yield from tokens", tokens)
        if self.target_info < (3, 3):
            return (
                yield_from_var + " = " + tokens[0]
                + "\nfor " + yield_item_var + " in " + yield_from_var + ":\n"
                + openindent + "yield " + yield_item_var + "\n" + closeindent
            )
        else:
            return "yield from " + tokens[0]
1347813
def _unordered_iterator(self):
        
        for i, qs in zip(self._queryset_idxs, self._querysets):
            for item in qs:
                setattr(item, '#', i)
                yield item
1191435
def items(iterable):
    
    if hasattr(iterable, 'iteritems'):
        return (p for p in iterable.iteritems())
    elif hasattr(iterable, 'items'):
        return (p for p in iterable.items())
    else:
        return (p for p in enumerate(iterable))
940490
def chunks_generator(iterable, count_items_in_chunk):
    
    iterator = iter(iterable)
    for first in iterator:  # stops when iterator is depleted
        def chunk():  # construct generator for next chunk
            yield first  # yield element from for loop
            for more in islice(iterator, count_items_in_chunk - 1):
                yield more  # yield more elements from the iterator

        yield chunk()
34752
def join(iterable, sep):
    """"""
    i = 0
    for i, item in enumerate(iterable):
        if i == 0:
            yield item
        else:
            yield sep
            yield item
1121698
def iter_child_nodes(node):
    """"""
    for name, field in iter_fields(node):
        if isinstance(field, AST):
            yield field
        elif isinstance(field, list):
            for item in field:
                if isinstance(item, AST):
                    yield item
659519
def iteritems(self):
        ''''''
        for x in range(len(self.keys)):
            yield (self.keys[x], self.values[x])
118813
def iterator(self):
        
        for obj in (self.execute().json().get("items") or []):
            yield self.api_obj_class(self.api, obj)
756482
def concat(cls, iterables):
    

    def generator():
      for it in iterables:
        for element in it:
          yield element
    return cls(generator())
428278
def fields(iterable, fields=None):
    
    if not fields:
        for item in iterable:
            yield item

    prepared_fields = _prepare_fields(fields)

    for item in iterable:
        yield _process_fields(item, prepared_fields)