Skip to main content

Report

This class represents a report that can contain multiple tabs. It manages the creation and retrieval of tabs, and provides functionality to render the final report as HTML. The report can be displayed in environments like IPython, returning an HTML object, or as a raw string otherwise.

Attributes

  • name: string

    • The name of the report.
  • tabs: Dict[str, Tab] = field(default_factory=dict)

    • A dictionary of tabs, where the key is the tab name and the value is the Tab object. Defaults to an empty dictionary.
  • template_path: pathlib.Path = field(default_factory=lambda: pathlib.Path(file).parent / "_template.html")

    • The path to the HTML template file. Defaults to a path relative to the current file.

Constructors

  • Initializes a new instance of the Report class.

  • Parameters

    • name: str
      • The name of the report.
  • Return Value: None

    • This method does not return a value.

Methods

def get_tab(name: str, create_if_missing: bool = True) - > Tab
  • Get a tab by name. If the tab does not exist, create it.

  • Parameters

    • name: str
      • The name of the tab.
    • create_if_missing: bool
      • Whether to create the tab if it does not exist.
  • Return Value: Tab

    • The tab.
def get_final_report()
  • Get the final report as a string.

  • Return Value: Union[str, "HTML"]

    • The final report.