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 15:43:52 +0100
commitd73d965b736c50bafa019a343707e73ef5c1aa90 (patch)
treec96a05555c70e3cc5d3c7534f7466c03bbced000
parent5087f5c5c33ff83e15bb9e8340bb900d4d052115 (diff)
downloadbuildstream-d73d965b736c50bafa019a343707e73ef5c1aa90.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)