grpclib/tests/dummy_grpc.py

89 lines
2.9 KiB
Python
Raw Normal View History

# Generated by the Protocol Buffers compiler. DO NOT EDIT!
# source: dummy.proto
# plugin: grpclib.plugin.main
import abc
import typing
import grpclib.const
import grpclib.client
if typing.TYPE_CHECKING:
import grpclib.server
import dummy_pb2
class DummyServiceBase(abc.ABC):
@abc.abstractmethod
async def UnaryUnary(self, stream: 'grpclib.server.Stream[dummy_pb2.DummyRequest, dummy_pb2.DummyReply]') -> None:
pass
@abc.abstractmethod
async def UnaryStream(self, stream: 'grpclib.server.Stream[dummy_pb2.DummyRequest, dummy_pb2.DummyReply]') -> None:
pass
@abc.abstractmethod
async def StreamUnary(self, stream: 'grpclib.server.Stream[dummy_pb2.DummyRequest, dummy_pb2.DummyReply]') -> None:
pass
@abc.abstractmethod
async def StreamStream(self, stream: 'grpclib.server.Stream[dummy_pb2.DummyRequest, dummy_pb2.DummyReply]') -> None:
pass
def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
return {
'/dummy.DummyService/UnaryUnary': grpclib.const.Handler(
self.UnaryUnary,
grpclib.const.Cardinality.UNARY_UNARY,
dummy_pb2.DummyRequest,
dummy_pb2.DummyReply,
),
'/dummy.DummyService/UnaryStream': grpclib.const.Handler(
self.UnaryStream,
grpclib.const.Cardinality.UNARY_STREAM,
dummy_pb2.DummyRequest,
dummy_pb2.DummyReply,
),
'/dummy.DummyService/StreamUnary': grpclib.const.Handler(
self.StreamUnary,
grpclib.const.Cardinality.STREAM_UNARY,
dummy_pb2.DummyRequest,
dummy_pb2.DummyReply,
),
'/dummy.DummyService/StreamStream': grpclib.const.Handler(
self.StreamStream,
grpclib.const.Cardinality.STREAM_STREAM,
dummy_pb2.DummyRequest,
dummy_pb2.DummyReply,
),
}
class DummyServiceStub:
def __init__(self, channel: grpclib.client.Channel) -> None:
self.UnaryUnary = grpclib.client.UnaryUnaryMethod(
channel,
'/dummy.DummyService/UnaryUnary',
dummy_pb2.DummyRequest,
dummy_pb2.DummyReply,
)
self.UnaryStream = grpclib.client.UnaryStreamMethod(
channel,
'/dummy.DummyService/UnaryStream',
dummy_pb2.DummyRequest,
dummy_pb2.DummyReply,
)
self.StreamUnary = grpclib.client.StreamUnaryMethod(
channel,
'/dummy.DummyService/StreamUnary',
dummy_pb2.DummyRequest,
dummy_pb2.DummyReply,
)
self.StreamStream = grpclib.client.StreamStreamMethod(
channel,
'/dummy.DummyService/StreamStream',
dummy_pb2.DummyRequest,
dummy_pb2.DummyReply,
)