Skip to content

Commit

Permalink
Apply ruff/Perflint rule
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DimitriPapadopoulos committed Sep 10, 2024
1 parent ae71822 commit 505970a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions twine/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 505970a

Please sign in to comment.