colawater.lib.summary#

Functions for managing tool summaries.

Examples

import colawater.status.summary as sy

sy.add_header("a subject", "helpful message")
sy.add_item("helpful message") # etc. for other methods
sy.post()

Module Contents#

Functions#

add_header(→ None)

Adds a header to the summary's content.

add_item(→ None)

Adds an item to the summary's content.

add_items(→ None)

Adds items from an sequence of sequences to the summary's content.

add_note(→ None)

Adds a note header to the summary's content.

add_result(→ None)

Adds a result header to the summary's content.

clear(→ None)

Clears the summary.

post(→ None)

Adds a message with the summary's full text.

Attributes#

OUTPUT_DUMPED_MSG

Error message text to display when the summary output is dumped due to an error.

colawater.lib.summary.OUTPUT_DUMPED_MSG = 'OUTPUT DUMPED DUE TO ERROR'#

Error message text to display when the summary output is dumped due to an error.

colawater.lib.summary.add_header(subject: str, content: str) None#

Adds a header to the summary’s content.

Parameters:
  • subject (str) – A string containing the subject.

  • content (str) – A string containing the content.

colawater.lib.summary.add_item(content: str) None#

Adds an item to the summary’s content.

Parameters:

content (str) – A string containing the content.

colawater.lib.summary.add_items(contents: collections.abc.Sequence[collections.abc.Sequence[Any | None]], csv: bool = False) None#

Adds items from an sequence of sequences to the summary’s content.

Optionally apply attribute.process() to each item.

Parameters:
  • content (Sequence[Sequence[Any]]) – Rows to add as items (can be jagged).

  • csv (bool) – Whether to apply CSV pre-processing.

colawater.lib.summary.add_note(subject: str, content: str) None#

Adds a note header to the summary’s content.

Parameters:
  • subject (str) – A string containing the subject.

  • content (str) – A string containing the content.

colawater.lib.summary.add_result(subject: str, content: str) None#

Adds a result header to the summary’s content.

Parameters:
  • subject (str) – A string containing the subject.

  • content (str) – A string containing the content.

colawater.lib.summary.clear() None#

Clears the summary.

colawater.lib.summary.post(dumped: bool = False) None#

Adds a message with the summary’s full text.

Assembles all of the headers and miscellaneous messages in the order added. Clears summary content after posting message. Optionally add an additional message indicating the summary was dumped due to an error.

Parameters:

dumped (bool) – Whether to add a message indicating the summary was dumped due to an error.