From 1445a901fcf4a91ef867183e4685b526aad916a6 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Wed, 24 Oct 2018 11:28:43 +0100 Subject: _artifactcache/cascache.py: Cleanup lint warning about indexing In order to quieten the linter, and to make a more correct comparison, we switch to using the `Code.OK` enumeration from `google.rpc.Code` Signed-off-by: Daniel Silverstone --- buildstream/_artifactcache/cascache.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index a9473646d..b99f4d7b8 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -33,6 +33,7 @@ import grpc from .. import _yaml +from .._protos.google.rpc import code_pb2 from .._protos.google.bytestream import bytestream_pb2, bytestream_pb2_grpc from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc from .._protos.buildstream.v2 import buildstream_pb2, buildstream_pb2_grpc @@ -1201,7 +1202,7 @@ class _CASBatchRead(): batch_response = self._remote.cas.BatchReadBlobs(self._request) for response in batch_response.responses: - if response.status.code != grpc.StatusCode.OK.value[0]: + if response.status.code != code_pb2.OK: raise ArtifactError("Failed to download blob {}: {}".format( response.digest.hash, response.status.code)) if response.digest.size_bytes != len(response.data): @@ -1246,7 +1247,7 @@ class _CASBatchUpdate(): batch_response = self._remote.cas.BatchUpdateBlobs(self._request) for response in batch_response.responses: - if response.status.code != grpc.StatusCode.OK.value[0]: + if response.status.code != code_pb2.OK: raise ArtifactError("Failed to upload blob {}: {}".format( response.digest.hash, response.status.code)) -- cgit v1.2.1