Skip to content

Commit 8ac0025

Browse files
Run black to fix CI
1 parent 51f15fa commit 8ac0025

File tree

5 files changed

+40
-15
lines changed

5 files changed

+40
-15
lines changed

tabulate/__init__.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,9 +1588,11 @@ def _normalize_tabular_data(tabular_data, headers, showindex="default"):
15881588
if headers == "keys":
15891589
headers = field_names
15901590
rows = [
1591-
[getattr(row, f) for f in field_names]
1592-
if not _is_separating_line(row)
1593-
else row
1591+
(
1592+
[getattr(row, f) for f in field_names]
1593+
if not _is_separating_line(row)
1594+
else row
1595+
)
15941596
for row in rows
15951597
]
15961598

@@ -1638,7 +1640,13 @@ def _normalize_tabular_data(tabular_data, headers, showindex="default"):
16381640
return rows, headers, headers_pad
16391641

16401642

1641-
def _wrap_text_to_colwidths(list_of_lists, colwidths, numparses=True, break_long_words=_BREAK_LONG_WORDS, break_on_hyphens=_BREAK_ON_HYPHENS):
1643+
def _wrap_text_to_colwidths(
1644+
list_of_lists,
1645+
colwidths,
1646+
numparses=True,
1647+
break_long_words=_BREAK_LONG_WORDS,
1648+
break_on_hyphens=_BREAK_ON_HYPHENS,
1649+
):
16421650
if len(list_of_lists):
16431651
num_cols = len(list_of_lists[0])
16441652
else:
@@ -1655,7 +1663,11 @@ def _wrap_text_to_colwidths(list_of_lists, colwidths, numparses=True, break_long
16551663
continue
16561664

16571665
if width is not None:
1658-
wrapper = _CustomTextWrap(width=width, break_long_words=break_long_words, break_on_hyphens=break_on_hyphens)
1666+
wrapper = _CustomTextWrap(
1667+
width=width,
1668+
break_long_words=break_long_words,
1669+
break_on_hyphens=break_on_hyphens,
1670+
)
16591671
casted_cell = str(cell)
16601672
wrapped = [
16611673
"\n".join(wrapper.wrap(line))
@@ -2258,7 +2270,11 @@ def tabulate(
22582270

22592271
numparses = _expand_numparse(disable_numparse, num_cols)
22602272
list_of_lists = _wrap_text_to_colwidths(
2261-
list_of_lists, maxcolwidths, numparses=numparses, break_long_words=break_long_words, break_on_hyphens=break_on_hyphens
2273+
list_of_lists,
2274+
maxcolwidths,
2275+
numparses=numparses,
2276+
break_long_words=break_long_words,
2277+
break_on_hyphens=break_on_hyphens,
22622278
)
22632279

22642280
if maxheadercolwidths is not None:
@@ -2272,7 +2288,11 @@ def tabulate(
22722288

22732289
numparses = _expand_numparse(disable_numparse, num_cols)
22742290
headers = _wrap_text_to_colwidths(
2275-
[headers], maxheadercolwidths, numparses=numparses, break_long_words=break_long_words, break_on_hyphens=break_on_hyphens
2291+
[headers],
2292+
maxheadercolwidths,
2293+
numparses=numparses,
2294+
break_long_words=break_long_words,
2295+
break_on_hyphens=break_on_hyphens,
22762296
)[0]
22772297

22782298
# empty values in the first column of RST tables should be escaped (issue #82)

test/test_api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""API properties.
2-
3-
"""
1+
"""API properties."""
42

53
from tabulate import tabulate, tabulate_formats, simple_separated_format
64
from common import skip

test/test_cli.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""Command-line interface.
2-
3-
"""
1+
"""Command-line interface."""
42

53
import os
64
import sys

test/test_internal.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ def test_wrap_text_wide_chars():
180180
except ImportError:
181181
skip("test_wrap_text_wide_chars is skipped")
182182

183-
rows = [["청자청자청자청자청자", "약간 감싸면 더 잘 보일 수있는 다소 긴 설명입니다"]]
183+
rows = [
184+
["청자청자청자청자청자", "약간 감싸면 더 잘 보일 수있는 다소 긴 설명입니다"]
185+
]
184186
widths = [5, 20]
185187
expected = [
186188
[
@@ -244,7 +246,12 @@ def test_wrap_text_to_colwidths_colors_wide_char():
244246
except ImportError:
245247
skip("test_wrap_text_to_colwidths_colors_wide_char is skipped")
246248

247-
data = [[("\033[31m약간 감싸면 더 잘 보일 수있는 다소 긴" " 설명입니다 설명입니다 설명입니다 설명입니다 설명\033[0m")]]
249+
data = [
250+
[
251+
"\033[31m약간 감싸면 더 잘 보일 수있는 다소 긴"
252+
" 설명입니다 설명입니다 설명입니다 설명입니다 설명\033[0m"
253+
]
254+
]
248255
result = T._wrap_text_to_colwidths(data, [30])
249256

250257
expected = [

test/test_output.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,6 +3320,7 @@ def test_preserve_whitespace():
33203320
result = tabulate(test_table, table_headers, preserve_whitespace=False)
33213321
assert_equal(expected, result)
33223322

3323+
33233324
def test_break_long_words():
33243325
"Output: Default table output, with breakwords true."
33253326
table_headers = ["h1", "h2", "h3"]
@@ -3335,6 +3336,7 @@ def test_break_long_words():
33353336
result = tabulate(test_table, table_headers, maxcolwidths=3, break_long_words=True)
33363337
assert_equal(expected, result)
33373338

3339+
33383340
def test_break_on_hyphens():
33393341
"Output: Default table output, with break on hyphens true."
33403342
table_headers = ["h1", "h2", "h3"]

0 commit comments

Comments
 (0)