From 6b01c3853f03f201b77a6472903e75cd0ae3c40d Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
<3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 28 Sep 2024 00:44:47 +0200
Subject: [PATCH] Apply ruff rule RUF100
RUF100 Unused blanket `noqa` directive
---
tabulate/__init__.py | 10 +++++-----
test/common.py | 4 ++--
test/test_api.py | 6 +++---
test/test_internal.py | 4 ++--
test/test_output.py | 36 ++++++++++++++++++------------------
test/test_regression.py | 4 ++--
test/test_textwrapper.py | 6 +++---
7 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/tabulate/__init__.py b/tabulate/__init__.py
index 0296966..513cdd0 100644
--- a/tabulate/__init__.py
+++ b/tabulate/__init__.py
@@ -25,7 +25,7 @@ def _is_file(f):
__all__ = ["simple_separated_format", "tabulate", "tabulate_formats"]
try:
- from .version import version as __version__ # noqa: F401
+ from .version import version as __version__
except ImportError:
pass # running __init__.py as a script, AppVeyor pytests
@@ -1090,7 +1090,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)
else:
width_fn = line_width_fn
return width_fn
@@ -1130,7 +1130,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)
else:
width_fn = line_width_fn
return width_fn
@@ -1261,7 +1261,7 @@ def _format(val, valtype, floatfmt, intfmt, missingval="", has_invisible=True):
tabulate(tbl, headers=hrow) == good_result
True
- """ # noqa
+ """
if val is None:
return missingval
@@ -2542,7 +2542,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
append_row = partial(_append_multiline_row, pad=pad)
else:
pad_row = _pad_row
diff --git a/test/common.py b/test/common.py
index ec2fb35..58cfc52 100644
--- a/test/common.py
+++ b/test/common.py
@@ -1,5 +1,5 @@
-import pytest # noqa
-from pytest import skip, raises # noqa
+import pytest
+from pytest import skip, raises
import warnings
diff --git a/test/test_api.py b/test/test_api.py
index cf71231..e8c9ab2 100644
--- a/test/test_api.py
+++ b/test/test_api.py
@@ -19,7 +19,7 @@ def test_tabulate_formats():
print("tabulate_formats = %r" % supported)
assert type(supported) is list
for fmt in supported:
- assert type(fmt) is str # noqa
+ assert type(fmt) is str
def _check_signature(function, expected_sig):
@@ -36,7 +36,7 @@ def _check_signature(function, expected_sig):
def test_tabulate_signature():
"API: tabulate() type signature is unchanged" ""
- assert type(tabulate) is type(lambda: None) # noqa
+ assert type(tabulate) is type(lambda: None)
expected_sig = [
("tabular_data", _empty),
("headers", ()),
@@ -62,6 +62,6 @@ def test_tabulate_signature():
def test_simple_separated_format_signature():
"API: simple_separated_format() type signature is unchanged" ""
- assert type(simple_separated_format) is type(lambda: None) # noqa
+ assert type(simple_separated_format) is type(lambda: None)
expected_sig = [("separator", _empty)]
_check_signature(simple_separated_format, expected_sig)
diff --git a/test/test_internal.py b/test/test_internal.py
index 17107c6..21af3a7 100644
--- a/test/test_internal.py
+++ b/test/test_internal.py
@@ -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
except ImportError:
skip("test_wrap_text_wide_chars is skipped")
@@ -242,7 +242,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
except ImportError:
skip("test_wrap_text_to_colwidths_colors_wide_char is skipped")
diff --git a/test/test_output.py b/test/test_output.py
index 68b5e55..c3c9dc1 100644
--- a/test/test_output.py
+++ b/test/test_output.py
@@ -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
except ImportError:
skip("test_wrap_text_wide_chars is skipped")
@@ -492,7 +492,7 @@ def test_grid():
def test_grid_wide_characters():
"Output: grid with wide characters in headers"
try:
- import wcwidth # noqa
+ import wcwidth
except ImportError:
skip("test_grid_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -627,7 +627,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
except ImportError:
skip("test_simple_grid_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -762,7 +762,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
except ImportError:
skip("test_rounded_grid_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -897,7 +897,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
except ImportError:
skip("test_heavy_grid_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1032,7 +1032,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
except ImportError:
skip("test_mixed_grid_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1167,7 +1167,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
except ImportError:
skip("test_double_grid_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1302,7 +1302,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
except ImportError:
skip("test_fancy_grid_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1471,7 +1471,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
except ImportError:
skip("test_colon_grid_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1565,7 +1565,7 @@ def test_outline():
def test_outline_wide_characters():
"Output: outline with wide characters in headers"
try:
- import wcwidth # noqa
+ import wcwidth
except ImportError:
skip("test_outline_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1617,7 +1617,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
except ImportError:
skip("test_simple_outline_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1669,7 +1669,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
except ImportError:
skip("test_rounded_outline_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1721,7 +1721,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
except ImportError:
skip("test_heavy_outline_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1773,7 +1773,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
except ImportError:
skip("test_mixed_outline_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1825,7 +1825,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
except ImportError:
skip("test_double_outline_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -1877,7 +1877,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
except ImportError:
skip("test_fancy_outline_wide_characters is skipped")
headers = list(_test_table_headers)
@@ -2536,7 +2536,7 @@ def test_html():
[
"
",
"",
- '<strings> | <&numbers&> |
', # noqa
+ '<strings> | <&numbers&> |
',
"",
"",
'spam > | 41.9999 |
',
@@ -2557,7 +2557,7 @@ def test_unsafehtml():
[
"",
"",
- "strings | numbers |
", # noqa
+ "strings | numbers |
",
"",
"",
'spam | 41.9999 |
',
diff --git a/test/test_regression.py b/test/test_regression.py
index bf26247..46654c8 100644
--- a/test/test_regression.py
+++ b/test/test_regression.py
@@ -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
ru_text = "\u043f\u0440\u0438\u0432\u0435\u0442"
cn_text = "\u4f60\u597d"
@@ -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
table = [["가나\n가ab", "가나", "가나"]]
result = tabulate(table, tablefmt="fancy_grid")
diff --git a/test/test_textwrapper.py b/test/test_textwrapper.py
index 8c0a6cc..ebc7d41 100644
--- a/test/test_textwrapper.py
+++ b/test/test_textwrapper.py
@@ -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
except ImportError:
skip("test_wrap_wide_char is skipped")
@@ -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
except ImportError:
skip("test_wrap_wide_char_longword is skipped")
@@ -80,7 +80,7 @@ def test_wrap_wide_char_longword():
def test_wrap_mixed_string():
"""TextWrapper: wrapping string with mix of wide and non-wide chars"""
try:
- import wcwidth # noqa
+ import wcwidth
except ImportError:
skip("test_wrap_wide_char is skipped")