|
| 1 | +# Copyright (c) 2015-2025, UT-BATTELLE, LLC |
| 2 | +# All rights reserved. |
| 3 | +# |
| 4 | +# Redistribution and use in source and binary forms, with or without |
| 5 | +# modification, are permitted provided that the following conditions are met: |
| 6 | +# |
| 7 | +# 1. Redistributions of source code must retain the above copyright notice, this |
| 8 | +# list of conditions and the following disclaimer. |
| 9 | +# |
| 10 | +# 2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 | +# this list of conditions and the following disclaimer in the documentation |
| 12 | +# and/or other materials provided with the distribution. |
| 13 | +# |
| 14 | +# 3. Neither the name of the copyright holder nor the names of its contributors |
| 15 | +# may be used to endorse or promote products derived from this software without |
| 16 | +# specific prior written permission. |
| 17 | +# |
| 18 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 19 | +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 20 | +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 21 | +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 22 | +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 23 | +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 24 | +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 25 | +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 26 | +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | + |
| 29 | + |
| 30 | +""" |
| 31 | +This template provides an example of a minimal LIVVkit extension. |
| 32 | +""" |
| 33 | + |
| 34 | +from livvkit import elements as el |
| 35 | +# Don't remove summarize_result...this is used by livvkit.components.validation |
| 36 | +# to have the summaries appear on the main LIVVkit output page |
| 37 | +from lex.common import summarize_result as sum_common |
| 38 | + |
| 39 | +def run(name, config): |
| 40 | + """ |
| 41 | + Runs the extension. |
| 42 | +
|
| 43 | + Args: |
| 44 | + name: The name of the extension |
| 45 | + config: A dictionary representation of the configuration file |
| 46 | +
|
| 47 | + Returns: |
| 48 | + A LIVVkit page element containing the LIVVkit elements to display on a webpage |
| 49 | + """ |
| 50 | + # TODO: Put your analysis here |
| 51 | + element_list = [ |
| 52 | + el.Error("Unimplemented test", "This test contains no analysis code!"), |
| 53 | + el.Table( |
| 54 | + title="Sample Table", |
| 55 | + data={"row1": [1, 2, 3], "row2": [4, 5, 6]}, |
| 56 | + transpose=True, |
| 57 | + ), |
| 58 | + ] |
| 59 | + |
| 60 | + return el.Page( |
| 61 | + name, |
| 62 | + config["description"], |
| 63 | + elements=element_list, |
| 64 | + ) |
| 65 | + |
| 66 | + |
| 67 | +def print_summary(summary): |
| 68 | + """ |
| 69 | + Print out a summary generated by this module's summarize_result method |
| 70 | + """ |
| 71 | + raise NotImplementedError |
| 72 | + |
| 73 | + |
| 74 | +def summarize_result(result): |
| 75 | + """ |
| 76 | + Provides a snapshot of the extension's results to be provided on the |
| 77 | + summary webpage and printed to STDOUT via the print_summary method |
| 78 | + """ |
| 79 | + return sum_common(result) |
| 80 | + |
| 81 | +def populate_metadata(): |
| 82 | + """ |
| 83 | + Generates the metadata needed for the output summary page |
| 84 | + """ |
| 85 | + raise NotImplementedError |
0 commit comments