Avoid docstring duplication

pull/22662/head
Lidi Zheng 5 years ago
parent e819e03a83
commit 37755c482b
  1. 28
      src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py

@ -54,19 +54,20 @@ class ReflectionServicer(BaseReflectionServicer):
))
_enable_server_reflection_doc = """Enables server reflection on a server.
Args:
service_names: Iterable of fully-qualified service names available.
server: grpc.Server to which reflection service will be added.
pool: DescriptorPool object to use (descriptor_pool.Default() if None).
"""
if sys.version_info[0] >= 3 and sys.version_info[1] >= 6:
# Exposes AsyncReflectionServicer as public API.
from . import _async as aio
from grpc.experimental import aio as grpc_aio
from grpc.experimental import aio as grpc_aio # pylint: disable=ungrouped-imports
def enable_server_reflection(service_names, server, pool=None):
"""Enables server reflection on a server.
Args:
service_names: Iterable of fully-qualified service names available.
server: grpc.Server to which reflection service will be added.
pool: DescriptorPool object to use (descriptor_pool.Default() if None).
"""
if isinstance(server, grpc_aio.Server):
_reflection_pb2_grpc.add_ServerReflectionServicer_to_server(
aio.ReflectionServicer(service_names, pool=pool), server)
@ -74,6 +75,8 @@ if sys.version_info[0] >= 3 and sys.version_info[1] >= 6:
_reflection_pb2_grpc.add_ServerReflectionServicer_to_server(
ReflectionServicer(service_names, pool=pool), server)
enable_server_reflection.__doc__ = _enable_server_reflection_doc
__all__ = [
"SERVICE_NAME",
"ReflectionServicer",
@ -83,16 +86,11 @@ if sys.version_info[0] >= 3 and sys.version_info[1] >= 6:
else:
def enable_server_reflection(service_names, server, pool=None):
"""Enables server reflection on a server.
Args:
service_names: Iterable of fully-qualified service names available.
server: grpc.Server to which reflection service will be added.
pool: DescriptorPool object to use (descriptor_pool.Default() if None).
"""
_reflection_pb2_grpc.add_ServerReflectionServicer_to_server(
ReflectionServicer(service_names, pool=pool), server)
enable_server_reflection.__doc__ = _enable_server_reflection_doc
__all__ = [
"SERVICE_NAME",
"ReflectionServicer",

Loading…
Cancel
Save