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.Formatter

Format the information from a list of Sumatra records as text.

format(mode=u'short')

Format a record according to the given mode. mode may 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()
parameter_table()

Return parameter information about a list of records as text, in a simple tabular format.

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.Formatter

Format 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. mode may 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 Formatter object of the appropriate type. format may be ‘text, ‘html’ or ‘textdiff’

Formatting the difference between two records

class sumatra.formatting.TextDiffFormatter(diff)

Bases: sumatra.formatting.Formatter

Format information about the differences between two Sumatra records in text format.

format(mode=u'short')

Format a record according to the given mode. mode may 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 DiffFormatter object of the appropriate type. Only text format is currently available.