Evalute a storm query and yield packed nodes.
326316
async def eval(self, text, opts=None):
        '''
        
        '''
        async for pode in self.cell.iterStormPodes(text, opts=opts, user=self.user):
            yield pode
1028082
def filter_nodes(n: Node, query: str) -> CompatNodeIterator:
    
    return CompatNodeIterator(filter(n, query)._nodeit, only_nodes=True)
1333888
def _recursive_matches(self, nodes, count):
        """"""
        assert self.content is not None
        if count >= self.min:
            yield 0, {}
        if count < self.max:
            for alt in self.content:
                for c0, r0 in generate_matches(alt, nodes):
                    for c1, r1 in self._recursive_matches(nodes[c0:], count+1):
                        r = {}
                        r.update(r0)
                        r.update(r1)
                        yield c0 + c1, r
679854
def query(cls, *args, **kwargs):
        
        for doc in cls._coll.find(*args, **kwargs):
            yield cls.from_storage(doc)
661126
def pass_result(db: JobDB, always_cache=False):
    """"""
    @pull
    def pass_result_stream(worker_source):
        """Pull stream instance created by `pass_result`."""
        for result in worker_source():
            if result is EndOfQueue:
                return

            attached = db.store_result_in_db(
                result, always_cache=always_cache)

            yield result
            yield from (ResultMessage(key, 'attached', result.value, None)
                        for key in attached)

    return pass_result_stream
503071
def filter(n: Node, query: str) -> CompatNodeIterator:
    
    ctx = uast()
    return CompatNodeIterator(NodeIterator(ctx.filter(query, n.internal_node), ctx))
872101
@Override
    public void evaluate(RDFHandler resultHandler) throws QueryEvaluationException, RDFHandlerException {
        GraphQueryResult queryResult = evaluate();
        if(queryResult.hasNext())
        {
            QueryResults.report(queryResult, resultHandler);
        }
    }
70635
def reader(stream, fieldnames=None):
    """"""
    if not fieldnames:
        fieldnames = load_line(stream.readline())
    for line in stream:
        values = load_line(line)
        item = Item()
        item.__dict__ = dict(zip(fieldnames, values))
        yield item
550056
def iterGet(self, objectType, *args, **coolArgs) :
		""""""

		for e in self._makeLoadQuery(objectType, *args, **coolArgs).iterRun() :
			if issubclass(objectType, pyGenoRabaObjectWrapper) :
				yield objectType(wrapped_object_and_bag = (e, self.bagKey))
			else :
				yield e
54614
function (nodes, batchOps, done) {
      self.db.batch(batchOps, function (err) {
        if (err) {
          nodes.forEach(rejectNode)
          return done(err)
        }
        done(null, nodes)
      })
    }
1092336
def parse(self, *nodes):
        
        for n in nodes:
            if not n.contents:
                continue
            row = self._parse(n)
            if not row.is_null:
                yield row
509451
def as_bulk_queries(queries, bulk_size):
    
    stmt_dict = defaultdict(list)
    for stmt, args in queries:
        bulk_args = stmt_dict[stmt]
        bulk_args.append(args)
        if len(bulk_args) == bulk_size:
            yield stmt, bulk_args
            del stmt_dict[stmt]
    for stmt, bulk_args in stmt_dict.items():
        yield stmt, bulk_args
941699
def nodes(self) -> iter:
        """"""
        yield from (elem for elem, subs in self.inclusions.items() if subs == ())
417695
def iterativeFetch(query, batchSize=default_batch_size):
    
    while True:
        rows = query.fetchmany(batchSize)
        if not rows:
            break
        rowDicts = sqliteRowsToDicts(rows)
        for rowDict in rowDicts:
            yield rowDict
1017787
def invenio_query_factory(parser=None, walkers=None):
    """"""
    parser = parser or Main
    walkers = walkers or [PypegConverter()]
    walkers.append(ElasticSearchDSL())

    def invenio_query(pattern):
        query = pypeg2.parse(pattern, parser, whitespace="")
        for walker in walkers:
            query = query.accept(walker)
        return query
    return invenio_query
826765
def iterate_over_fields(cls):
        """"""
        for attr in dir(cls):
            clsattr = getattr(cls, attr)
            if isinstance(clsattr, BaseField):
                yield attr, clsattr
176496
async def streamstorm(self, text, opts=None, user=None):
        '''
        
        '''
        if opts is None:
            opts = {}

        MSG_QUEUE_SIZE = 1000
        chan = asyncio.Queue(MSG_QUEUE_SIZE, loop=self.loop)

        if user is None:
            user = self.auth.getUserByName('root')

        # promote ourself to a synapse task
        synt = await self.boss.promote('storm', user=user, info={'query': text})

        show = opts.get('show')

        async def runStorm():
            cancelled = False
            tick = s_common.now()
            count = 0
            try:
                # First, try text parsing. If this fails, we won't be able to get
                # a storm runtime in the snap, so catch and pass the `err` message
                # before handing a `fini` message along.
                self.getStormQuery(text)

                await chan.put(('init', {'tick': tick, 'text': text, 'task': synt.iden}))

                shownode = (show is None or 'node' in show)
                async with await self.snap(user=user) as snap:

                    if show is None:
                        snap.link(chan.put)

                    else:
                        [snap.on(n, chan.put) for n in show]

                    if shownode:
                        async for pode in snap.iterStormPodes(text, opts=opts, user=user):
                            await chan.put(('node', pode))
                            count += 1

                    else:
                        async for item in snap.storm(text, opts=opts, user=user):
                            count += 1

            except asyncio.CancelledError:
                logger.warning('Storm runtime cancelled.')
                cancelled = True
                raise

            except Exception as e:
                logger.exception('Error during storm execution')
                enfo = s_common.err(e)
                enfo[1].pop('esrc', None)
                enfo[1].pop('ename', None)
                await chan.put(('err', enfo))

            finally:
                if cancelled:
                    return
                tock = s_common.now()
                took = tock - tick
                await chan.put(('fini', {'tock': tock, 'took': took, 'count': count}))

        await synt.worker(runStorm())

        while True:

            mesg = await chan.get()

            yield mesg

            if mesg[0] == 'fini':
                break