Cement tabulate extension module.

class cement.ext.ext_tabulate.TabulateOutputHandler(**kw)[source]

Bases: cement.core.output.OutputHandler

This class implements the Output Handler interface. It provides tabularized text output using the Tabulate module. Please see the developer documentation on Output Handling.

Note This extension has an external dependency on tabulate. You must include tabulate in your applications dependencies as Cement explicitly does not include external dependencies for optional extensions.

class Meta[source]

Bases: object

Handler meta-data.

float_format = 'g'

String format to use for float values.

format = 'orgtbl'

Default template format. See the tabulate documentation for all supported template formats.

headers = []

Default headers to use.

missing_value = ''

Default replacement for missing value.

numeric_alignment = 'decimal'

Default alignment for numeric columns. See the tabulate documentation for all supported numalign options.

overridable = False

Whether or not to include tabulate as an available to choice to override the output_handler via command line options.

padding = True

Whether or not to pad the output with an extra pre/post ‘n’

string_alignment = 'left'

Default alignment for string columns. See the tabulate documentation for all supported stralign options.

render(data, **kw)[source]

Take a data dictionary and render it into a table. Additional keyword arguments are passed directly to tabulate.tabulate.

Parameters:data_dict (dict) – The data dictionary to render.
Returns:The rendered template text
Return type:str