Formatting output¶
The formatting module provides classes for formatting simulation/analysis records in different ways: summary, list or table; and in different mark-up formats: currently text or HTML.
- copyright:
Copyright 2006-2020, 2024 by the Sumatra team, see doc/authors.txt
- license:
BSD 2-clause, see LICENSE for details.
Formatting Sumatra records¶
- class sumatra.formatting.TextFormatter(records, project=None, tags=None)¶
Bases:
FormatterFormat the information from a list of Sumatra records as text.
- format(mode='short')¶
Format a record according to the given mode.
modemay be ‘short’, ‘long’ or ‘table’.
- long(text_width=80, left_column_width=17)¶
Return detailed information about a list of records, as text with a limited column width. Lines that are too long will be wrapped round.
- name = 'text'¶
- output_table()¶
Return a list of output files, one per line.
- parameter_table()¶
Return parameter information about a list of records as text, in a simple tabular format.
- required_attributes = ('short', 'long')¶
- short()¶
Return a list of record labels, one per line.
- table()¶
Return information about a list of records as text, in a simple tabular format.
- class sumatra.formatting.HTMLFormatter(records, project=None, tags=None)¶
Bases:
FormatterFormat information about a group of Sumatra records as HTML fragments, to be included in a larger document.
- format(mode='short')¶
Format a record according to the given mode.
modemay be ‘short’, ‘long’ or ‘table’.
- long()¶
Return detailed information about a list of records as an HTML description list.
- name = 'html'¶
- required_attributes = ('short', 'long')¶
- short()¶
Return a list of record labels as an HTML unordered list.
- table()¶
Return detailed information about a list of records as an HTML table.
- sumatra.formatting.get_formatter(format)¶
Return a
Formatterobject of the appropriate type.formatmay be ‘text, ‘html’ or ‘textdiff’
Formatting the difference between two records¶
- class sumatra.formatting.TextDiffFormatter(diff)¶
Bases:
FormatterFormat information about the differences between two Sumatra records in text format.
- format(mode='short')¶
Format a record according to the given mode.
modemay be ‘short’, ‘long’ or ‘table’.
- long()¶
Return a detailed description of the differences between two records.
- name = 'textdiff'¶
- required_attributes = ('short', 'long')¶
- short()¶
Return a summary of the differences between two records.
- sumatra.formatting.get_diff_formatter()¶
Return a
DiffFormatterobject of the appropriate type. Only text format is currently available.