def iterator_test(infile, report_step=100000):
    '''only output parseable lines from infile.'''

    ninput, noutput, nerrors = 0, 0, 0

    while 1:
        try:
            x = infile.next()
        except ParsingError, msg:
            nerrors += 1
            ninput += 1
            E.warn(str(msg))
            continue
        except __HOLE__:
            break

        if not x:
            break

        ninput += 1

        if ninput % report_step == 0:
            E.info("progress: ninput=%i, noutput=%i" % (ninput, noutput))

        yield x
        noutput += 1

    E.info("iterator_test: ninput=%i, noutput=%i, nerrors=%i" %
           (ninput, noutput, nerrors))
dataset/ETHPy150Open CGATOxford/cgat/obsolete/BlatTest.py/iterator_test