smartinspectpython.sitableviewercontext

Module: sitableviewercontext.py

Revision History

Date Version Description
2023/05/30 3.0.0.0 Initial Version.

@export
class SITableViewerContext(smartinspectpython.silistviewercontext.SIListViewerContext):

Represents the table viewer in the Console which can display text data as a table.

The table viewer in the Console interprets the Log Entry Data as a table. This class takes care of the necessary formatting and escaping required by the corresponding table viewer in the Console.

You can use the SITableViewerContext class for creating custom log methods around SISession.LogCustomContext for sending custom data organized as tables.

Threadsafety:

This class is not guaranteed to be thread-safe.

SITableViewerContext()

Initializes a new instance of the class.

def AddRowEntry(self, entry) -> None:

Adds an entry to the current row.

Arguments:
  • entry (object): The entry to add; must be able to be converted to a string via the "str(x)" syntax.
def AppendHeader(self, header: str) -> None:

Appends a header to the text data.

Arguments:
  • (str): The header to append.
def BeginRow(self) -> None:

Begins a new row.

def EndRow(self) -> None:

Ends the current row.

@staticmethod
def EscapeCSVEntry(entry: str) -> str:

Escapes a CSV (comma separated values) formatted entry.

Arguments:
  • entry (str): The CSV entry to escape.
Returns:

The escaped line.

This method ensures that the escaped CSV entry does not contain whitespace characters, and that quoted values are escaped properly.