Skip to content

Commit a5f11e6

Browse files
committed
rename all adapter functions to adapter
1 parent cdbc7cd commit a5f11e6

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

mycli/output_formatter/delimited_output_adapter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from .preprocessors import override_missing_value, bytes_to_string
99

1010
supported_formats = ('csv', 'tsv')
11-
delimiter_preprocessors = (override_missing_value, bytes_to_string)
11+
preprocessors = (override_missing_value, bytes_to_string)
1212

1313

14-
def delimiter_adapter(data, headers, table_format='csv', **_):
14+
def adapter(data, headers, table_format='csv', **_):
1515
"""Wrap CSV formatting inside a standard function for OutputFormatter."""
1616
with contextlib.closing(StringIO()) as content:
1717
if table_format == 'csv':

mycli/output_formatter/output_formatter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,18 @@ def format_output(self, data, headers, format_name=None, **kwargs):
7878

7979
for delimiter_format in delimited_output_adapter.supported_formats:
8080
OutputFormatter.register_new_formatter(
81-
delimiter_format, delimited_output_adapter.delimiter_adapter,
82-
delimited_output_adapter.delimiter_preprocessors,
81+
delimiter_format, delimited_output_adapter.adapter,
82+
delimited_output_adapter.preprocessors,
8383
{'table_format': delimiter_format, 'missing_value': MISSING_VALUE})
8484

8585
for tabulate_format in tabulate_adapter.supported_formats:
8686
OutputFormatter.register_new_formatter(
87-
tabulate_format, tabulate_adapter.tabulate_adapter,
87+
tabulate_format, tabulate_adapter.adapter,
8888
tabulate_adapter.preprocessors,
8989
{'table_format': tabulate_format, 'missing_value': MISSING_VALUE})
9090

9191
for terminaltables_format in terminaltables_adapter.supported_formats:
9292
OutputFormatter.register_new_formatter(
93-
terminaltables_format, terminaltables_adapter.terminaltables_adapter,
93+
terminaltables_format, terminaltables_adapter.adapter,
9494
terminaltables_adapter.preprocessors,
9595
{'table_format': terminaltables_format, 'missing_value': MISSING_VALUE})

mycli/output_formatter/tabulate_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
preprocessors = (bytes_to_string, align_decimals)
1313

1414

15-
def tabulate_adapter(data, headers, table_format=None, missing_value='', **_):
15+
def adapter(data, headers, table_format=None, missing_value='', **_):
1616
"""Wrap tabulate inside a standard function for OutputFormatter."""
1717
kwargs = {'tablefmt': table_format, 'missingval': missing_value,
1818
'disable_numparse': True}

mycli/output_formatter/terminaltables_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
preprocessors = (bytes_to_string, override_missing_value, align_decimals)
88

99

10-
def terminaltables_adapter(data, headers, table_format=None, **_):
10+
def adapter(data, headers, table_format=None, **_):
1111
"""Wrap terminaltables inside a standard function for OutputFormatter."""
1212

1313
table_format_handler = {

tests/test_output_formatter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
to_string)
1414
from mycli.output_formatter.output_formatter import OutputFormatter
1515
from mycli.output_formatter.delimited_output_adapter import (
16-
delimiter_adapter as csv_wrapper)
16+
adapter as csv_wrapper)
1717
from mycli.output_formatter.tabulate_adapter import (
18-
tabulate_adapter as tabulate_wrapper)
18+
adapter as tabulate_wrapper)
1919
from mycli.output_formatter.terminaltables_adapter import (
20-
terminaltables_adapter as terminal_tables_wrapper)
20+
adapter as terminal_tables_wrapper)
2121

2222

2323
def test_to_string():

0 commit comments

Comments
 (0)