You're reading an old version of this documentation. If you want up-to-date information, please have a look at v0.8.2.
snl_d3d_cec_verify.report package¶
- class snl_d3d_cec_verify.report.Content(width=None)¶
Class for storing document content in Pandoc markdown format. Use in conjunction with the
Report
class.Content is stored in order, for example:
>>> report = Report() >>> report.content.add_text("one") >>> report.content.add_text("two") >>> print(report) 1: one 2: 3: two 4:
Note that an empty line is placed between each part of the content.
- add_text(text, wrapped=True)¶
Add a paragraph of text to the document.
>>> report = Report() >>> report.content.add_text("one") >>> print(report) 1: one 2:
- add_heading(text, level=1)¶
Add a heading to the document.
>>> report = Report() >>> report.content.add_heading("One") >>> print(report) 1: # One 2:
- add_table(dataframe, index=True, caption=None)¶
Add a table to the document, converted from a
pandas.DataFrame
.>>> report = Report() >>> a = {"a": [1, 2], ... "b": [3, 4]} >>> df = pd.DataFrame(a) >>> report.content.add_table(df, index=False, caption="A table") >>> print(report) 1: | a | b | 2: |----:|----:| 3: | 1 | 3 | 4: | 2 | 4 | 5: 6: Table: A table 7:
- add_image(path, caption=None, width=None, height=None)¶
Add image to document, passed as path to a compatible image file.
>>> report = Report() >>> report.content.add_image("high_art.png", ... caption="Probably an NFT", ... width="6in", ... height="4in") >>> print(report) 1: ![Probably an NFT](high_art.png){ width=6in height=4in } 2:
- clear()¶
Remove all content from the document
>>> report = Report() >>> report.content.add_text("one") >>> report.content.add_text("two") >>> report.content.clear() >>> print(report)
- undo()¶
Undo the last content addition
>>> report = Report() >>> report.content.add_text("one") >>> report.content.add_text("two") >>> report.content.undo() >>> print(report) 1: one 2: