Skip to content

Commit

Permalink
Apply ruff/Perflint rule PERF401
Browse files Browse the repository at this point in the history
PERF401 Use a list comprehension to create a transformed list
  • Loading branch information
DimitriPapadopoulos committed Aug 24, 2024
1 parent 7bb46d7 commit fdff091
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/wheel/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@ def requires_to_requires_dist(requirement: Requirement) -> str:
if requirement.url:
return " @ " + requirement.url

requires_dist: list[str] = []
for spec in requirement.specifier:
requires_dist.append(spec.operator + spec.version)

if requires_dist:
return " " + ",".join(sorted(requires_dist))
if requirement.specifier:
return " " + ",".join(
sorted(spec.operator + spec.version for spec in requirement.specifier)
)
else:
return ""

Expand Down

0 comments on commit fdff091

Please sign in to comment.