Skip to content

report

Reportable

Bases: Protocol

__str__() abstractmethod

Return a string representation.

Source code in src/flowcean/core/report.py
6
7
8
9
@abstractmethod
def __str__(self) -> str:
    """Return a string representation."""
    raise NotImplementedError

Report(entries)

A report containing reportables.

Initialize the report.

Parameters:

Name Type Description Default
entries dict[str, Reportable]

The report entries.

required
Source code in src/flowcean/core/report.py
15
16
17
18
19
20
21
def __init__(self, entries: dict[str, Reportable]) -> None:
    """Initialize the report.

    Args:
        entries: The report entries.
    """
    self.entries = entries

__getitem__(name)

Return a report entry by name.

Usage: report["accuracy"]

Source code in src/flowcean/core/report.py
23
24
25
26
27
28
def __getitem__(self, name: str) -> Reportable:
    """Return a report entry by name.

    Usage: report["accuracy"]
    """
    return self.entries[name]

__str__()

Return a string representation of the report.

Source code in src/flowcean/core/report.py
30
31
32
33
34
def __str__(self) -> str:
    """Return a string representation of the report."""
    return "\n".join(
        f"{name}: {value}" for name, value in self.entries.items()
    )