How to use the grpclib.const function in grpclib

To help you get started, we’ve selected a few grpclib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vmagamedov / grpclib / tests / test_codec.py View on Github external
def __mapping__(self):
        return {
            '/ping.PingService/UnaryUnary': grpclib.const.Handler(
                self.UnaryUnary,
                grpclib.const.Cardinality.UNARY_UNARY,
                None,
                None,
            ),
github vmagamedov / grpclib / tests / bombed_grpc.py View on Github external
def __mapping__(self):
        return {
            '/Bombed/Plaster': grpclib.const.Handler(
                self.Plaster,
                grpclib.const.Cardinality.UNARY_UNARY,
                bombed_pb2.SavoysRequest,
                bombed_pb2.SavoysReply,
            ),
            '/Bombed/Benzine': grpclib.const.Handler(
                self.Benzine,
                grpclib.const.Cardinality.UNARY_STREAM,
                bombed_pb2.SavoysRequest,
                bombed_pb2.GoowyChunk,
            ),
            '/Bombed/Anginal': grpclib.const.Handler(
                self.Anginal,
                grpclib.const.Cardinality.STREAM_UNARY,
                bombed_pb2.UnyoungChunk,
                bombed_pb2.SavoysReply,
            ),
            '/Bombed/Devilry': grpclib.const.Handler(
                self.Devilry,
                grpclib.const.Cardinality.STREAM_STREAM,
                bombed_pb2.UnyoungChunk,
                bombed_pb2.GoowyChunk,
            ),
github vmagamedov / grpclib / examples / streaming / helloworld_grpc.py View on Github external
def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
        return {
            '/helloworld.Greeter/UnaryUnaryGreeting': grpclib.const.Handler(
                self.UnaryUnaryGreeting,
                grpclib.const.Cardinality.UNARY_UNARY,
                streaming.helloworld_pb2.HelloRequest,
                streaming.helloworld_pb2.HelloReply,
            ),
            '/helloworld.Greeter/UnaryStreamGreeting': grpclib.const.Handler(
                self.UnaryStreamGreeting,
                grpclib.const.Cardinality.UNARY_STREAM,
                streaming.helloworld_pb2.HelloRequest,
                streaming.helloworld_pb2.HelloReply,
            ),
            '/helloworld.Greeter/StreamUnaryGreeting': grpclib.const.Handler(
                self.StreamUnaryGreeting,
                grpclib.const.Cardinality.STREAM_UNARY,
                streaming.helloworld_pb2.HelloRequest,
                streaming.helloworld_pb2.HelloReply,
            ),
            '/helloworld.Greeter/StreamStreamGreeting': grpclib.const.Handler(
                self.StreamStreamGreeting,
                grpclib.const.Cardinality.STREAM_STREAM,
                streaming.helloworld_pb2.HelloRequest,
                streaming.helloworld_pb2.HelloReply,
            ),
github OlavHN / tfweb / tfweb / service_grpc.py View on Github external
def __mapping__(self):
        return {
                '/Model/Predict':
                grpclib.const.Handler(
                        self.Predict,
                        grpclib.const.Cardinality.UNARY_UNARY,
                        service_pb2.PredictRequest,
                        service_pb2.PredictResponse,
                ),
github Angel-ML / PyAngelPS / python / pyangel / client_master_grpc.py View on Github external
def __mapping__(self):
        return {
            '/ClientMaster.AngelCleintMaster/RegisterWorker': grpclib.const.Handler(
                self.RegisterWorker,
                grpclib.const.Cardinality.UNARY_UNARY,
                client_master_pb2.RegisterWorkerReq,
                client_master_pb2.RegisterWorkerResp,
            ),
            '/ClientMaster.AngelCleintMaster/RegisterTask': grpclib.const.Handler(
                self.RegisterTask,
                grpclib.const.Cardinality.UNARY_UNARY,
                client_master_pb2.RegisterTaskReq,
                client_master_pb2.RegisterTaskResp,
            ),
            '/ClientMaster.AngelCleintMaster/SetAngelLocation': grpclib.const.Handler(
                self.SetAngelLocation,
                grpclib.const.Cardinality.UNARY_UNARY,
                client_master_pb2.SetAngelLocationReq,
                common_pb2.VoidResp,
github OlavHN / tfweb / tfweb / service_grpc.py View on Github external
def __mapping__(self):
        return {
                '/Model/Predict':
                grpclib.const.Handler(
                        self.Predict,
                        grpclib.const.Cardinality.UNARY_UNARY,
                        service_pb2.PredictRequest,
                        service_pb2.PredictResponse,
                ),
github vmagamedov / grpclib / grpclib / plugin / main.py View on Github external
from contextlib import contextmanager
from collections import deque

from google.protobuf.descriptor_pb2 import FileDescriptorProto, DescriptorProto
from google.protobuf.compiler.plugin_pb2 import CodeGeneratorRequest
from google.protobuf.compiler.plugin_pb2 import CodeGeneratorResponse

from .. import const
from .. import client
from .. import server


_CARDINALITY = {
    (False, False): const.Cardinality.UNARY_UNARY,
    (True, False): const.Cardinality.STREAM_UNARY,
    (False, True): const.Cardinality.UNARY_STREAM,
    (True, True): const.Cardinality.STREAM_STREAM,
}


class Method(NamedTuple):
    name: str
    cardinality: const.Cardinality
    request_type: str
    reply_type: str


class Service(NamedTuple):
    name: str
    methods: List[Method]
github Angel-ML / PyAngelPS / python / pyangel / client_worker_grpc.py View on Github external
client_worker_pb2.RPCEmbedding,
                client_worker_pb2.CreateResp,
            ),
            '/ClientMaster.ClientWorker/Init': grpclib.const.Handler(
                self.Init,
                grpclib.const.Cardinality.UNARY_UNARY,
                client_worker_pb2.TensorLike,
                common_pb2.VoidResp,
            ),
            '/ClientMaster.ClientWorker/Load': grpclib.const.Handler(
                self.Load,
                grpclib.const.Cardinality.UNARY_UNARY,
                client_worker_pb2.LoadTensorLike,
                common_pb2.VoidResp,
            ),
            '/ClientMaster.ClientWorker/Save': grpclib.const.Handler(
                self.Save,
                grpclib.const.Cardinality.UNARY_UNARY,
                client_worker_pb2.SaveTensorLike,
                common_pb2.VoidResp,
            ),
            '/ClientMaster.ClientWorker/Pull': grpclib.const.Handler(
                self.Pull,
                grpclib.const.Cardinality.UNARY_UNARY,
                client_worker_pb2.PullRequest,
                client_worker_pb2.PullResponse,
            ),
            '/ClientMaster.ClientWorker/Push': grpclib.const.Handler(
                self.Push,
                grpclib.const.Cardinality.UNARY_UNARY,
                client_worker_pb2.PushRequest,
                common_pb2.VoidResp,
github vmagamedov / grpclib / examples / streaming / helloworld_grpc.py View on Github external
def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
        return {
            '/helloworld.Greeter/UnaryUnaryGreeting': grpclib.const.Handler(
                self.UnaryUnaryGreeting,
                grpclib.const.Cardinality.UNARY_UNARY,
                streaming.helloworld_pb2.HelloRequest,
                streaming.helloworld_pb2.HelloReply,
            ),
            '/helloworld.Greeter/UnaryStreamGreeting': grpclib.const.Handler(
                self.UnaryStreamGreeting,
                grpclib.const.Cardinality.UNARY_STREAM,
                streaming.helloworld_pb2.HelloRequest,
                streaming.helloworld_pb2.HelloReply,
            ),
            '/helloworld.Greeter/StreamUnaryGreeting': grpclib.const.Handler(
                self.StreamUnaryGreeting,
                grpclib.const.Cardinality.STREAM_UNARY,
                streaming.helloworld_pb2.HelloRequest,
                streaming.helloworld_pb2.HelloReply,
github icgood / pymap / pymap / admin / grpc / admin_grpc.py View on Github external
def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
        return {
            '/admin.Admin/Append': grpclib.const.Handler(
                self.Append,
                grpclib.const.Cardinality.UNARY_UNARY,
                pymap.admin.grpc.admin_pb2.AppendRequest,
                pymap.admin.grpc.admin_pb2.AppendResponse,
            ),