summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-24 11:12:25 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-25 13:58:09 +0100
commit21e3f0369d037504e4d8b9a0262d908bdc8fd0e0 (patch)
treeb47a254a9741ec2af1bf5348eca89313da520af8
parent6e539889b7416a65c4a5fdfcb0a8bfac6add2485 (diff)
downloadbuildstream-21e3f0369d037504e4d8b9a0262d908bdc8fd0e0.tar.gz
_artifactcache/cascache.py: Silence len(SEQUENCE) as condition warnings
The lint tool dislikes the use of `if len(SEQ) == 0` type statements because nominally `len(SEQ)` may be more expensive than `bool(SEQ)`. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r--buildstream/_artifactcache/cascache.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 1a85e4c22..aeab942cc 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -959,7 +959,7 @@ class CASCache(ArtifactCache):
batch = _CASBatchRead(remote)
while len(fetch_queue) + len(fetch_next_queue) > 0:
- if len(fetch_queue) == 0:
+ if not fetch_queue:
batch = self._fetch_directory_batch(remote, batch, fetch_queue, fetch_next_queue)
dir_digest = fetch_queue.pop(0)
@@ -1192,7 +1192,7 @@ class _CASBatchRead():
assert not self._sent
self._sent = True
- if len(self._request.digests) == 0:
+ if not self._request.digests:
return
batch_response = self._remote.cas.BatchReadBlobs(self._request)
@@ -1237,7 +1237,7 @@ class _CASBatchUpdate():
assert not self._sent
self._sent = True
- if len(self._request.requests) == 0:
+ if not self._request.requests:
return
batch_response = self._remote.cas.BatchUpdateBlobs(self._request)