Skip to content

Commit 277e05c

Browse files
committed
perf: use list comprehension
1 parent c93b795 commit 277e05c

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

scripts/generate_osv_advisories.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,17 @@ def parse_version_constraint(
152152
warnings.append(
153153
'the = operator is not real, and will be treated as an exact version'
154154
)
155-
for component in [
156-
part.first_component or '',
157-
part.second_component or '',
158-
part.third_component or '',
159-
]:
160-
if len(component) > 1 and component.startswith('0'):
161-
warnings.append('components should not be prefixed with leading zeros')
155+
warnings.extend(
156+
[
157+
'components should not be prefixed with leading zeros'
158+
for component in [
159+
part.first_component or '',
160+
part.second_component or '',
161+
part.third_component or '',
162+
]
163+
if len(component) > 1 and component.startswith('0')
164+
]
165+
)
162166

163167
# https://getcomposer.org/doc/articles/versions.md#wildcard-version-range-
164168
if parts[0].second_component == '*' or parts[0].third_component == '*':

0 commit comments

Comments
 (0)