Takes each line of a stream, creating a generator that yields
    tuples of line, row - where row is the line split by separator
    (or by whitespace if separator is None.

    :param stream:
    :param separator: (optional)
    :return: generator
761391
def parse_lines(stream, separator=None):
    
    separator = None if separator is None else unicode(separator)
    for line in stream:
        line = line.rstrip(u'\r\n')
        row = [interpret_segment(i) for i in line.split(separator)]
        yield line, row
174124
def parse(cls, stream):
        
        stream_rdr = cls._make_stream_reader(stream)
        ifd0_offset = stream_rdr.read_long(4)
        ifd_entries = _IfdEntries.from_stream(stream_rdr, ifd0_offset)
        return cls(ifd_entries)
1199809
public static Stream<CharSequence> split(CharSequence seq, RegexMatcher matcher)
    {
        return StreamSupport.stream(new SpliteratorImpl(seq, matcher), false);
    }
745121
def get_wrapped_stream(stream):
    

    if stream is None:
        raise TypeError("must provide a stream to wrap")
    encoding = getattr(stream, "encoding", None)
    encoding = get_output_encoding(encoding)
    return StreamWrapper(stream, encoding, "replace", line_buffering=True)
427670
def _stream(self):
        
        if self._exception:
            raise self._exception
        try:
            if self._content:
                yield self._content
            else:
                args = self.create_args()
                if args:
                    with streams.connect(*args, env=SAFE_ENV) as s:
                        yield s
                else:
                    with open(self.path, "rU") as f:  # universal newlines
                        yield f
        except StopIteration:
            raise
        except Exception as ex:
            self._exception = ex
            raise ContentException(str(ex))
99250
def __get_tokens(self, row):
        """"""
        row_tokenizer = RowTokenizer(row, self.config)

        line = row_tokenizer.next()
        while line:
            # print("RETURN line", line[0:100])
            yield line
            line = row_tokenizer.next()
1149468
def to_chunks(stream_or_generator):
    

    if isinstance(stream_or_generator, types.GeneratorType):
        yield from stream_or_generator
    elif hasattr(stream_or_generator, 'read'):
        while True:
            chunk = stream_or_generator.read(CHUNK_SIZE)
            if not chunk:
                break  # no more data

            yield chunk

    else:
        raise TypeError('Input must be either readable or generator.')
1098125
public void load(InputStream stream, String separator) throws IOException, PropertiesException {
		 
		try(DataInputStream data = new DataInputStream(stream); Reader reader = new InputStreamReader(data); BufferedReader br = new BufferedReader(reader)) {
			String line;
			StringBuilder buffer = new StringBuilder();
			while ((line = br.readLine()) != null)   {
				if(Strings.trimRight(line).startsWith(LINE_COMMENT_START)) {
					// comment line, skip!
					continue;
				} else {					
					// now check if multi-line property
					if(line.endsWith(CONTINUE_ON_NEW_LINE)) {
						// middle line in multi-line, add and skip parsing
						buffer.append(line.replaceFirst("\\\\$", ""));
						continue;
					} else {
						// ordinary line, or end of multi-line: add and parse
						buffer.append(line);
					}
				}
				line = buffer.toString().trim();
				buffer.setLength(0);
				int index = -1;
				if(line.length() > 0 && (index = line.lastIndexOf(separator)) != -1) {
					String key = line.substring(0, index).trim();
					String value = line.substring(index + separator.length()).trim();
					if("@".equals(key)) {
						logger.trace("including and overriding values defined so far with file '{}'", value);
						load(value, separator);
					} else {
						logger.trace("adding '{}' => '{}'", key, value);
						this.put(key.trim(), value.trim());
					}
				}
			}
			if(buffer.length() > 0) {
				logger.warn("multi-line property '{}' is not properly terminated", buffer);
			}
		}
	}
868190
def get_streams(self, namespace=None):
    
    request_dict = {}
    namespace = namespace or self.namespace
    if namespace is not None:
      request_dict['namespace'] = namespace
    response = self._make_request(self._streams_url,
                                  data=request_dict,
                                  stream=True)
    for line in response.iter_lines():
      if line:
        yield line
1322643
@SuppressWarnings("unchecked")
    private static <P_IN> Spliterator<P_IN> sliceSpliterator(StreamShape shape,
                                                             Spliterator<P_IN> s,
                                                             long skip, long limit) {
        assert s.hasCharacteristics(Spliterator.SUBSIZED);
        long sliceFence = calcSliceFence(skip, limit);
        switch (shape) {
            case REFERENCE:
                return new StreamSpliterators
                        .SliceSpliterator.OfRef<>(s, skip, sliceFence);
            case INT_VALUE:
                return (Spliterator<P_IN>) new StreamSpliterators
                        .SliceSpliterator.OfInt((Spliterator.OfInt) s, skip, sliceFence);
            case LONG_VALUE:
                return (Spliterator<P_IN>) new StreamSpliterators
                        .SliceSpliterator.OfLong((Spliterator.OfLong) s, skip, sliceFence);
            case DOUBLE_VALUE:
                return (Spliterator<P_IN>) new StreamSpliterators
                        .SliceSpliterator.OfDouble((Spliterator.OfDouble) s, skip, sliceFence);
            default:
                throw new IllegalStateException("Unknown shape " + shape);
        }
    }
231945
public final static <T> Tuple2<Stream<T>, Stream<T>> partition(final Stream<T> stream, final Predicate<? super T> splitter) {
        final Tuple2<Stream<T>, Stream<T>> Tuple2 = duplicate(stream);
        return Tuple.tuple(
                          Tuple2._1().filter(splitter), Tuple2._2().filter(splitter.negate()));
    }
469523
public static <T> List<T> toList(BaseStream<T, ? extends BaseStream> stream) {
        return StreamSupport.stream(
                        Spliterators.spliteratorUnknownSize(stream.iterator(), Spliterator.ORDERED),
                false).collect(Collectors.<T>toList());
    }
787727
def __parse_stream(self, stream, parse_line):
        """"""

        if not stream:
            raise InvalidFormatError(cause='stream cannot be empty or None')

        nline = 0
        lines = stream.split('\n')

        for line in lines:
            nline += 1

            # Ignore blank lines and comments
            m = re.match(self.LINES_TO_IGNORE_REGEX, line, re.UNICODE)
            if m:
                continue

            m = re.match(self.VALID_LINE_REGEX, line, re.UNICODE)
            if not m:
                cause = "line %s: invalid format" % str(nline)
                raise InvalidFormatError(cause=cause)

            try:
                result = parse_line(m.group(1), m.group(2))
                yield result
            except InvalidFormatError as e:
                cause = "line %s: %s" % (str(nline), e)
                raise InvalidFormatError(cause=cause)
1011168
def dump_stream(self, iterator, stream):
        

        def init_stream_yield_batches():
            should_write_start_length = True
            for series in iterator:
                batch = self._create_batch(series)
                if should_write_start_length:
                    write_int(SpecialLengths.START_ARROW_STREAM, stream)
                    should_write_start_length = False
                yield batch

        return ArrowStreamSerializer.dump_stream(self, init_stream_yield_batches(), stream)
736305
def tokenize(self):
        
        def readlines(s):
            while True:
                line = s.readline()
                if line != "":
                    yield line.rstrip()
                else:
                    break

        for self.lineno, line in enumerate(readlines(self.stream), 1):
            for self.column, part in self.split(line):
                if part[0] == "#": # COMMENT
                    break
                yield (self.lineno, self.column, self.tokentype(part))
1069511
def line_iterator(readable_file, size=None):
    # type: (IO[bytes], Optional[int]) -> Iterator[bytes]
    
    read = readable_file.read
    line = []
    byte = b"1"
    if size is None or size < 0:
        while byte:
            byte = read(1)
            line.append(byte)
            if byte in b"\n":
                yield b"".join(line)
                del line[:]

    else:
        while byte and size:
            byte = read(1)
            size -= len(byte)
            line.append(byte)
            if byte in b"\n" or not size:
                yield b"".join(line)
                del line[:]
519428
def data_from_stream(self, stream):
        
        parser = self._make_representation_parser(stream, self.resource_class,
                                                  self._mapping)
        return parser.run()