From 05aaf3d939e8bb1d7bf6978e1bd825588ed48c9b Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 6 Aug 2020 17:43:41 -0700 Subject: [PATCH] Pylint --- .pylintrc-examples | 2 ++ examples/python/cancellation/client.py | 1 - src/python/grpcio/grpc/_runtime_protos.py | 14 +++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.pylintrc-examples b/.pylintrc-examples index 9480d6ea56a..cf4b0119479 100644 --- a/.pylintrc-examples +++ b/.pylintrc-examples @@ -98,3 +98,5 @@ disable= no-else-return, # NOTE(lidiz): Python 3 make object inheritance default, but not PY2 useless-object-inheritance, + # NOTE(rbellevi): Pylint does not recognize grpc.protos() as an import. + wrong-import-position, diff --git a/examples/python/cancellation/client.py b/examples/python/cancellation/client.py index e408cace968..325531b02c1 100644 --- a/examples/python/cancellation/client.py +++ b/examples/python/cancellation/client.py @@ -19,7 +19,6 @@ from __future__ import print_function import argparse import logging -import os import signal import sys diff --git a/src/python/grpcio/grpc/_runtime_protos.py b/src/python/grpcio/grpc/_runtime_protos.py index 8b25a1b4f20..e580cc90ccd 100644 --- a/src/python/grpcio/grpc/_runtime_protos.py +++ b/src/python/grpcio/grpc/_runtime_protos.py @@ -48,7 +48,7 @@ def _interpreter_version_protos_and_services(*args, **kwargs): ) -def protos(protobuf_path): +def protos(protobuf_path): # pylint: disable=unused-argument """Returns a module generated by the indicated .proto file. Use this function to retrieve classes corresponding to message @@ -69,7 +69,7 @@ def protos(protobuf_path): """ -def services(protobuf_path): +def services(protobuf_path): # pylint: disable=unused-argument """Returns a module generated by the indicated .proto file. Use this function to retrieve classes and functions corresponding to @@ -91,7 +91,7 @@ def services(protobuf_path): """ -def protos_and_services(protobuf_path): +def protos_and_services(protobuf_path): # pylint: disable=unused-argument """Returns a 2-tuple of modules corresponding to protos and services. The return value of this function is equivalent to a call to protos and a @@ -105,7 +105,7 @@ if sys.version_info[0] < 3: protos_and_services = _interpreter_version_protos_and_services else: try: - import grpc_tools + import grpc_tool # pylint: disable=unused-import except ImportError as e: # NOTE: It's possible that we're encountering a transitive ImportError, so # we check for that and re-raise if so. @@ -115,6 +115,6 @@ else: services = _uninstalled_services protos_and_services = _uninstalled_protos_and_services else: - from grpc_tools.protoc import _protos as protos - from grpc_tools.protoc import _services as services - from grpc_tools.protoc import _protos_and_services as protos_and_services + from grpc_tools.protoc import _protos as protos # pylint: disable=unused-import + from grpc_tools.protoc import _services as services # pylint: disable=unused-import + from grpc_tools.protoc import _protos_and_services as protos_and_services # pylint: disable=unused-import