

def __iter__(self):
    table = self.table
    source = self.source
    encoding = self.encoding
    errors = self.errors
    lineterminator = self.lineterminator
    caption = self.caption
    index_header = self.index_header
    tr_style = self.tr_style
    td_styles = self.td_styles
    vrepr = self.vrepr
    truncate = self.truncate
    with source.open('wb') as buf:
        if PY2:
            codec = getcodec(encoding)
            f = codec.streamwriter(buf, errors=errors)
        else:
            f = io.TextIOWrapper(buf, encoding=encoding, errors=errors, newline='')
        try:
            it = iter(table)
            hdr = next(it)
            _write_begin(f, hdr, lineterminator, caption, index_header, truncate)
            (yield hdr)
            if (tr_style and callable(tr_style)):
                it = (Record(row, hdr) for row in it)
            for row in it:
                _write_row(f, hdr, row, lineterminator, vrepr, tr_style, td_styles, truncate)
                (yield row)
            _write_end(f, lineterminator)
            f.flush()
        finally:
            if (not PY2):
                f.detach()

dataset/ETHPy150Open alimanfoo/petl/petl/io/html.py TeeHTMLView.__iter__/original