From d73d965b736c50bafa019a343707e73ef5c1aa90 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Wed, 24 Oct 2018 11:12:25 +0100 Subject: _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 --- buildstream/_artifactcache/cascache.py | 6 +++--- 1 file 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) -- cgit v1.2.1