Convert a generator into a function that prints all yielded elements

	>>> @print_yielded
	... def x():
	...     yield 3; yield None
	>>> x()
	3
	None
1492
def print_yielded(func):
	
	print_all = functools.partial(map, print)
	print_results = compose(more_itertools.recipes.consume, print_all, func)
	return functools.wraps(func)(print_results)
961968
def iterator(self):
        

        for item in self.query.results():
            obj = self.resource(**item)

            yield obj
756482
def concat(cls, iterables):
    

    def generator():
      for it in iterables:
        for element in it:
          yield element
    return cls(generator())
16431
function(){ // the main generator you'll return
        var res=kid(); // call the child function and store the result
        if(cond(res)&&failed){ // if both generators have failed
            return done(); // then you're done
        }else if(cond(res)){ // if just the child has failed
            par(); // regenerate the child array
            return fn(); // return the next child value
        }else{ // otherwise.. 
            return [temp,res]; // return combined parent and child values
        }
    }
1111402
def flatten( iterables ):
    
    for it in iterables:
        if isinstance(it, str):
            yield it
        else:
            for element in it:
                yield element
181418
def Take(self: Iterable, n):
    

    for i, e in enumerate(self):
        if i == n:
            break
        yield e
1361569
def get_results_generator(future_list, timeout=None, sort_by_completed=False):
    """"""
    try:
        # python2 not support yield from
        if sort_by_completed:
            for future in as_completed(future_list, timeout=timeout):
                yield future.x
        else:
            for future in future_list:
                yield future.x
    except TimeoutError:
        return
237682
def yield_for_all_futures(result):
    
    while True:

        # This is needed for Tornado >= 4.5 where convert_yielded will no
        # longer raise BadYieldError on None
        if result is None:
            break

        try:
            future = gen.convert_yielded(result)
        except gen.BadYieldError:
            # result is not a yieldable thing, we are done
            break
        else:
            result = yield future

    raise gen.Return(result)
1315436
def _handle_generator(self, fn):
        
        with self as cassette:
            coroutine = fn(cassette)
            # We don't need to catch StopIteration. The caller (Tornado's
            # gen.coroutine, for example) will handle that.
            to_yield = next(coroutine)
            while True:
                try:
                    to_send = yield to_yield
                except Exception:
                    to_yield = coroutine.throw(*sys.exc_info())
                else:
                    try:
                        to_yield = coroutine.send(to_send)
                    except StopIteration:
                        break
622920
def visit_GeneratorExp(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        return f"({self.visit(node.elt)} " \
               f"{' '.join(self.visit(gen) for gen in node.generators)})"
1010480
def log_gen() -> Iterator[int]:
    
    y = 1
    while True:
        adder = max(1, math.pow(10, int(math.log10(y))))
        yield int(y)
        y = y + int(adder)
824609
def is_generator(self, node):
        """"""
        results = {}
        if self.yield_expr.match(node, results):
            return True
        for child in node.children:
            if child.type not in (syms.funcdef, syms.classdef):
                if self.is_generator(child):
                    return True
        return False
1098931
def visit_generatorexp(self, node):
        """"""
        return "(%s %s)" % (
            node.elt.accept(self),
            " ".join(n.accept(self) for n in node.generators),
        )
839336
def parse(self, generator):
        """"""
        gen = iter(generator)
        for line in gen:
            block = {}
            for rule in self.rules:
                if rule[0](line):
                    block = rule[1](line, gen)
                    break
            yield block
193091
def print_generated_sequence(gen, num, *, sep=", ", fmt='', seed=None):
    
    if seed:
       gen.reset(seed)

    elems = [format(next(gen), fmt) for _ in range(num)]
    sep_initial = "\n\n" if '\n' in sep else " "
    print("Generated sequence:{}{}".format(sep_initial, sep.join(elems)))
1046656
def and_yields(self, *values):
        
        def generator():
            for value in values:
                yield value
        self.__expect(Expectation, Invoke(generator))
624367
def for_all(*generators):
    
    # Pass in n as an argument
    n = 100

    def test_property(property_function):
        """
        A closure which takes a property and tests it against arbitrary
        instances of the generators in the closure.
        """
        for generator in generators:
            assert (issubclass(generator, ArbitraryInterface)
                    or generator in arbitrary)

        def test_once():
            """
            Tests the property against a single set of instances of the
            generators.
            """
            instances = [arbitrary(generator) for generator in generators]
            try:
                assert property_function(*instances)
            except AssertionError:
                generator_names = ', '.join(
                    generator.__name__ for generator in generators)
                stringed_instances = ', '.join(
                    str(instance) for instance in instances)
                error_message = ' '.join([
                    'Instances <', stringed_instances, '> of <',
                    generator_names, '> do not satisfy a property.'
                ])
                raise AssertionError(error_message)

        for _ in range(n):
            test_once()

    return test_property