Skip to content

Commit 233ab89

Browse files
[ruff] Fix all consider [*cats, garfield] instead of cats + [garfield]
1 parent 8967c52 commit 233ab89

File tree

14 files changed

+25
-28
lines changed

14 files changed

+25
-28
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ ignore = [
158158
"D404", # First word of the docstring should not be "This"
159159
"D415", # First line should end with a period, question mark, or exclamation point
160160
# ruff ignore
161-
"RUF005", # Consider `(x, *y)` instead of concatenation
162161
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
163162
]
164163

scripts/release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def pre_release(
107107

108108
def changelog(version: str, write_out: bool = False) -> None:
109109
addopts = [] if write_out else ["--draft"]
110-
check_call(["towncrier", "--yes", "--version", version] + addopts)
110+
check_call(["towncrier", "--yes", "--version", version, *addopts])
111111

112112

113113
def main() -> None:

src/_pytest/assertion/rewrite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ def visit_Assert(self, assert_: ast.Assert) -> List[ast.stmt]:
925925
# If any hooks implement assert_pass hook
926926
hook_impl_test = ast.If(
927927
self.helper("_check_if_assertion_pass_impl"),
928-
self.expl_stmts + [hook_call_pass],
928+
[*self.expl_stmts, hook_call_pass],
929929
[],
930930
)
931931
statements_pass = [hook_impl_test]

src/_pytest/assertion/truncate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def _truncate_explanation(
9292
else:
9393
# Add proper ellipsis when we were able to fit a full line exactly
9494
truncated_explanation[-1] = "..."
95-
return truncated_explanation + [
95+
return [
96+
*truncated_explanation,
9697
"",
9798
f"...Full output truncated ({truncated_line_count} line"
9899
f"{'' if truncated_line_count == 1 else 's'} hidden), {USAGE_MSG}",

src/_pytest/assertion/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ def assertrepr_compare(
233233
return None
234234

235235
if explanation[0] != "":
236-
explanation = [""] + explanation
237-
return [summary] + explanation
236+
explanation = ["", *explanation]
237+
return [summary, *explanation]
238238

239239

240240
def _compare_eq_any(

src/_pytest/config/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ def directory_arg(path: str, optname: str) -> str:
238238
"helpconfig", # Provides -p.
239239
)
240240

241-
default_plugins = essential_plugins + (
241+
default_plugins = (
242+
*essential_plugins,
242243
"python",
243244
"terminal",
244245
"debugging",

src/_pytest/config/argparsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def _getparser(self) -> "MyOptionParser":
122122
from _pytest._argcomplete import filescompleter
123123

124124
optparser = MyOptionParser(self, self.extra_info, prog=self.prog)
125-
groups = self._groups + [self._anonymous]
125+
groups = [*self._groups, self._anonymous]
126126
for group in groups:
127127
if group.options:
128128
desc = group.description or group.name

src/_pytest/pytester.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ def inline_runsource(self, source: str, *cmdlineargs) -> HookRecorder:
10611061
:param cmdlineargs: Any extra command line arguments to use.
10621062
"""
10631063
p = self.makepyfile(source)
1064-
values = list(cmdlineargs) + [p]
1064+
values = [*list(cmdlineargs), p]
10651065
return self.inline_run(*values)
10661066

10671067
def inline_genitems(self, *args) -> Tuple[List[Item], HookRecorder]:
@@ -1491,10 +1491,10 @@ def runpytest_subprocess(
14911491
"""
14921492
__tracebackhide__ = True
14931493
p = make_numbered_dir(root=self.path, prefix="runpytest-", mode=0o700)
1494-
args = ("--basetemp=%s" % p,) + args
1494+
args = ("--basetemp=%s" % p, *args)
14951495
plugins = [x for x in self.plugins if isinstance(x, str)]
14961496
if plugins:
1497-
args = ("-p", plugins[0]) + args
1497+
args = ("-p", plugins[0], *args)
14981498
args = self._getpytestargs() + args
14991499
return self.run(*args, timeout=timeout)
15001500

src/_pytest/recwarn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def deprecated_call(
7979
"""
8080
__tracebackhide__ = True
8181
if func is not None:
82-
args = (func,) + args
82+
args = (func, *args)
8383
return warns(
8484
(DeprecationWarning, PendingDeprecationWarning, FutureWarning), *args, **kwargs
8585
)

testing/code/test_excinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ def test():
17391739
def add_note(err: BaseException, msg: str) -> None:
17401740
"""Adds a note to an exception inplace."""
17411741
if sys.version_info < (3, 11):
1742-
err.__notes__ = getattr(err, "__notes__", []) + [msg] # type: ignore[attr-defined]
1742+
err.__notes__ = [*getattr(err, "__notes__", []), msg] # type: ignore[attr-defined]
17431743
else:
17441744
err.add_note(msg)
17451745

0 commit comments

Comments
 (0)