Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tabulate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ def _choose_width_fn(has_invisible, enable_widechars, is_multiline):
else:
line_width_fn = len
if is_multiline:
width_fn = lambda s: _multiline_width(s, line_width_fn) # noqa
width_fn = lambda s: _multiline_width(s, line_width_fn) # noqa: E731
else:
width_fn = line_width_fn
return width_fn
Expand Down Expand Up @@ -1185,7 +1185,7 @@ def _align_column_choose_width_fn(has_invisible, enable_widechars, is_multiline)
else:
line_width_fn = len
if is_multiline:
width_fn = lambda s: _align_column_multiline_width(s, line_width_fn) # noqa
width_fn = lambda s: _align_column_multiline_width(s, line_width_fn) # noqa: E731
else:
width_fn = line_width_fn
return width_fn
Expand Down Expand Up @@ -1316,7 +1316,7 @@ def _format(val, valtype, floatfmt, intfmt, missingval="", has_invisible=True):
tabulate(tbl, headers=hrow) == good_result
True

""" # noqa
""" # noqa: E501
if val is None:
return missingval
if isinstance(val, (bytes, str)) and not val:
Expand Down Expand Up @@ -2603,7 +2603,7 @@ def _format_table(

padded_widths = [(w + 2 * pad) for w in colwidths]
if is_multiline:
pad_row = lambda row, _: row # noqa do it later, in _append_multiline_row
pad_row = lambda row, _: row # noqa: E731 # do it later, in _append_multiline_row
append_row = partial(_append_multiline_row, pad=pad)
else:
pad_row = _pad_row
Expand Down
4 changes: 2 additions & 2 deletions test/common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest # noqa
from pytest import skip, raises # noqa
import pytest # noqa: F401
from pytest import skip, raises # noqa: F401
import warnings


Expand Down
4 changes: 2 additions & 2 deletions test/test_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_wrap_text_to_colwidths():
def test_wrap_text_wide_chars():
"Internal: Wrap wide characters based on column width"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_wrap_text_wide_chars is skipped")

Expand Down Expand Up @@ -240,7 +240,7 @@ def test_wrap_text_to_colwidths_single_ansi_colors_full_cell():
def test_wrap_text_to_colwidths_colors_wide_char():
"""Internal: autowrapped text can retain a ANSI colors with wide chars"""
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_wrap_text_to_colwidths_colors_wide_char is skipped")

Expand Down
32 changes: 16 additions & 16 deletions test/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_plain_maxcolwidth_autowraps_with_sep():
def test_plain_maxcolwidth_autowraps_wide_chars():
"Output: maxcolwidth and autowrapping functions with wide characters"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_wrap_text_wide_chars is skipped")

Expand Down Expand Up @@ -546,7 +546,7 @@ def test_grid():
def test_grid_wide_characters():
"Output: grid with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_grid_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -681,7 +681,7 @@ def test_simple_grid():
def test_simple_grid_wide_characters():
"Output: simple_grid with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_simple_grid_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -816,7 +816,7 @@ def test_rounded_grid():
def test_rounded_grid_wide_characters():
"Output: rounded_grid with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_rounded_grid_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -951,7 +951,7 @@ def test_heavy_grid():
def test_heavy_grid_wide_characters():
"Output: heavy_grid with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_heavy_grid_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1086,7 +1086,7 @@ def test_mixed_grid():
def test_mixed_grid_wide_characters():
"Output: mixed_grid with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_mixed_grid_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1221,7 +1221,7 @@ def test_double_grid():
def test_double_grid_wide_characters():
"Output: double_grid with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_double_grid_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1356,7 +1356,7 @@ def test_fancy_grid():
def test_fancy_grid_wide_characters():
"Output: fancy_grid with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_fancy_grid_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1525,7 +1525,7 @@ def test_colon_grid():
def test_colon_grid_wide_characters():
"Output: colon_grid with wide chars in header"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_colon_grid_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1619,7 +1619,7 @@ def test_outline():
def test_outline_wide_characters():
"Output: outline with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_outline_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1671,7 +1671,7 @@ def test_simple_outline():
def test_simple_outline_wide_characters():
"Output: simple_outline with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_simple_outline_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1723,7 +1723,7 @@ def test_rounded_outline():
def test_rounded_outline_wide_characters():
"Output: rounded_outline with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_rounded_outline_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1775,7 +1775,7 @@ def test_heavy_outline():
def test_heavy_outline_wide_characters():
"Output: heavy_outline with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_heavy_outline_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1827,7 +1827,7 @@ def test_mixed_outline():
def test_mixed_outline_wide_characters():
"Output: mixed_outline with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_mixed_outline_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1879,7 +1879,7 @@ def test_double_outline():
def test_double_outline_wide_characters():
"Output: double_outline with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_double_outline_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down Expand Up @@ -1931,7 +1931,7 @@ def test_fancy_outline():
def test_fancy_outline_wide_characters():
"Output: fancy_outline with wide characters in headers"
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_fancy_outline_wide_characters is skipped")
headers = list(_test_table_headers)
Expand Down
4 changes: 2 additions & 2 deletions test/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class textclass(str):
def test_mix_normal_and_wide_characters():
"Regression: wide characters in a grid format (issue #51)"
try:
import wcwidth # noqa
import wcwidth # noqa: F401

ru_text = "\u043f\u0440\u0438\u0432\u0435\u0442"
cn_text = "\u4f60\u597d"
Expand All @@ -322,7 +322,7 @@ def test_mix_normal_and_wide_characters():
def test_multiline_with_wide_characters():
"Regression: multiline tables with varying number of wide characters (github issue #28)"
try:
import wcwidth # noqa
import wcwidth # noqa: F401

table = [["가나\n가ab", "가나", "가나"]]
result = tabulate(table, tablefmt="fancy_grid")
Expand Down
4 changes: 2 additions & 2 deletions test/test_textwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_wrap_longword_non_wide():
def test_wrap_wide_char_multiword():
"""TextWrapper: wrapping support for wide characters with multiple words"""
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_wrap_wide_char is skipped")

Expand All @@ -63,7 +63,7 @@ def test_wrap_wide_char_multiword():
def test_wrap_wide_char_longword():
"""TextWrapper: wrapping wide char word that needs to be broken up"""
try:
import wcwidth # noqa
import wcwidth # noqa: F401
except ImportError:
skip("test_wrap_wide_char_longword is skipped")

Expand Down
Loading