Skip to content

Commit

Permalink
Apply ruff/flake8-comprehensions rule C416
Browse files Browse the repository at this point in the history
C416 Unnecessary `list` comprehension (rewrite using `list()`)
  • Loading branch information
DimitriPapadopoulos committed Sep 27, 2024
1 parent f912753 commit 685460b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tabulate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2313,7 +2313,7 @@ def tabulate(
assert isinstance(colalign, Iterable)
if isinstance(colalign, str):
warnings.warn(
f"As a string, `colalign` is interpreted as {[c for c in colalign]}. "
f"As a string, `colalign` is interpreted as {list(colalign)}. "
f'Did you mean `colglobalalign = "{colalign}"` or `colalign = ("{colalign}",)`?',
stacklevel=2,
)
Expand Down Expand Up @@ -2357,7 +2357,7 @@ def tabulate(
assert isinstance(headersalign, Iterable)
if isinstance(headersalign, str):
warnings.warn(
f"As a string, `headersalign` is interpreted as {[c for c in headersalign]}. "
f"As a string, `headersalign` is interpreted as {list(headersalign)}. "
f'Did you mean `headersglobalalign = "{headersalign}"` '
f'or `headersalign = ("{headersalign}",)`?',
stacklevel=2,
Expand Down Expand Up @@ -2634,7 +2634,7 @@ def _update_lines(self, lines, new_line):
as add any colors from previous lines order to preserve the same formatting
as a single unwrapped string.
"""
code_matches = [x for x in _ansi_codes.finditer(new_line)]
code_matches = list(_ansi_codes.finditer(new_line))
color_codes = [
code.string[code.span()[0] : code.span()[1]] for code in code_matches
]
Expand Down

0 comments on commit 685460b

Please sign in to comment.