Consume the queue by reading lines off of it and yielding them.
485307
def consume_queue(queue, cascade_stop):
    """"""
    while True:
        try:
            item = queue.get(timeout=0.1)
        except Empty:
            yield None
            continue
        # See https://github.com/docker/compose/issues/189
        except thread.error:
            raise ShutdownException()

        if item.exc:
            raise item.exc

        if item.is_stop:
            if cascade_stop:
                raise StopIteration
            else:
                continue

        yield item.item
267550
def lines_from_stream(chunks):
    
    buf = buffer.DecodingLineBuffer()
    for chunk in chunks:
        buf.feed(chunk)
        # when Python 3, yield from buf
        for _ in buf:
            yield _
375997
def _stream_helper(self, response, decode=False):
        """"""

        if response.raw._fp.chunked:
            if decode:
                for chunk in json_stream(self._stream_helper(response, False)):
                    yield chunk
            else:
                reader = response.raw
                while not reader.closed:
                    # this read call will block until we get a chunk
                    data = reader.read(1)
                    if not data:
                        break
                    if reader._fp.chunk_left:
                        data += reader.read(reader._fp.chunk_left)
                    yield data
        else:
            # Response isn't chunked, meaning we probably
            # encountered an error immediately
            yield self._result(response, json=decode)
1002606
def _read_stdin():
    
    line = sys.stdin.readline()
    while line:
        yield line
        line = sys.stdin.readline()
814329
def consume(iterator, n):
    ""
    # Use functions that consume iterators at C speed.
    if n is None:
        # feed the entire iterator into a zero-length deque
        collections.deque(iterator, maxlen=0)
    else:
        # advance to the empty slice starting at position n
        next(islice(iterator, n, n), None)
637027
def buffered_read(fh, lock, offsets, bytecounts, buffersize=None):
    """"""
    if buffersize is None:
        buffersize = 2**26
    length = len(offsets)
    i = 0
    while i < length:
        data = []
        with lock:
            size = 0
            while size < buffersize and i < length:
                fh.seek(offsets[i])
                bytecount = bytecounts[i]
                data.append(fh.read(bytecount))
                # buffer = bytearray(bytecount)
                # n = fh.readinto(buffer)
                # data.append(buffer[:n])
                size += bytecount
                i += 1
        for segment in data:
            yield segment
608962
def readline(self):
        """"""

        try:
            r = next(self.iterator) + os.linesep
            return r
        except StopIteration:
            return ""
674321
private List<Route> load(InputStream inputStream) throws ParseException, IOException {
		int line = 0; // reset line positioning
		List<Route> routes = new ArrayList<Route>(); // this is what we will fill and return

		BufferedReader in = null;
		try {
			in = new BufferedReader(new InputStreamReader(inputStream));

			String input;
			while ( (input = in.readLine()) != null ) {
				line++;

				input = input.trim();

				// only parse line if it is not empty and not a comment
				if (!input.equals("") && !input.startsWith("#")) {
					Route route = parse(input, line);
					routes.add(route);
				}
			}

		} finally {
			closeResource(in);
		}

		return routes;
	}
14396
def read_data(self, timeout=10.0):
        """"""
        # Read from stdout in a separate thread and consume data from
        # the queue.
        start_time = time.time()
        while True:
            # Wait for data to be available or a timeout.
            data = None
            try:
                data = self.stdout_reader.queue.get(timeout=timeout)
                if data:
                    yield data
                else:
                    # End of file.
                    break
            except queue.Empty:
                # Queue read timed out.
                end_time = time.time()
                if not data:
                    if end_time - start_time >= timeout:
                        # Nothing interesting has happened for a while --
                        # FFmpeg is probably hanging.
                        raise ReadTimeoutError('ffmpeg output: {}'.format(
                            ''.join(self.stderr_reader.queue.queue)
                        ))
                    else:
                        start_time = end_time
                        # Keep waiting.
                        continue
171342
private void performReads(ReadResult readResult) throws InterruptedException {
    long start = System.currentTimeMillis();
    for (int i = 0; i < streams.length; ) {
      boolean acquired = slots.tryAcquire(1, 10, TimeUnit.SECONDS);
      reporter.progress();
      if (acquired) {
        readPool.execute(new ReadOperation(readResult, i));
        i++;
      }
    }
    // All read operations have been submitted to the readPool.
    // Now wait for the operations to finish and release the semaphore.
    while (true) {
      boolean acquired =
        slots.tryAcquire(numThreads, 10, TimeUnit.SECONDS);
      reporter.progress();
      if (acquired) {
        slots.release(numThreads);
        break;
      }
    }

    readTime += (System.currentTimeMillis() - start);
  }
753115
def _consume(self):
        
        while True:
            try:
                task, args, kwargs = self.queue.get(True)
                task(*args, **kwargs)
            finally:
                self.queue.task_done()
1176346
def stream_lines(tokens, line_num)
      yield line_start(line_num)

      tokens.each do |token, value|
        yield @inner.span(token, value)
      end

      yield line_end(line_num)
    end
942459
def stream_stdin_lines():
    """"""
    stdin = os.fdopen(sys.stdin.fileno(), 'r', 0)
    while True:
        line = stdin.readline()
        if line:
            yield line
        else:
            break
571496
function readLines(path, callback) {
    return new Promise(function(resolve, reject) {
        const stream = fsExtra.createReadStream(path);
        stream.on('error', reject);
        stream.on('end', resolve);

        const lineReader = readline.createInterface({
            input : stream
        });
        lineReader.on('line', callback);
    });
}
221297
def _parse_queue_list(list_output):
    '''
    
    '''
    queues = dict((q.split('/')[-1], q) for q in list_output['stdout'])
    return queues
121034
def _read_next_line(self):
        """"""
        prev_line = self._line
        self._line = self.stream.readline()
        return prev_line
1332650
private boolean readLine() throws ParseException {
        try {
            return parser.Line();
        } catch (ParseException e) {
            yield();
            if ( EOF )
                return true;
            throw e;
        }
    }