def readline(self, size=-1):
    """Read one entire line from the file.

    A trailing newline character is kept in the string (but may be absent when a
    file ends with an incomplete line). If the size argument is present and
    non-negative, it is a maximum byte count (including the trailing newline)
    and an incomplete line may be returned. An empty string is returned only
    when EOF is encountered immediately.

    Args:
      size: Optional. The maximum number of bytes to read.

    Returns:
      The read data, as a string.
    """
    data_list = []
    while True:
      if size < 0:
        end_pos = len(self.__buffer)
      else:
        end_pos = self.__buffer_position + size
      newline_pos = self.__buffer.find('\n', self.__buffer_position, end_pos)
      if newline_pos != -1:
        data_list.append(
            self.__read_from_buffer(newline_pos
                                    - self.__buffer_position + 1)[0])
        break
      else:
        data, size = self.__read_from_buffer(size)
        data_list.append(data)
        if size == 0 or self.__eof:
          break
        self.__fill_buffer()
    return ''.join(data_list)
dataset/ETHPy150Open livid/v2ex/mapreduce/lib/blobstore/blobstore.py/BlobReader.readline/original