Skip to content

Commit 4910790

Browse files
Use specififc noqa directives
1 parent 74885be commit 4910790

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

tabulate/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ def _choose_width_fn(has_invisible, enable_widechars, is_multiline):
11451145
else:
11461146
line_width_fn = len
11471147
if is_multiline:
1148-
width_fn = lambda s: _multiline_width(s, line_width_fn) # noqa
1148+
width_fn = lambda s: _multiline_width(s, line_width_fn) # noqa: E731
11491149
else:
11501150
width_fn = line_width_fn
11511151
return width_fn
@@ -1185,7 +1185,7 @@ def _align_column_choose_width_fn(has_invisible, enable_widechars, is_multiline)
11851185
else:
11861186
line_width_fn = len
11871187
if is_multiline:
1188-
width_fn = lambda s: _align_column_multiline_width(s, line_width_fn) # noqa
1188+
width_fn = lambda s: _align_column_multiline_width(s, line_width_fn) # noqa: E731
11891189
else:
11901190
width_fn = line_width_fn
11911191
return width_fn
@@ -1316,7 +1316,7 @@ def _format(val, valtype, floatfmt, intfmt, missingval="", has_invisible=True):
13161316
tabulate(tbl, headers=hrow) == good_result
13171317
True
13181318
1319-
""" # noqa
1319+
""" # noqa: E501
13201320
if val is None:
13211321
return missingval
13221322
if isinstance(val, (bytes, str)) and not val:
@@ -2603,7 +2603,7 @@ def _format_table(
26032603

26042604
padded_widths = [(w + 2 * pad) for w in colwidths]
26052605
if is_multiline:
2606-
pad_row = lambda row, _: row # noqa do it later, in _append_multiline_row
2606+
pad_row = lambda row, _: row # noqa: E731 # do it later, in _append_multiline_row
26072607
append_row = partial(_append_multiline_row, pad=pad)
26082608
else:
26092609
pad_row = _pad_row

test/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import pytest # noqa
2-
from pytest import skip, raises # noqa
1+
import pytest # noqa: F401
2+
from pytest import skip, raises # noqa: F401
33
import warnings
44

55

test/test_internal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def test_wrap_text_to_colwidths():
176176
def test_wrap_text_wide_chars():
177177
"Internal: Wrap wide characters based on column width"
178178
try:
179-
import wcwidth # noqa
179+
import wcwidth # noqa: F401
180180
except ImportError:
181181
skip("test_wrap_text_wide_chars is skipped")
182182

@@ -240,7 +240,7 @@ def test_wrap_text_to_colwidths_single_ansi_colors_full_cell():
240240
def test_wrap_text_to_colwidths_colors_wide_char():
241241
"""Internal: autowrapped text can retain a ANSI colors with wide chars"""
242242
try:
243-
import wcwidth # noqa
243+
import wcwidth # noqa: F401
244244
except ImportError:
245245
skip("test_wrap_text_to_colwidths_colors_wide_char is skipped")
246246

test/test_output.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_plain_maxcolwidth_autowraps_with_sep():
131131
def test_plain_maxcolwidth_autowraps_wide_chars():
132132
"Output: maxcolwidth and autowrapping functions with wide characters"
133133
try:
134-
import wcwidth # noqa
134+
import wcwidth # noqa: F401
135135
except ImportError:
136136
skip("test_wrap_text_wide_chars is skipped")
137137

@@ -546,7 +546,7 @@ def test_grid():
546546
def test_grid_wide_characters():
547547
"Output: grid with wide characters in headers"
548548
try:
549-
import wcwidth # noqa
549+
import wcwidth # noqa: F401
550550
except ImportError:
551551
skip("test_grid_wide_characters is skipped")
552552
headers = list(_test_table_headers)
@@ -681,7 +681,7 @@ def test_simple_grid():
681681
def test_simple_grid_wide_characters():
682682
"Output: simple_grid with wide characters in headers"
683683
try:
684-
import wcwidth # noqa
684+
import wcwidth # noqa: F401
685685
except ImportError:
686686
skip("test_simple_grid_wide_characters is skipped")
687687
headers = list(_test_table_headers)
@@ -816,7 +816,7 @@ def test_rounded_grid():
816816
def test_rounded_grid_wide_characters():
817817
"Output: rounded_grid with wide characters in headers"
818818
try:
819-
import wcwidth # noqa
819+
import wcwidth # noqa: F401
820820
except ImportError:
821821
skip("test_rounded_grid_wide_characters is skipped")
822822
headers = list(_test_table_headers)
@@ -951,7 +951,7 @@ def test_heavy_grid():
951951
def test_heavy_grid_wide_characters():
952952
"Output: heavy_grid with wide characters in headers"
953953
try:
954-
import wcwidth # noqa
954+
import wcwidth # noqa: F401
955955
except ImportError:
956956
skip("test_heavy_grid_wide_characters is skipped")
957957
headers = list(_test_table_headers)
@@ -1086,7 +1086,7 @@ def test_mixed_grid():
10861086
def test_mixed_grid_wide_characters():
10871087
"Output: mixed_grid with wide characters in headers"
10881088
try:
1089-
import wcwidth # noqa
1089+
import wcwidth # noqa: F401
10901090
except ImportError:
10911091
skip("test_mixed_grid_wide_characters is skipped")
10921092
headers = list(_test_table_headers)
@@ -1221,7 +1221,7 @@ def test_double_grid():
12211221
def test_double_grid_wide_characters():
12221222
"Output: double_grid with wide characters in headers"
12231223
try:
1224-
import wcwidth # noqa
1224+
import wcwidth # noqa: F401
12251225
except ImportError:
12261226
skip("test_double_grid_wide_characters is skipped")
12271227
headers = list(_test_table_headers)
@@ -1356,7 +1356,7 @@ def test_fancy_grid():
13561356
def test_fancy_grid_wide_characters():
13571357
"Output: fancy_grid with wide characters in headers"
13581358
try:
1359-
import wcwidth # noqa
1359+
import wcwidth # noqa: F401
13601360
except ImportError:
13611361
skip("test_fancy_grid_wide_characters is skipped")
13621362
headers = list(_test_table_headers)
@@ -1525,7 +1525,7 @@ def test_colon_grid():
15251525
def test_colon_grid_wide_characters():
15261526
"Output: colon_grid with wide chars in header"
15271527
try:
1528-
import wcwidth # noqa
1528+
import wcwidth # noqa: F401
15291529
except ImportError:
15301530
skip("test_colon_grid_wide_characters is skipped")
15311531
headers = list(_test_table_headers)
@@ -1619,7 +1619,7 @@ def test_outline():
16191619
def test_outline_wide_characters():
16201620
"Output: outline with wide characters in headers"
16211621
try:
1622-
import wcwidth # noqa
1622+
import wcwidth # noqa: F401
16231623
except ImportError:
16241624
skip("test_outline_wide_characters is skipped")
16251625
headers = list(_test_table_headers)
@@ -1671,7 +1671,7 @@ def test_simple_outline():
16711671
def test_simple_outline_wide_characters():
16721672
"Output: simple_outline with wide characters in headers"
16731673
try:
1674-
import wcwidth # noqa
1674+
import wcwidth # noqa: F401
16751675
except ImportError:
16761676
skip("test_simple_outline_wide_characters is skipped")
16771677
headers = list(_test_table_headers)
@@ -1723,7 +1723,7 @@ def test_rounded_outline():
17231723
def test_rounded_outline_wide_characters():
17241724
"Output: rounded_outline with wide characters in headers"
17251725
try:
1726-
import wcwidth # noqa
1726+
import wcwidth # noqa: F401
17271727
except ImportError:
17281728
skip("test_rounded_outline_wide_characters is skipped")
17291729
headers = list(_test_table_headers)
@@ -1775,7 +1775,7 @@ def test_heavy_outline():
17751775
def test_heavy_outline_wide_characters():
17761776
"Output: heavy_outline with wide characters in headers"
17771777
try:
1778-
import wcwidth # noqa
1778+
import wcwidth # noqa: F401
17791779
except ImportError:
17801780
skip("test_heavy_outline_wide_characters is skipped")
17811781
headers = list(_test_table_headers)
@@ -1827,7 +1827,7 @@ def test_mixed_outline():
18271827
def test_mixed_outline_wide_characters():
18281828
"Output: mixed_outline with wide characters in headers"
18291829
try:
1830-
import wcwidth # noqa
1830+
import wcwidth # noqa: F401
18311831
except ImportError:
18321832
skip("test_mixed_outline_wide_characters is skipped")
18331833
headers = list(_test_table_headers)
@@ -1879,7 +1879,7 @@ def test_double_outline():
18791879
def test_double_outline_wide_characters():
18801880
"Output: double_outline with wide characters in headers"
18811881
try:
1882-
import wcwidth # noqa
1882+
import wcwidth # noqa: F401
18831883
except ImportError:
18841884
skip("test_double_outline_wide_characters is skipped")
18851885
headers = list(_test_table_headers)
@@ -1931,7 +1931,7 @@ def test_fancy_outline():
19311931
def test_fancy_outline_wide_characters():
19321932
"Output: fancy_outline with wide characters in headers"
19331933
try:
1934-
import wcwidth # noqa
1934+
import wcwidth # noqa: F401
19351935
except ImportError:
19361936
skip("test_fancy_outline_wide_characters is skipped")
19371937
headers = list(_test_table_headers)

test/test_regression.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ class textclass(str):
300300
def test_mix_normal_and_wide_characters():
301301
"Regression: wide characters in a grid format (issue #51)"
302302
try:
303-
import wcwidth # noqa
303+
import wcwidth # noqa: F401
304304

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

327327
table = [["가나\n가ab", "가나", "가나"]]
328328
result = tabulate(table, tablefmt="fancy_grid")

test/test_textwrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_wrap_longword_non_wide():
4747
def test_wrap_wide_char_multiword():
4848
"""TextWrapper: wrapping support for wide characters with multiple words"""
4949
try:
50-
import wcwidth # noqa
50+
import wcwidth # noqa: F401
5151
except ImportError:
5252
skip("test_wrap_wide_char is skipped")
5353

@@ -63,7 +63,7 @@ def test_wrap_wide_char_multiword():
6363
def test_wrap_wide_char_longword():
6464
"""TextWrapper: wrapping wide char word that needs to be broken up"""
6565
try:
66-
import wcwidth # noqa
66+
import wcwidth # noqa: F401
6767
except ImportError:
6868
skip("test_wrap_wide_char_longword is skipped")
6969

0 commit comments

Comments
 (0)