Adding upstream version 2.1.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d1aeef90c9
commit
d8a70e48ab
56 changed files with 3865 additions and 0 deletions
16
cli_helpers/tabular_output/tsv_output_adapter.py
Normal file
16
cli_helpers/tabular_output/tsv_output_adapter.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""A tsv data output adapter"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .preprocessors import bytes_to_string, override_missing_value, convert_to_string
|
||||
from itertools import chain
|
||||
from cli_helpers.utils import replace
|
||||
|
||||
supported_formats = ('tsv',)
|
||||
preprocessors = (override_missing_value, bytes_to_string, convert_to_string)
|
||||
|
||||
def adapter(data, headers, **kwargs):
|
||||
"""Wrap the formatting inside a function for TabularOutputFormatter."""
|
||||
for row in chain((headers,), data):
|
||||
yield "\t".join((replace(r, (('\n', r'\n'), ('\t', r'\t'))) for r in row))
|
Loading…
Add table
Add a link
Reference in a new issue