From 519d4c66a8b4e309d7564dd9d2468cc4c2d0dc2c Mon Sep 17 00:00:00 2001 From: xloem <0xloem@gmail.com> Date: Wed, 21 Jun 2023 22:24:39 -0400 Subject: [PATCH] fix parse errors with methodless stubs by adding a "pass" statement --- grpclib/plugin/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grpclib/plugin/main.py b/grpclib/plugin/main.py index 49db777..f325d1e 100644 --- a/grpclib/plugin/main.py +++ b/grpclib/plugin/main.py @@ -129,6 +129,8 @@ def render( buf.add('def __init__(self, channel: {}.{}) -> None:' .format(client.__name__, client.Channel.__name__)) with buf.indent(): + if len(service.methods) == 0: + buf.add('pass') for method in service.methods: name, cardinality, request_type, reply_type = method full_name = '/{}/{}'.format(service_name, name)