Read lines from f until a nonblank line not starting with a
    hash (#) is encountered and returns this and the next line.
967106
def _skip_to_nonblank(f, spacegroup, setting):
    """"""
    while True:
        line1 = f.readline()
        if not line1:
            raise SpacegroupNotFoundError(
                'invalid spacegroup %s, setting %i not found in data base' %
                ( spacegroup, setting ) )
        line1.strip()
        if line1 and not line1.startswith('#'):
            line2 = f.readline()
            break
    return line1, line2
450882
def next_line(self):
        """"""
        self.line = next(self.lines)  # Will raise StopIteration when there are no more lines
        self.values = self.line.split()
831557
def readfq(fp):
    """"""
    last = None  # this is a buffer keeping the last unprocessed line
    while True:  # mimic closure; is it a bad idea?
        if not last:  # the first record or a record following a fastq
            for l in fp:  # search for the start of the next record
                if l[0] in '>@':  # fasta/q header line
                    last = l[:-1]  # save this line
                    break
        if not last:
            break
        name, seqs, last = last[1:].partition(" ")[0], [], None
        for l in fp:  # read the sequence
            if l[0] in '@+>':
                last = l[:-1]
                break
            seqs.append(l[:-1])
        if not last or last[0] != '+':  # this is a fasta record
            yield name, ''.join(seqs), None  # yield a fasta record
            if not last:
                break
        else:  # this is a fastq record
            seq, leng, seqs = ''.join(seqs), 0, []
            for l in fp:  # read the quality
                seqs.append(l[:-1])
                leng += len(l) - 1
                if leng >= len(seq):  # have read enough quality
                    last = None
                    yield name, seq, ''.join(seqs)  # yield a fastq record
                    break
            if last:  # reach EOF before reading enough quality
                yield name, seq, None  # yield a fasta record instead
                break
1318416
def _read_until(infile=sys.stdin, maxchars=20, end=RS):
    '''   '''
    chars = []
    read = infile.read
    if not isinstance(end, tuple):
        end = (end,)

    # count down, stopping at 0
    while maxchars:
        char = read(1)
        if char in end:
            break
        chars.append(char)
        maxchars -= 1

    return ''.join(chars)
488411
def SkipAhead(self, file_object, number_of_characters):
    
    lines_size = len(self.lines)
    while number_of_characters >= lines_size:
      number_of_characters -= lines_size

      self.lines = ''
      self.ReadLines(file_object)
      lines_size = len(self.lines)
      if lines_size == 0:
        return

    self.lines = self.lines[number_of_characters:]
890300
def skip_read_line(fd, no_eof=False):
    
    ls = ''
    while 1:
        try:
            line = fd.readline()

        except EOFError:
            break

        if not line:
            if no_eof:
                raise EOFError

            else:
                break

        ls = line.strip()
        if ls and (ls[0] != '#'):
            break

    return ls
323308
def following_non_gem_lines
      all_lines[(index+1)..(-1)].
          reject {|x| x.strip.empty? || x.match(GemBench::TRASH_REGEX) }.
          map(&:strip).
          inject([]) do |following_lines, next_line|
            break following_lines if next_line.match(GEM_REGEX)
            following_lines << next_line
      end
    end
109608
def _get_line(self):
        """"""
        line = self._f.readline()
        if len(line) == 0:
            raise StopIteration
        return line
153733
def _get_two_lines(f):
    
    l0 = f.readline()
    l1 = f.readline()
    return l0, l1
359196
def filelines(fname,strip=False):
    ''''''
    with open(fname,'r') as f:
        lines = f.readlines();
    if strip:
        lines[:] = [line.strip() for line in lines]
    return lines;
183904
def __read_seq_data(fh):
  
  line = None
  seq_data = ""
  while line is None or not _isSequenceHead(line):
    line = fh.readline()
    if line == "":
      break  # file is finished...
    if not _isSequenceHead(line):
      seq_data += line.strip()
  return seq_data, line
740113
def read(self, line, f, data):
        """"""
        self.used = True
        data["title"] = f.readline().strip()
        data["symmetry"] = f.readline().split()[0]
        if data["symmetry"] != "C1":
            raise NotImplementedError("Only C1 symmetry is supported.")
        symbols = []
        while line != " $END      \n":
            line = f.readline()
            if line[0] != " ":
                symbols.append(line.split()[0])
        data["symbols"] = symbols
913083
def read_nonblocking(self, size=1, timeout=None):
        

        try:
            s = os.read(self.child_fd, size)
        except OSError as err:
            if err.args[0] == errno.EIO:
                # Linux-style EOF
                self.flag_eof = True
                raise EOF('End Of File (EOF). Exception style platform.')
            raise
        if s == b'':
            # BSD-style EOF
            self.flag_eof = True
            raise EOF('End Of File (EOF). Empty string style platform.')

        s = self._decoder.decode(s, final=False)
        self._log(s, 'read')
        return s
1315760
private Entry parseEntry(String line) throws IOException {
    line = StringUtils.trimToEmpty(line);
    if (line.startsWith("#")) {
      return null;
    }

    int colonIndex = line.indexOf(":");
    if (colonIndex < 0) {
      return null;
    }

    String key = StringUtils.trimToNull(line.substring(0, colonIndex));
    if (key == null) {
      return null;
    }

    String rest = line.substring(colonIndex + 1, line.length());
    int hashIndex = rest.indexOf("#");

    String value = StringUtils.trimToEmpty(hashIndex >= 0 ? rest.substring(0, hashIndex) : rest);

    value = decode(value);

    return new Entry(line, key, value);
  }
707069
def readline(self, size=-1):
        ""
        while True:
            try:
                record = next(self.reader)
            except StopIteration:
                break

            # Ensure this is a valid record
            if checks.record_is_valid(record):
                # Process the line
                cleaned = self.process_line(record)
                if cleaned:
                    lines = []
                    for c in cleaned:
                        lines.append(self.outdel.join([str(x) for x in c]))
                    return '\n'.join(lines) + '\n'

        return ''
451818
def _read_next(cls, lines: List[str]) -> 'Hunk':
        
        header = lines[0]
        assert header.startswith('@@ -')

        # sometimes the first line can occur on the same line as the header.
        # in that case, we inject a new line into the buffer
        end_header_at = header.index(' @@')
        bonus_line = header[end_header_at+3:]
        if bonus_line != "":
            lines.insert(1, bonus_line)

        header = header[4:end_header_at]
        left, _, right = header.partition(' +')
        old_start_at = int(left.split(',')[0])
        new_start_at = int(right.split(',')[0])

        old_line_num = old_start_at
        new_line_num = new_start_at
        last_insertion_at = old_start_at


        hunk_lines = [] # type: List[HunkLine]
        while True:
            # discarding the previous line ensures that we only consume lines
            # from the line buffer that belong to the hunk
            lines.pop(0)
            if not lines:
                break

            line = lines[0]

            # inserted line
            if line.startswith('+'):
                hunk_lines.append(InsertedLine(line[1:]))
                new_line_num += 1

            # deleted line
            elif line.startswith('-'):
                hunk_lines.append(DeletedLine(line[1:]))
                old_line_num += 1

            # context line
            elif line.startswith(' '):
                hunk_lines.append(ContextLine(line[1:]))
                new_line_num += 1
                old_line_num += 1

            # end of hunk
            else:
                break

        return Hunk(old_start_at, new_start_at, hunk_lines)
1192873
def readline(self):
        
        buf = []
        while 1:
            try:
                ch = self.read(1)
            except EOFError:
                return ''.join(buf)
            buf.append(ch)
            if ch == '\n':
                return ''.join(buf)