From 27429f7a8c8ee3aa91b1cec2f007ab2292dc6327 Mon Sep 17 00:00:00 2001 From: Xuan Wang Date: Tue, 30 Jan 2024 23:13:00 +0000 Subject: [PATCH] Fix sanity --- .../python/grpcio_tools/grpc_tools/protoc.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/distrib/python/grpcio_tools/grpc_tools/protoc.py b/tools/distrib/python/grpcio_tools/grpc_tools/protoc.py index f304cae431d..bc2b8c0276b 100644 --- a/tools/distrib/python/grpcio_tools/grpc_tools/protoc.py +++ b/tools/distrib/python/grpcio_tools/grpc_tools/protoc.py @@ -41,12 +41,19 @@ def main(command_arguments): return _protoc_compiler.run_main(command_arguments) -def _get_resource_file_name(package_or_requirement: str, resource_name: str) -> str: - """Obtain the filename for a resource on the file system.""" - if sys.version_info >= (3, 9, 0): - return (resources.files(package_or_requirement) / resource_name).resolve() - else: - return pkg_resources.resource_filename(package_or_requirement, resource_name) +def _get_resource_file_name( + package_or_requirement: str, resource_name: str +) -> str: + """Obtain the filename for a resource on the file system.""" + if sys.version_info >= (3, 9, 0): + return ( + resources.files(package_or_requirement) / resource_name + ).resolve() + else: + return pkg_resources.resource_filename( + package_or_requirement, resource_name + ) + # NOTE(rbellevi): importlib.abc is not supported on 3.4. if sys.version_info >= (3, 5, 0):