diff options
author | Nathaniel Manista <nathaniel@google.com> | 2017-01-17 15:00:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-17 15:00:34 -0800 |
commit | fc4b07e10c0482522dbc6a01401ea8f1606a76b4 (patch) | |
tree | 622b321c1682d85950c8b9519c2f957b26e6e52e /src/python/grpcio_health_checking/grpc_health/v1/health.py | |
parent | c0d7d67dfbe4f7d539e64365c4111b748285668f (diff) | |
parent | cc793703bfba6f661f523b6fec82ff8a913e1759 (diff) |
Merge pull request #9276 from soltanmm-google/remember-the-blue-flowers-they-are-important!
Enable yapf (Python formatting).
Diffstat (limited to 'src/python/grpcio_health_checking/grpc_health/v1/health.py')
-rw-r--r-- | src/python/grpcio_health_checking/grpc_health/v1/health.py | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/python/grpcio_health_checking/grpc_health/v1/health.py b/src/python/grpcio_health_checking/grpc_health/v1/health.py index 0df679b0e2..f0f11cf84b 100644 --- a/src/python/grpcio_health_checking/grpc_health/v1/health.py +++ b/src/python/grpcio_health_checking/grpc_health/v1/health.py @@ -26,7 +26,6 @@ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - """Reference implementation for health checking in gRPC Python.""" import threading @@ -37,23 +36,23 @@ from grpc_health.v1 import health_pb2 class HealthServicer(health_pb2.HealthServicer): - """Servicer handling RPCs for service statuses.""" + """Servicer handling RPCs for service statuses.""" - def __init__(self): - self._server_status_lock = threading.Lock() - self._server_status = {} + def __init__(self): + self._server_status_lock = threading.Lock() + self._server_status = {} - def Check(self, request, context): - with self._server_status_lock: - status = self._server_status.get(request.service) - if status is None: - context.set_code(grpc.StatusCode.NOT_FOUND) - return health_pb2.HealthCheckResponse() - else: - return health_pb2.HealthCheckResponse(status=status) + def Check(self, request, context): + with self._server_status_lock: + status = self._server_status.get(request.service) + if status is None: + context.set_code(grpc.StatusCode.NOT_FOUND) + return health_pb2.HealthCheckResponse() + else: + return health_pb2.HealthCheckResponse(status=status) - def set(self, service, status): - """Sets the status of a service. + def set(self, service, status): + """Sets the status of a service. Args: service: string, the name of the service. @@ -61,5 +60,5 @@ class HealthServicer(health_pb2.HealthServicer): status: HealthCheckResponse.status enum value indicating the status of the service """ - with self._server_status_lock: - self._server_status[service] = status + with self._server_status_lock: + self._server_status[service] = status |