Use list expansion instead of concatenation

This commit is contained in:
Hugo Osvaldo Barrera 2025-08-29 12:35:54 +02:00
parent 424cfc5799
commit e3b2473383
6 changed files with 7 additions and 7 deletions

View file

@ -54,8 +54,8 @@ def main(ical1_filename, ical2_filename):
f"{get_summary(ical1)}...\n(full contents: {ical1_filename})\n\n" f"{get_summary(ical1)}...\n(full contents: {ical1_filename})\n\n"
"or the second entry:\n" "or the second entry:\n"
f"{get_summary(ical2)}...\n(full contents: {ical2_filename})?", f"{get_summary(ical2)}...\n(full contents: {ical2_filename})?",
*additional_args,
] ]
+ additional_args
) )
if r.returncode == 2: if r.returncode == 2:

View file

@ -41,7 +41,7 @@ async def test_list(aio_connector):
), ),
] ]
responses = ["\n".join(["BEGIN:VCALENDAR"] + items + ["END:VCALENDAR"])] * 2 responses = ["\n".join(["BEGIN:VCALENDAR", *items, "END:VCALENDAR"])] * 2
def callback(url, headers, **kwargs): def callback(url, headers, **kwargs):
assert headers["User-Agent"].startswith("vdirsyncer/") assert headers["User-Agent"].startswith("vdirsyncer/")

View file

@ -58,7 +58,7 @@ def test_repair_uids(storage, runner, repair_uids):
else: else:
opt = ["--no-repair-unsafe-uid"] opt = ["--no-repair-unsafe-uid"]
result = runner.invoke(["repair"] + opt + ["foo"], input="y") result = runner.invoke(["repair", *opt, "foo"], input="y")
assert not result.exception assert not result.exception
if repair_uids: if repair_uids:

View file

@ -25,7 +25,7 @@ _simple_split = [
] ]
_simple_joined = "\r\n".join( _simple_joined = "\r\n".join(
["BEGIN:VADDRESSBOOK"] + _simple_split + ["END:VADDRESSBOOK\r\n"] ["BEGIN:VADDRESSBOOK", *_simple_split, "END:VADDRESSBOOK\r\n"]
) )
@ -124,7 +124,7 @@ def test_split_collection_timezones():
"END:VTIMEZONE" "END:VTIMEZONE"
) )
full = "\r\n".join(["BEGIN:VCALENDAR"] + items + [timezone, "END:VCALENDAR"]) full = "\r\n".join(["BEGIN:VCALENDAR", *items, timezone, "END:VCALENDAR"])
given = {normalize_item(item) for item in vobject.split_collection(full)} given = {normalize_item(item) for item in vobject.split_collection(full)}
expected = { expected = {

View file

@ -351,7 +351,7 @@ def _resolve_conflict_via_command(
f.write(b.raw) f.write(b.raw)
command[0] = expand_path(command[0]) command[0] = expand_path(command[0])
_check_call(command + [a_tmp, b_tmp]) _check_call([*command, a_tmp, b_tmp])
with open(a_tmp) as f: with open(a_tmp) as f:
new_a = f.read() new_a = f.read()

View file

@ -87,7 +87,7 @@ def get_storage_init_specs(cls, stop_at=object):
else: else:
superspecs = () superspecs = ()
return (spec,) + superspecs return (spec, *superspecs)
def get_storage_init_args(cls, stop_at=object): def get_storage_init_args(cls, stop_at=object):