Skip to content

Commit

Permalink
tools: prefer filter to remove empty strings
Browse files Browse the repository at this point in the history
Ref: #23585 (comment)

Python's `list.remove` will throw if the element is not found and also
it removes only the first occurrence.

This patch replaces the use of `list.remove` with a `filter` which
solves both of the above mentioned problems.

PR-URL: #23727
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
thefourtheye authored and rvagg committed Nov 28, 2018
1 parent 578d894 commit 72b9d15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1381,8 +1381,8 @@ def ProcessOptions(options):
options.arch = options.arch.split(',')
options.mode = options.mode.split(',')
options.run = options.run.split(',')
options.skip_tests = options.skip_tests.split(',')
options.skip_tests.remove("")
# Split at commas and filter out all the empty strings.
options.skip_tests = filter(bool, options.skip_tests.split(','))
if options.run == [""]:
options.run = None
elif len(options.run) != 2:
Expand Down

0 comments on commit 72b9d15

Please sign in to comment.