livvkit.elements package

Submodules

livvkit.elements.elements module

Module containing report generation and display elements

The elements in this module are used by LIVVkit to generate analyses reports. Reports by default will be a portable HTML website, but each of these elements provide some experimental (and therefore undocumented) report formats: JSON-Only and LaTeX.

New elements should derive from, or implement the same interface as, the BaseElement abstract class.

class livvkit.elements.elements.B4BImage(title, description, page_path)[source]

Bases: livvkit.elements.elements.Image

A B4BImage element

A dummy Image that can be used by the BitForBit element indicating a bit-for-bit verification result.

class livvkit.elements.elements.BaseElement[source]

Bases: abc.ABC

An abstract base LIVVkit element

An abstract base LIVVkit element providing the basic element interface expected by LIVVkit. All LIVVkit elements should either derive from this class or implement the same interface.

class livvkit.elements.elements.BitForBit(title, data, imgs)[source]

Bases: livvkit.elements.elements.CompositeElement

A LIVVkit BitForBit element

The BitForBit element will produce a table in the analysis report indicating bit-for-bit statuses with a difference image shown in the final column of the table.

class livvkit.elements.elements.CompositeElement(elements)[source]

Bases: livvkit.elements.elements.BaseElement, abc.ABC

An abstract base LIVVkit element that contains other elements

An abstract base LIVVkit element that contains other elements in self.elements and provides the basic element interface expected by LIVVkit. All LIVVkit elements should either be derived from the LIVVkit BaseElement or implement the same interface.

class livvkit.elements.elements.Error(title, message)[source]

Bases: livvkit.elements.elements.BaseElement

A LIVVkit Error element

The Error element will produce an error message in the analysis report.

class livvkit.elements.elements.FileDiff(title, from_file, to_file, context=3)[source]

Bases: livvkit.elements.elements.BaseElement

A LIVVkit FileDiff element

The FilleDiff element will compare two text files and produce a git-diff style diff of the files.

diff_files(context=3)[source]

Perform the file diff

Parameters

context – An positive int indicating the number of lines of context to display on either side of each difference found

Returns

Tuple containing:
difference: A str containing either a git-style diff of the

files if a difference was found or the original file in full

diff_status: A boolean indicating whether any differences were

found

Return type

(tuple)

class livvkit.elements.elements.Gallery(title, elements)[source]

Bases: livvkit.elements.elements.CompositeElement

A LIVVkit Gallery element

The Gallery element is a super element intended to group LIVVkit Image elements into a gallery. It also will allow for the generation of other (experimental!) Report types (e.g., LaTeX), where the “Gallery” meaning might be better interpreted as a figure “subsection”.

class livvkit.elements.elements.Image(title, desc, image_file, group=None, height=None, relative_to=None)[source]

Bases: livvkit.elements.elements.BaseElement

A LIVVkit Image element

The Image element produces an image/figure in the report.

class livvkit.elements.elements.NAImage(title, description, page_path)[source]

Bases: livvkit.elements.elements.Image

A NAImage element

A dummy Image that can be used to indicate a missing image

class livvkit.elements.elements.NamedCompositeElement(elements_dict)[source]

Bases: livvkit.elements.elements.BaseElement, abc.ABC

An abstract base LIVVkit element that contains multiple other composite elements

An abstract base LIVVkit element that allows to logically group multiple other composite elements in self.element_dict and provides the basic element interface expected by LIVVkit. All LIVVkit elements should either be derived from the LIVVkit BaseElement or implement the same interface.

class livvkit.elements.elements.Page(title, description, elements, references='')[source]

Bases: livvkit.elements.elements.CompositeElement

A LIVVkit Page element

The Page element contains the description of an analysis, the elements that should be displayed for this analysis on the report, as well as any references that should be included in the report. In general usage, this will be used to create an HTML page inside LIVVkit output website. It also will allow for the generation of other (experimental!) Report types (e.g., LaTeX), where the “page” meaning might be better interpreted as a “section”.

For LIVVkit Extensions (LEX), an instance of this class should be returned from the extensions run() function.

add_references(references)[source]

Add a reference to the internal reference list

Parameters

references – The references to add to this page’s internal reference list. This can be a path to a bibtex file containing the references, or a list/set/tuple of bibtex files containing the references (Note: This will include the default LIVVkit references and ALL references inside the bibtex file(s)!).

class livvkit.elements.elements.RawHTML(html)[source]

Bases: livvkit.elements.elements.BaseElement

A LIVVkit RawHTML element

The RawHTML element will directly display the contained HTML in the analysis report. For an HTML report (default) this will be directly written onto the page so is a potential security hole and should be used with caution. For the experimental report types (e.g., LaTeX) the contained HTML will be written to report in a code display block or as a raw string.

class livvkit.elements.elements.Section(title, elements)[source]

Bases: livvkit.elements.elements.CompositeElement

A LIVVkit Section element

The Section element is a super element intended to logically separate elements into titled sections. It also will allow for the generation of other (experimental!) Report types (e.g., LaTeX), where the “section” meaning might be better interpreted as a “subsection”.

class livvkit.elements.elements.Table(title, data, index=False, transpose=False)[source]

Bases: livvkit.elements.elements.BaseElement

A LIVVkit Table element

The Table element will produce a table in the analysis report.

class livvkit.elements.elements.Tabs(tabs)[source]

Bases: livvkit.elements.elements.NamedCompositeElement

A LIVVkit Tabs element

The Tabs element is a super element intended to logically separate elements into clickable tabs on the output website. It also will allow for the generation of other (experimental!) Report types (e.g., LaTeX), where the “tabs” meaning might be better interpreted as a “subsection”.

Module contents