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-2015 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:
sumatra.formatting.FormatterFormat the information from a list of Sumatra records as text.
-
format(mode=u'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= u'text'¶
-
next()¶
-
required_attributes= (u'short', u'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:
sumatra.formatting.FormatterFormat information about a group of Sumatra records as HTML fragments, to be included in a larger document.
-
format(mode=u'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= u'html'¶
-
next()¶
-
required_attributes= (u'short', u'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:
sumatra.formatting.FormatterFormat information about the differences between two Sumatra records in text format.
-
format(mode=u'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= u'textdiff'¶
-
next()¶
-
required_attributes= (u'short', u'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.