saftig.evaluation.report_generation¶
Tooling to generate pdf reports through latex
Classes¶
Parent class for elements placed in a report object that generate latex code |
|
Figure element for reports |
|
Table element for reports |
|
Latex code generator |
Module Contents¶
- class saftig.evaluation.report_generation.ReportElement¶
Bases:
abc.ABCParent class for elements placed in a report object that generate latex code
- abstract latex()¶
Generate latex code
- Return type:
str
- class saftig.evaluation.report_generation.ReportFigure(image_path, caption=None, width=1.0)¶
Bases:
ReportElementFigure element for reports
- Parameters:
image_path (str) –
caption (str | None) –
width (float) –
- image_path¶
- caption = None¶
- width = 1.0¶
- latex()¶
Generate latex code
- Return type:
str
- class saftig.evaluation.report_generation.ReportTable(table_content, header=None, caption=None, cell_format=None, horizontal_separator=' ')¶
Bases:
ReportElementTable element for reports
- Parameters:
table_content (collections.abc.Sequence[collections.abc.Sequence[str]]) –
header (collections.abc.Sequence[str] | None) –
caption (str | None) –
cell_format (str | None) –
horizontal_separator (str) –
- table_content¶
- caption = None¶
- format = None¶
- latex()¶
Generate latex code
- Return type:
str
- class saftig.evaluation.report_generation.Report¶
Bases:
dictLatex code generator
- block_start = Multiline-String¶
Show Value
"""\documentclass[12pt, a4paper]{report} \usepackage[top=3cm, bottom=3cm, left = 2cm, right = 2cm]{geometry} \usepackage[utf8]{inputenc} \usepackage{float} \usepackage{caption} \usepackage{graphicx} \begin{document} """
- block_end = '\\end{document}'¶
- sectioning_commands = ['chapter', 'section', 'subsection', 'subsubsection', 'paragraph', 'subparagraph']¶
- static _generate_entry(entry)¶
Generate latex code for the given entry
- generate(structure=None, level=0)¶
Generate latex code
- Parameters:
structure (dict | None) –
level (int) –
- Return type:
str
- save(fname)¶
Save latex code to file
- Parameters:
fname (str | pathlib.Path) –
- Return type:
None
- compile(fname)¶
Compile report using pdflatex If not present, the required .pdf and .tex suffixes are added as needed.
returns the path of the generated pdf file
- Parameters:
fname (str | pathlib.Path) –
- Return type:
pathlib.Path