@tasklets.tasklet<EOL><INDENT>def _count_async(self, limit=None, **q_options):<DEDENT>
<EOL>if '<STR_LIT>' in q_options:<EOL><INDENT>raise NotImplementedError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if '<STR_LIT>' in q_options:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>elif limit is None:<EOL><INDENT>limit = _MAX_LIMIT<EOL><DEDENT>if self._needs_multi_query():<EOL><INDENT>q_options.setdefault('<STR_LIT>', limit)<EOL>q_options.setdefault('<STR_LIT>', True)<EOL>results = yield self.fetch_async(limit, **q_options)<EOL>raise tasklets.Return(len(results))<EOL><DEDENT>q_options['<STR_LIT>'] = limit<EOL>q_options['<STR_LIT>'] = <NUM_LIT:0><EOL>options = self._make_options(q_options)<EOL>conn = tasklets.get_context()._conn<EOL>dsquery = self._get_query(conn)<EOL>rpc = dsquery.run_async(conn, options)<EOL>total = <NUM_LIT:0><EOL>while rpc is not None:<EOL><INDENT>batch = yield rpc<EOL>options = QueryOptions(offset=options.offset - batch.skipped_results,<EOL>config=options)<EOL>rpc = batch.next_batch_async(options)<EOL>total += batch.skipped_results<EOL><DEDENT>raise tasklets.Return(total)<EOL>
Internal version of count_async().