cli_helpers/tabular_output/tabulate_adapter.py
def adapter(data, headers, table_format=None, preserve_whitespace=False,
            **kwargs):
    """Wrap tabulate inside a function for TabularOutputFormatter."""
    keys = ('floatfmt', 'numalign', 'stralign', 'showindex', 'disable_numparse')
    tkwargs = {'tablefmt': table_format}
    tkwargs.update(filter_dict_by_key(kwargs, keys))

    if table_format in supported_markup_formats:
        tkwargs.update(numalign=None, stralign=None)

    tabulate.PRESERVE_WHITESPACE = preserve_whitespace

    return iter(tabulate.tabulate(data, headers, **tkwargs).split('\n'))
def adapter(data, headers, table_format=None, preserve_whitespace=False,
            **kwargs):
    keys = ('floatfmt', 'numalign', 'stralign', 'showindex', 'disable_numparse')
    tkwargs = {'tablefmt': table_format}
    tkwargs.update(filter_dict_by_key(kwargs, keys))

    if table_format in supported_markup_formats:
        tkwargs.update(numalign=None, stralign=None)

    tabulate.PRESERVE_WHITESPACE = preserve_whitespace

    return iter(tabulate.tabulate(data, headers, **tkwargs).split('\n'))
def adapter ( data , headers , table_format = None , preserve_whitespace = False , * * kwargs ) : keys = ( 'floatfmt' , 'numalign' , 'stralign' , 'showindex' , 'disable_numparse' ) tkwargs = { 'tablefmt' : table_format } tkwargs . update ( filter_dict_by_key ( kwargs , keys ) ) if table_format in supported_markup_formats : tkwargs . update ( numalign = None , stralign = None ) tabulate . PRESERVE_WHITESPACE = preserve_whitespace return iter ( tabulate . tabulate ( data , headers , * * tkwargs ) . split ( '\n' ) )
Wrap tabulate inside a function for TabularOutputFormatter.
Wrap tabulate inside a function for TabularOutputFormatter .