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.
Formatting Sumatra records¶
-
class
sumatra.formatting.TextFormatter(records)¶ Bases:
sumatra.formatting.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.
-
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)¶ Bases:
sumatra.formatting.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.
-
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:
sumatra.formatting.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.
-
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.