cli_helpers/tabular_output/delimited_output_adapter.py
def adapter(data, headers, table_format='csv', **kwargs):
    """Wrap the formatting inside a function for TabularOutputFormatter."""
    keys = ('dialect', 'delimiter', 'doublequote', 'escapechar',
            'quotechar', 'quoting', 'skipinitialspace', 'strict')
    if table_format == 'csv':
        delimiter = ','
    elif table_format == 'csv-tab':
        delimiter = '\t'
    else:
        raise ValueError('Invalid table_format specified.')

    ckwargs = {'delimiter': delimiter, 'lineterminator': ''}
    ckwargs.update(filter_dict_by_key(kwargs, keys))

    l = linewriter()
    writer = csv.writer(l, **ckwargs)
    writer.writerow(headers)
    yield l.line

    for row in data:
        l.reset()
        writer.writerow(row)
        yield l.line
def adapter(data, headers, table_format='csv', **kwargs):
    """Wrap the formatting inside a function for TabularOutputFormatter."""
    keys = ('dialect', 'delimiter', 'doublequote', 'escapechar',
            'quotechar', 'quoting', 'skipinitialspace', 'strict')
    if table_format == 'csv':
        delimiter = ','
    elif table_format == 'csv-tab':
        delimiter = '\t'
    else:
        raise ValueError('Invalid table_format specified.')

    ckwargs = {'delimiter': delimiter, 'lineterminator': ''}
    ckwargs.update(filter_dict_by_key(kwargs, keys))

    l = linewriter()
    writer = csv.writer(l, **ckwargs)
    writer.writerow(headers)
    yield l.line

    for row in data:
        l.reset()
        writer.writerow(row)
        yield l.line
def adapter ( data , headers , table_format = 'csv' , * * kwargs ) : keys = ( 'dialect' , 'delimiter' , 'doublequote' , 'escapechar' , 'quotechar' , 'quoting' , 'skipinitialspace' , 'strict' ) if table_format == 'csv' : delimiter = ',' elif table_format == 'csv-tab' : delimiter = '\t' else : raise ValueError ( 'Invalid table_format specified.' ) ckwargs = { 'delimiter' : delimiter , 'lineterminator' : '' } ckwargs . update ( filter_dict_by_key ( kwargs , keys ) ) l = linewriter ( ) writer = csv . writer ( l , * * ckwargs ) writer . writerow ( headers ) yield l . line for row in data : l . reset ( ) writer . writerow ( row ) yield l . line
Wrap the formatting inside a function for TabularOutputFormatter.
Wrap the formatting inside a function for TabularOutputFormatter .