def ExecuteClientServerStream( self, request_iter: Iterable[DummyRequest], context: grpc.ServicerContext) -> Iterable[DummyResponse]: """Stream input to output.""" for request in request_iter: yield DummyResponse(output=self._get_output(request, context))
def ExecuteClientStream(self, request_iter: Iterable[DummyRequest], context: grpc.ServicerContext) -> DummyResponse: """Iterate over the input and concatenates the strings into the output.""" output = "".join( self._get_output(request, context) for request in request_iter) return DummyResponse(output=output)
def ExecuteServerStream( self, request: DummyRequest, context: grpc.ServicerContext) -> Iterable[DummyResponse]: """Stream one character at a time from the input.""" for c in self._get_output(request, context): yield DummyResponse(output=c)
def Execute(self, request: DummyRequest, context: grpc.ServicerContext) -> DummyResponse: """Echo the input, or take on of the special cases actions.""" return DummyResponse(output=self._get_output(request, context))