Skip to content

Commit f32dc35

Browse files
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.
1 parent aa58273 commit f32dc35

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

twine/repository.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ def _convert_data_to_list_of_tuples(data: Dict[str, Any]) -> List[Tuple[str, Any
9696
if key in KEYWORDS_TO_NOT_FLATTEN or not isinstance(value, (list, tuple)):
9797
data_to_send.append((key, value))
9898
else:
99-
for item in value:
100-
data_to_send.append((key, item))
99+
data_to_send.extend((key, item) for item in value)
101100
return data_to_send
102101

103102
def set_certificate_authority(self, cacert: Optional[str]) -> None:

0 commit comments

Comments
 (0)