-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
232 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from google.protobuf import descriptor as _descriptor | ||
from google.protobuf import message as _message | ||
from typing import ClassVar as _ClassVar, Optional as _Optional | ||
|
||
DESCRIPTOR: _descriptor.FileDescriptor | ||
|
||
class HelloReply(_message.Message): | ||
__slots__ = ["message"] | ||
MESSAGE_FIELD_NUMBER: _ClassVar[int] | ||
message: str | ||
def __init__(self, message: _Optional[str] = ...) -> None: ... | ||
|
||
class HelloRequest(_message.Message): | ||
__slots__ = ["name", "num_greetings"] | ||
NAME_FIELD_NUMBER: _ClassVar[int] | ||
NUM_GREETINGS_FIELD_NUMBER: _ClassVar[int] | ||
name: str | ||
num_greetings: str | ||
def __init__(self, name: _Optional[str] = ..., num_greetings: _Optional[str] = ...) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! | ||
"""Client and server classes corresponding to protobuf-defined services.""" | ||
import grpc | ||
|
||
from tests.contrib.grpc_aio import hellostreamingworld_pb2 as hellostreamingworld__pb2 | ||
|
||
|
||
class MultiGreeterStub(object): | ||
"""The greeting service definition.""" | ||
|
||
def __init__(self, channel): | ||
"""Constructor. | ||
Args: | ||
channel: A grpc.Channel. | ||
""" | ||
self.sayHello = channel.unary_stream( | ||
"/hellostreamingworld.MultiGreeter/sayHello", | ||
request_serializer=hellostreamingworld__pb2.HelloRequest.SerializeToString, | ||
response_deserializer=hellostreamingworld__pb2.HelloReply.FromString, | ||
) | ||
|
||
|
||
class MultiGreeterServicer(object): | ||
"""The greeting service definition.""" | ||
|
||
def sayHello(self, request, context): | ||
"""Sends multiple greetings""" | ||
context.set_code(grpc.StatusCode.UNIMPLEMENTED) | ||
context.set_details("Method not implemented!") | ||
raise NotImplementedError("Method not implemented!") | ||
|
||
|
||
def add_MultiGreeterServicer_to_server(servicer, server): | ||
rpc_method_handlers = { | ||
"sayHello": grpc.unary_stream_rpc_method_handler( | ||
servicer.sayHello, | ||
request_deserializer=hellostreamingworld__pb2.HelloRequest.FromString, | ||
response_serializer=hellostreamingworld__pb2.HelloReply.SerializeToString, | ||
), | ||
} | ||
generic_handler = grpc.method_handlers_generic_handler("hellostreamingworld.MultiGreeter", rpc_method_handlers) | ||
server.add_generic_rpc_handlers((generic_handler,)) | ||
|
||
|
||
# This class is part of an EXPERIMENTAL API. | ||
class MultiGreeter(object): | ||
"""The greeting service definition.""" | ||
|
||
@staticmethod | ||
def sayHello( | ||
request, | ||
target, | ||
options=(), | ||
channel_credentials=None, | ||
call_credentials=None, | ||
insecure=False, | ||
compression=None, | ||
wait_for_ready=None, | ||
timeout=None, | ||
metadata=None, | ||
): | ||
return grpc.experimental.unary_stream( | ||
request, | ||
target, | ||
"/hellostreamingworld.MultiGreeter/sayHello", | ||
hellostreamingworld__pb2.HelloRequest.SerializeToString, | ||
hellostreamingworld__pb2.HelloReply.FromString, | ||
options, | ||
channel_credentials, | ||
insecure, | ||
call_credentials, | ||
compression, | ||
wait_for_ready, | ||
timeout, | ||
metadata, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters