# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

import base_pb2 as base__pb2


class DemoStub(object):
  # missing associated documentation comment in .proto file
  pass

  def __init__(self, channel):
    """Constructor.

    Args:
      channel: A grpc.Channel.
    """
    self.Calculate = channel.unary_unary(
        '/Demo/Calculate',
        request_serializer=base__pb2.Work.SerializeToString,
        response_deserializer=base__pb2.Result.FromString,
        )
    self.GetSubjects = channel.unary_stream(
        '/Demo/GetSubjects',
        request_serializer=base__pb2.City.SerializeToString,
        response_deserializer=base__pb2.Subject.FromString,
        )
    self.Accumulate = channel.stream_unary(
        '/Demo/Accumulate',
        request_serializer=base__pb2.Delta.SerializeToString,
        response_deserializer=base__pb2.Sum.FromString,
        )
    self.GuessNumber = channel.stream_stream(
        '/Demo/GuessNumber',
        request_serializer=base__pb2.Number.SerializeToString,
        response_deserializer=base__pb2.Answer.FromString,
        )


class DemoServicer(object):
  # missing associated documentation comment in .proto file
  pass

  def Calculate(self, request, context):
    """unary rpc,计算处理
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetSubjects(self, request, context):
    """服务端流式， 根据城市获取服务端返回多个学科
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def Accumulate(self, request_iterator, context):
    """客户端流式， 客户端发送多个数， 服务端返回和
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GuessNumber(self, request_iterator, context):
    """客户端和服务端都流式 猜数字， 客户端向服务端发送多个数据， 在服务端认可范围内则返回
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_DemoServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Calculate': grpc.unary_unary_rpc_method_handler(
          servicer.Calculate,
          request_deserializer=base__pb2.Work.FromString,
          response_serializer=base__pb2.Result.SerializeToString,
      ),
      'GetSubjects': grpc.unary_stream_rpc_method_handler(
          servicer.GetSubjects,
          request_deserializer=base__pb2.City.FromString,
          response_serializer=base__pb2.Subject.SerializeToString,
      ),
      'Accumulate': grpc.stream_unary_rpc_method_handler(
          servicer.Accumulate,
          request_deserializer=base__pb2.Delta.FromString,
          response_serializer=base__pb2.Sum.SerializeToString,
      ),
      'GuessNumber': grpc.stream_stream_rpc_method_handler(
          servicer.GuessNumber,
          request_deserializer=base__pb2.Number.FromString,
          response_serializer=base__pb2.Answer.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'Demo', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
