Parser state machine.
        Every 'yield' expression returns the next byte.
16806
def _parse_coroutine(self):
        
        while True:
            d = yield

            if d == int2byte(0):
                pass  # NOP

            # Go to state escaped.
            elif d == IAC:
                d2 = yield

                if d2 == IAC:
                    self.received_data(d2)

                # Handle simple commands.
                elif d2 in (NOP, DM, BRK, IP, AO, AYT, EC, EL, GA):
                    self.command_received(d2, None)

                # Handle IAC-[DO/DONT/WILL/WONT] commands.
                elif d2 in (DO, DONT, WILL, WONT):
                    d3 = yield
                    self.command_received(d2, d3)

                # Subnegotiation
                elif d2 == SB:
                    # Consume everything until next IAC-SE
                    data = []

                    while True:
                        d3 = yield

                        if d3 == IAC:
                            d4 = yield
                            if d4 == SE:
                                break
                            else:
                                data.append(d4)
                        else:
                            data.append(d3)

                    self.negotiate(b''.join(data))
            else:
                self.received_data(d)
1032587
def each
      return to_enum(__callee__) unless block_given?

      node = self
      loop do
        yield node
        break unless (node = node.next_node)
      end
    end
1148967
def consume(generator):  # pragma: no cover
    
    # If synchronous generator, just consume and return as list
    if hasattr(generator, '__next__'):
        return list(generator)

    if not PY_35:
        raise RuntimeError(
            'paco: asynchronous iterator protocol not supported')

    # If asynchronous generator, consume it generator protocol manually
    buf = []
    while True:
        try:
            buf.append((yield from generator.__anext__()))
        except StopAsyncIteration:  # noqa
            break

    return buf
1015754
def generate_chunks(data, chunk_size=DEFAULT_CHUNK_SIZE):
    """"""
    iterator = iter(repeated.getvalues(data))

    while True:
        chunk = list(itertools.islice(iterator, chunk_size))
        if not chunk:
            return

        yield chunk
784233
async def iter_chunks(self, chunk_size=_DEFAULT_CHUNK_SIZE):
        
        while True:
            current_chunk = await self.read(chunk_size)
            if current_chunk == b"":
                break
            await yield_(current_chunk)
464024
def chunk_iter(iterable, chunk_size):
    ''' '''
    while True:
        chunk = []
        try:
            for _ in range(chunk_size): chunk.append(next(iterable))
            yield chunk
        except StopIteration:
            if chunk: yield chunk
            break
579410
def _parse(self, parsable, parser_name):
        '''
        
        '''
        calc, error = None, None
        try:
            for calc in self.Parsers[parser_name].iparse(parsable):
                yield calc, None
            return
        except RuntimeError as e:
            error = "routine %s parser error in %s: %s" % ( parser_name, parsable, e )
        except:
            exc_type, exc_value, exc_tb = sys.exc_info()
            error = "unexpected %s parser error in %s:\n %s" % ( parser_name, parsable, "".join(traceback.format_exception( exc_type, exc_value, exc_tb )) )
        yield None, error
1046490
def _parse(self, fp):
        
        for line in fp:
            # '   #export foo=some var  ' -> ['#export', 'foo=some var  ']
            bits = shlex_split(line, comments=True)
            if (not bits) or bits[0].startswith('#'):
                continue

            if bits[0] == u'export':
                bits.pop(0)

            key, sep, value = str_partition(u' '.join(bits), u'=')
            if key and sep:
                yield key, value
1332650
private boolean readLine() throws ParseException {
        try {
            return parser.Line();
        } catch (ParseException e) {
            yield();
            if ( EOF )
                return true;
            throw e;
        }
    }
964895
def _file_iter_range(fp, offset, bytes, maxread=1024*1024):
    ''' '''
    fp.seek(offset)
    while bytes > 0:
        part = fp.read(min(bytes, maxread))
        if not part: break
        bytes -= len(part)
        yield part
923545
def collect_tokens_until(self, token_type):
        """"""
        self.next()
        if self.current_token.type == token_type:
            return

        while True:
            yield self.current_token

            self.next()
            if self.current_token.type == token_type:
                return

            if self.current_token.type != 'COMMA':
                raise self.error(f'Expected comma but got '
                                 f'{self.current_token.value!r}')
            self.next()
605452
def iter_content(self, chunk_size=1, warn_only=False):
        
        self._state = "not finished"
        if self.return_code is not None:
            stdout = io.BytesIO(self._stdout)
            data = stdout.read(chunk_size)
            while data:
                yield data
                data = stdout.read(chunk_size)
        else:
            data = b''
            started_at = time.time()
            with self._stream() as proc:
                while proc.poll() is None:
                    chunk = proc.stdout.read(chunk_size)
                    if not chunk:
                        continue
                    yield chunk
                    data += chunk

                if proc.returncode == -9:
                    elapsed = time.time() - started_at
                    self._state = "timeouted"
                    raise subprocess.TimeoutExpired(proc.args, elapsed)

                chunk = proc.stdout.read(chunk_size)
                while chunk:
                    yield chunk
                    data += chunk
                    chunk = proc.stdout.read(chunk_size)

            self._return_code = proc.returncode
            self._stderr = proc.stderr.read()
            self._stdout = data

            self._state = FINISHED
            if not warn_only:
                self.raise_for_error()
1268428
def expressions(self):
        
        for s in self.statements:
            for expr_ in s.expressions:
                yield expr_
        yield self.next
281675
def fasta_iterator(first_line, next_lines)
      current_fasta_header = first_line.chomp
      next_lines.each_slice(batch_size).with_index do |slice, i|
        fasta_mapper = []
        input_set = Set.new

        slice.each do |line|
          line.chomp!
          if fasta? line
            current_fasta_header = line
          else
            fasta_mapper << [current_fasta_header, line]
            input_set << line
          end
        end

        yield(input_set.to_a, i, fasta_mapper)
      end
    end
363399
def slicedIterator(sourceList, sliceSize):
    
    start = 0
    end = 0

    while len(sourceList) > end:
        end = start + sliceSize
        yield sourceList[start: end]
        start = end
331193
def chunks(self):
        

        while True:
            t, v = self.chunk()
            yield t, v
            if t == b'IEND':
                break
423821
def iterdecode(iterable, codec):
    
    decoder = codec.incrementaldecoder()
    for chunk in iterable:
        yield decoder.decode(chunk)
    yield decoder.decode(b'', True)