Read pre- or suffix of line at current position with given
        format `fmt` (default 'i').
349092
def _fix(self, fmt='i'):
        
        fmt = self.endian + fmt
        fix = self.read(struct.calcsize(fmt))
        if fix:
            return struct.unpack(fmt, fix)[0]
        else:
            raise EOFError
1027018
def _suffix(self):
        """"""
        _output_formats={'GCG':'.msf',
                        'GDE':'.gde',
                        'PHYLIP':'.phy',
                        'PIR':'.pir',
                        'NEXUS':'.nxs'}

        if self.Parameters['-output'].isOn():
            return _output_formats[self.Parameters['-output'].Value]
        else:
            return '.aln'
121034
def _read_next_line(self):
        """"""
        prev_line = self._line
        self._line = self.stream.readline()
        return prev_line
1083453
def readline(self):
        
        line = ""
        n_pos = -1
        try:
            while n_pos < 0:
                line += self.next_chunk()
                n_pos = line.find('\n')
        except StopIteration:
            pass

        if n_pos >= 0:
            line, extra = line[:n_pos+1], line[n_pos+1:]
            self.unshift(extra)
        return line
459704
def readfmt(stream, fmt):
    """"""
    size = struct.calcsize(fmt)
    blob = stream.read(size)
    return struct.unpack(fmt, blob)
302540
function prev(index, lines) {
    while (index--) {
      var line = lines[index].trim();

      if (line && !/^(\/\/|\/\*)/.test(line)) {
        return { line: line, index: index };
      }
    }

    return {};
  }
1230851
def tail(self, line_by_line=True, move_end=True):
        """"""
        try:
            self._open_file(move_end=move_end)

            while True:
                pos = self._f.tell()
                line = self._f.readline()
                if line:
                    line = line.strip(chr(0))  # a truncate may have create holes in the file
                    if self._callback(line.rstrip("\n")):
                        if line_by_line:
                            yield True
                            pos = self._f.tell()
                            self._open_file(move_end=False, pos=pos)
                        else:
                            continue
                    else:
                        continue
                else:
                    yield True
                    assert pos == self._f.tell()
                    self._open_file(move_end=False, pos=pos)

        except Exception as e:
            # log but survive
            self._log.exception(e)
            raise StopIteration(e)
1090716
def read_line(line):
        """"""
        name, value = '', ''

        if '=' in line:
            name, value = line.split('=', 1)

        return [name.strip(), value.strip()]
271445
def readf(nb_file, fmt=None):
    """"""
    if nb_file == '-':
        text = sys.stdin.read()
        fmt = fmt or divine_format(text)
        return reads(text, fmt)

    _, ext = os.path.splitext(nb_file)
    fmt = copy(fmt or {})
    fmt.update({'extension': ext})
    with io.open(nb_file, encoding='utf-8') as stream:
        return read(stream, fmt, as_version=4)
520819
def _readbin(fid, fmt='i', nwords=1, file64=False, unpack=True):
    
    if fmt in 'if':
        fmt += '8' if file64 else '4'
    elts = np.fromfile(fid, fmt, nwords)
    if unpack and len(elts) == 1:
        elts = elts[0]
    return elts
982785
def indexOf(self, pattern, start_idx, bitlength):
        
        return StrIndexOf(self, pattern, start_idx, bitlength)
861601
def p_suffix(self, length=None, elipsis=False):
        ""
        if length is not None:
            result = self.input[self.pos:self.pos + length]
            if elipsis and len(result) == length:
                result += "..."
            return result
        return self.input[self.pos:]
652921
def flush_read_tuple(self):
        
        if not self.is_empty():
            suffix_comment_buffer = []
            if self._info_simulator is not None:
                suffix_comment_buffer.append(self._info_simulator)
            if self._info_reads_in_tuple:
                # todo: orientation (FF, FR, etc.)
                # orientation="".join([])
                suffix_comment_buffer.append("reads-in-tuple:{}".format(len(self.seqs_bases)))
            if len(suffix_comment_buffer) != 0:
                suffix_comment = "[{}]".format(",".join(suffix_comment_buffer))
            else:
                suffix_comment = ""

            rnf_name = self._rnf_profile.get_rnf_name(
                rnftools.rnfformat.ReadTuple(
                    segments=self.segments,
                    read_tuple_id=self.current_read_tuple_id,
                    suffix=suffix_comment,
                )
            )
            fq_reads = [
                os.linesep.join(
                    [
                        "@{rnf_name}{read_suffix}".format(
                            rnf_name=rnf_name,
                            read_suffix="/{}".format(str(i + 1)) if len(self.seqs_bases) > 1 else "",
                        ),
                        self.seqs_bases[i],
                        "+",
                        self.seqs_qualities[i],
                    ]
                ) for i in range(len(self.seqs_bases))
            ]
            self._fq_file.write(os.linesep.join(fq_reads))
            self._fq_file.write(os.linesep)
            self.empty()
753525
def readfmt(self, fmt):
        """"""
        size = struct.calcsize(fmt)
        blob = self.read(size)
        obj, = struct.unpack(fmt, blob)
        return obj
916058
def parse_format_index(self, text):
        """"""

        base = 10
        prefix = text[1:3] if text[0] == "-" else text[:2]
        if prefix[0:1] == "0":
            char = prefix[-1]
            if char == "b":
                base = 2
            elif char == "o":
                base = 8
            elif char == "x":
                base = 16
        try:
            text = int(text, base)
        except Exception:
            pass
        return text
195146
def readlines(self, offset=0):
        """"""
        try:
            with open(self._filepath) as fp:
                # For full read go through existing lines in file
                if self._full_read:
                    fp.seek(offset)
                    for row in fp:
                        yield row

                # Okay now dynamically tail the file
                if self._tail:
                    while True:
                        current = fp.tell()
                        row = fp.readline()
                        if row:
                            yield row
                        else:
                            fp.seek(current)
                            time.sleep(self._sleep)

        except IOError as err:
            print('Error reading the file {0}: {1}'.format(self._filepath, err))
            return
849670
private static int suffixLength(byte[] needle, int p) {
        int len = 0;
        for (int i = p, j = needle.length - 1; i >= 0 && needle[i] == needle[j]; --i, --j) {
            len++;
        }
        return len;
    }