"""
Class used to write pytest warning data into html format
"""
import textwrap
import six # lint-amnesty, pylint: disable=unused-import
class HtmlOutlineWriter:
"""
writer to handle html writing
"""
HEAD = textwrap.dedent(
"""
"""
)
SECTION_START = textwrap.dedent(
"""\
"
def __init__(self, fout):
self.fout = fout
self.section_id = 0
self.fout.write(self.HEAD)
def start_section(self, html, klass=None):
self.fout.write(
self.SECTION_START.format(id=self.section_id, html=html, klass=klass or "",)
)
self.section_id += 1
def end_section(self):
self.fout.write(self.SECTION_END)
def write(self, html):
self.fout.write(html)