transport_data.report.Report¶
- class transport_data.report.Report[source]¶
Bases:
ABC
Abstract class for reports.
Subclasses:
must implement
render()
.may use
dataclasses.dataclass()
to declare additional attributes and an__init__()
method that accepts and stores them.
- __init__()¶
Methods
__init__
()render
()Render the report (generate its contents) and return as str or bytes.
render_jinja_template
(*args, **kwargs)Retrieve the Jinja2
template_name
and call its render method.rst2odt
(content)Convert content from reStructuredText to OpenDocument Text (ODT).
write_file
(path, **kwargs)render()
the report and write to path.Attributes
Name of a Jinja2 template used by the report; see
render_jinja_template()
.- abstractmethod render() str | bytes ¶
Render the report (generate its contents) and return as str or bytes.
The content may be in any format: plain text, HTML, binary file content, etc.
- render_jinja_template(*args, **kwargs) str ¶
Retrieve the Jinja2
template_name
and call its render method.
- rst2odt(content: str) bytes ¶
Convert content from reStructuredText to OpenDocument Text (ODT).
- Returns:
The ODT (ZIP) archive.
- Return type:
- template_name: str¶
Name of a Jinja2 template used by the report; see
render_jinja_template()
.