Make pylint happy

pull/22028/head
Lidi Zheng 5 years ago
parent 908a8489f0
commit 37055f923f
  1. 4
      src/python/grpcio_health_checking/grpc_health/v1/_async.py
  2. 3
      src/python/grpcio_health_checking/grpc_health/v1/health.py

@ -13,12 +13,10 @@
# limitations under the License. # limitations under the License.
"""Reference implementation for health checking in gRPC Python.""" """Reference implementation for health checking in gRPC Python."""
import logging
import asyncio import asyncio
import collections import collections
import grpc import grpc
from grpc.experimental import aio
from grpc_health.v1 import health_pb2 as _health_pb2 from grpc_health.v1 import health_pb2 as _health_pb2
from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc
@ -28,14 +26,12 @@ class AsyncHealthServicer(_health_pb2_grpc.HealthServicer):
"""An AsyncIO implementation of health checking servicer.""" """An AsyncIO implementation of health checking servicer."""
def __init__(self): def __init__(self):
self._lock = asyncio.Lock()
self._server_status = dict() self._server_status = dict()
self._server_watchers = collections.defaultdict(asyncio.Condition) self._server_watchers = collections.defaultdict(asyncio.Condition)
self._gracefully_shutting_down = False self._gracefully_shutting_down = False
async def Check(self, request: _health_pb2.HealthCheckRequest, context): async def Check(self, request: _health_pb2.HealthCheckRequest, context):
status = self._server_status.get(request.service) status = self._server_status.get(request.service)
logging.debug('Status %s, %s', request.service, status)
if status is None: if status is None:
await context.abort(grpc.StatusCode.NOT_FOUND) await context.abort(grpc.StatusCode.NOT_FOUND)

@ -22,7 +22,8 @@ from grpc_health.v1 import health_pb2 as _health_pb2
from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc from grpc_health.v1 import health_pb2_grpc as _health_pb2_grpc
if sys.version_info[0] >= 3 and sys.version_info[1] >= 6: if sys.version_info[0] >= 3 and sys.version_info[1] >= 6:
from ._async import AsyncHealthServicer # Exposes AsyncHealthServicer as public API.
from ._async import AsyncHealthServicer # pylint: disable=unused-import
SERVICE_NAME = _health_pb2.DESCRIPTOR.services_by_name['Health'].full_name SERVICE_NAME = _health_pb2.DESCRIPTOR.services_by_name['Health'].full_name

Loading…
Cancel
Save