@@ -172,6 +172,7 @@ class StubGenerator : public BaseGenerator {
172172 << " def __init__(self, channel: grpc.Channel) -> None: ...\n " ;
173173
174174 for (const RPCCall* method : service->calls .vec ) {
175+ imports->Import (" typing" );
175176 std::string request = " bytes" ;
176177 std::string response = " bytes" ;
177178
@@ -183,14 +184,22 @@ class StubGenerator : public BaseGenerator {
183184 imports->Import (ModuleFor (method->response ), response);
184185 }
185186
186- ss << " def " << method->name << " (self, " ;
187+ ss << " def " << method->name << " (\n " ;
188+ ss << " self,\n " ;
187189 if (ClientStreaming (method)) {
188- imports->Import (" typing" );
189- ss << " request_iterator: typing.Iterator[" << request << " ]" ;
190+ ss << " request_iterator: typing.Iterator[" << request << " ]\n " ;
190191 } else {
191- ss << " request: " << request;
192+ ss << " request: " << request << " , \n " ;
192193 }
193- ss << " ) -> " ;
194+
195+ ss << " timeout: float | None = None,\n " ;
196+ // https://github.com/python/typeshed/blob/ccf9411fb1f5bee2a8e3d278889de17a08f7bbe3/stubs/grpcio/grpc/__init__.pyi#L37
197+ ss << " metadata: typing.Sequence[tuple[str, typing.Union[str, bytes]]] | None = None,\n " ;
198+ ss << " credentials: grpc.CallCredentials | None = None,\n " ;
199+ ss << " wait_for_ready: bool | None = None,\n " ;
200+ ss << " compression: grpc.Compression | None = None\n " ;
201+
202+ ss << " ) -> " ;
194203 if (ServerStreaming (method)) {
195204 imports->Import (" typing" );
196205 ss << " typing.Iterator[" << response << " ]" ;
0 commit comments