lint: clean up len-as-condition warnings
Rather than count iterables just to test equality to 0, use their
implicit truthiness instead. Shouldn't be any functional changes.
BUG=chromium:980619
TEST=`cros lint` is clean w/pylint-1.7 again
Change-Id: I3ebf4f3dc51bed492caaa85d14b87239f61d3a6c
Reviewed-on: https://chromium-review.googlesource.com/1816121
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Will Bradley <wbbradley@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 77c4d99..9a19ac7 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -722,7 +722,7 @@
# Construct regex
name_re = r'\b(%s)\b' % '|'.join([re.escape(x) for x in name_list])
matches = [x[0] for x in re.findall(name_re, commit_message, re.IGNORECASE)]
- if len(matches):
+ if matches:
# If there's a match, throw an error.
error_msg = ('Changelist description contains the name of an'
' %s: "%s".' % (name_type, '","'.join(matches)))
@@ -1916,7 +1916,7 @@
if proj_dir is None:
proj_dirs = _run_command(
['repo', 'forall', project_name, '-c', 'pwd']).split()
- if len(proj_dirs) == 0:
+ if not proj_dirs:
print('%s cannot be found.' % project_name, file=sys.stderr)
print('Please specify a valid project.', file=sys.stderr)
return True