Skip to content

Commit e86e3c7

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

File tree

5 files changed

+46
-27
lines changed

5 files changed

+46
-27
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: 15 additions & 14 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
[
@@ -215,10 +217,8 @@ def test_wrap_text_to_colwidths_single_ansi_colors_full_cell():
215217
when it is at the beginning and end of full cell"""
216218
data = [
217219
[
218-
(
219-
"\033[31mThis is a rather long description that might"
220-
" look better if it is wrapped a bit\033[0m"
221-
)
220+
"\033[31mThis is a rather long description that might"
221+
" look better if it is wrapped a bit\033[0m"
222222
]
223223
]
224224
result = T._wrap_text_to_colwidths(data, [30])
@@ -244,7 +244,12 @@ def test_wrap_text_to_colwidths_colors_wide_char():
244244
except ImportError:
245245
skip("test_wrap_text_to_colwidths_colors_wide_char is skipped")
246246

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

250255
expected = [
@@ -267,10 +272,8 @@ def test_wrap_text_to_colwidths_multi_ansi_colors_full_cell():
267272
(e.g. text and background colors)"""
268273
data = [
269274
[
270-
(
271-
"\033[31m\033[43mThis is a rather long description that"
272-
" might look better if it is wrapped a bit\033[0m"
273-
)
275+
"\033[31m\033[43mThis is a rather long description that"
276+
" might look better if it is wrapped a bit\033[0m"
274277
]
275278
]
276279
result = T._wrap_text_to_colwidths(data, [30])
@@ -294,10 +297,8 @@ def test_wrap_text_to_colwidths_multi_ansi_colors_in_subset():
294297
when they are around subsets of the cell"""
295298
data = [
296299
[
297-
(
298-
"This is a rather \033[31mlong description\033[0m that"
299-
" might look better \033[93mif it is wrapped\033[0m a bit"
300-
)
300+
"This is a rather \033[31mlong description\033[0m that"
301+
" might look better \033[93mif it is wrapped\033[0m a bit"
301302
]
302303
]
303304
result = T._wrap_text_to_colwidths(data, [30])

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)