From f32dc3545b52389dac0cbd28059833d48c36b4f4 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 30 Nov 2024 16:45:26 +0100 Subject: [PATCH] Apply ruff/Perflint rule (#1136) PERF401 Use a list comprehension to create a transformed list A comprehension is a more efficient way to initialise a list than successive append() calls. --- twine/repository.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/twine/repository.py b/twine/repository.py index 5b2e288e..b512bfb3 100644 --- a/twine/repository.py +++ b/twine/repository.py @@ -96,8 +96,7 @@ def _convert_data_to_list_of_tuples(data: Dict[str, Any]) -> List[Tuple[str, Any if key in KEYWORDS_TO_NOT_FLATTEN or not isinstance(value, (list, tuple)): data_to_send.append((key, value)) else: - for item in value: - data_to_send.append((key, item)) + data_to_send.extend((key, item) for item in value) return data_to_send def set_certificate_authority(self, cacert: Optional[str]) -> None: