...

Text file src/github.com/google/flatbuffers/tests/MyGame/Example/monster_test_grpc_fb.py

Documentation: github.com/google/flatbuffers/tests/MyGame/Example

     1# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
     2import grpc
     3
     4
     5class MonsterStorageStub(object):
     6  
     7  def __init__(self, channel):
     8    """Constructor.
     9    
    10    Args:
    11      channel: A grpc.Channel.
    12    """
    13    self.Store = channel.unary_unary(
    14        '/MyGame.Example.MonsterStorage/Store',
    15        
    16        
    17        )
    18    self.Retrieve = channel.unary_stream(
    19        '/MyGame.Example.MonsterStorage/Retrieve',
    20        
    21        
    22        )
    23    self.GetMaxHitPoint = channel.stream_unary(
    24        '/MyGame.Example.MonsterStorage/GetMaxHitPoint',
    25        
    26        
    27        )
    28    self.GetMinMaxHitPoints = channel.unary_unary(
    29        '/MyGame.Example.MonsterStorage/GetMinMaxHitPoints',
    30        
    31        
    32        )
    33
    34
    35class MonsterStorageServicer(object):
    36  
    37  def Store(self, request, context):
    38    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    39    context.set_details('Method not implemented!')
    40    raise NotImplementedError('Method not implemented!')
    41  
    42  def Retrieve(self, request, context):
    43    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    44    context.set_details('Method not implemented!')
    45    raise NotImplementedError('Method not implemented!')
    46  
    47  def GetMaxHitPoint(self, request_iterator, context):
    48    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    49    context.set_details('Method not implemented!')
    50    raise NotImplementedError('Method not implemented!')
    51  
    52  def GetMinMaxHitPoints(self, request, context):
    53    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    54    context.set_details('Method not implemented!')
    55    raise NotImplementedError('Method not implemented!')
    56
    57
    58def add_MonsterStorageServicer_to_server(servicer, server):
    59  rpc_method_handlers = {
    60      'Store': grpc.unary_unary_rpc_method_handler(
    61          servicer.Store,
    62          
    63          
    64      ),
    65      'Retrieve': grpc.unary_stream_rpc_method_handler(
    66          servicer.Retrieve,
    67          
    68          
    69      ),
    70      'GetMaxHitPoint': grpc.stream_unary_rpc_method_handler(
    71          servicer.GetMaxHitPoint,
    72          
    73          
    74      ),
    75      'GetMinMaxHitPoints': grpc.unary_unary_rpc_method_handler(
    76          servicer.GetMinMaxHitPoints,
    77          
    78          
    79      ),
    80  }
    81  generic_handler = grpc.method_handlers_generic_handler(
    82      'MyGame.Example.MonsterStorage', rpc_method_handlers)
    83  server.add_generic_rpc_handlers((generic_handler,))
    84try:
    85  # THESE ELEMENTS WILL BE DEPRECATED.
    86  # Please use the generated *_pb2_grpc.py files instead.
    87  import grpc
    88  from grpc.beta import implementations as beta_implementations
    89  from grpc.beta import interfaces as beta_interfaces
    90  from grpc.framework.common import cardinality
    91  from grpc.framework.interfaces.face import utilities as face_utilities
    92  
    93  
    94  class MonsterStorageStub(object):
    95    
    96    def __init__(self, channel):
    97      """Constructor.
    98      
    99      Args:
   100        channel: A grpc.Channel.
   101      """
   102      self.Store = channel.unary_unary(
   103          '/MyGame.Example.MonsterStorage/Store',
   104          
   105          
   106          )
   107      self.Retrieve = channel.unary_stream(
   108          '/MyGame.Example.MonsterStorage/Retrieve',
   109          
   110          
   111          )
   112      self.GetMaxHitPoint = channel.stream_unary(
   113          '/MyGame.Example.MonsterStorage/GetMaxHitPoint',
   114          
   115          
   116          )
   117      self.GetMinMaxHitPoints = channel.unary_unary(
   118          '/MyGame.Example.MonsterStorage/GetMinMaxHitPoints',
   119          
   120          
   121          )
   122  
   123  
   124  class MonsterStorageServicer(object):
   125    
   126    def Store(self, request, context):
   127      context.set_code(grpc.StatusCode.UNIMPLEMENTED)
   128      context.set_details('Method not implemented!')
   129      raise NotImplementedError('Method not implemented!')
   130    
   131    def Retrieve(self, request, context):
   132      context.set_code(grpc.StatusCode.UNIMPLEMENTED)
   133      context.set_details('Method not implemented!')
   134      raise NotImplementedError('Method not implemented!')
   135    
   136    def GetMaxHitPoint(self, request_iterator, context):
   137      context.set_code(grpc.StatusCode.UNIMPLEMENTED)
   138      context.set_details('Method not implemented!')
   139      raise NotImplementedError('Method not implemented!')
   140    
   141    def GetMinMaxHitPoints(self, request, context):
   142      context.set_code(grpc.StatusCode.UNIMPLEMENTED)
   143      context.set_details('Method not implemented!')
   144      raise NotImplementedError('Method not implemented!')
   145  
   146  
   147  def add_MonsterStorageServicer_to_server(servicer, server):
   148    rpc_method_handlers = {
   149        'Store': grpc.unary_unary_rpc_method_handler(
   150            servicer.Store,
   151            
   152            
   153        ),
   154        'Retrieve': grpc.unary_stream_rpc_method_handler(
   155            servicer.Retrieve,
   156            
   157            
   158        ),
   159        'GetMaxHitPoint': grpc.stream_unary_rpc_method_handler(
   160            servicer.GetMaxHitPoint,
   161            
   162            
   163        ),
   164        'GetMinMaxHitPoints': grpc.unary_unary_rpc_method_handler(
   165            servicer.GetMinMaxHitPoints,
   166            
   167            
   168        ),
   169    }
   170    generic_handler = grpc.method_handlers_generic_handler(
   171        'MyGame.Example.MonsterStorage', rpc_method_handlers)
   172    server.add_generic_rpc_handlers((generic_handler,))
   173  
   174  
   175  class BetaMonsterStorageServicer(object):
   176    """The Beta API is deprecated for 0.15.0 and later.
   177    
   178    It is recommended to use the GA API (classes and functions in this
   179    file not marked beta) for all further purposes. This class was generated
   180    only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0."""
   181    def Store(self, request, context):
   182      context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)
   183    def Retrieve(self, request, context):
   184      context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)
   185    def GetMaxHitPoint(self, request_iterator, context):
   186      context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)
   187    def GetMinMaxHitPoints(self, request, context):
   188      context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)
   189  
   190  
   191  class BetaMonsterStorageStub(object):
   192    """The Beta API is deprecated for 0.15.0 and later.
   193    
   194    It is recommended to use the GA API (classes and functions in this
   195    file not marked beta) for all further purposes. This class was generated
   196    only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0."""
   197    def Store(self, request, timeout, metadata=None, with_call=False, protocol_options=None):
   198      raise NotImplementedError()
   199    Store.future = None
   200    def Retrieve(self, request, timeout, metadata=None, with_call=False, protocol_options=None):
   201      raise NotImplementedError()
   202    def GetMaxHitPoint(self, request_iterator, timeout, metadata=None, with_call=False, protocol_options=None):
   203      raise NotImplementedError()
   204    GetMaxHitPoint.future = None
   205    def GetMinMaxHitPoints(self, request, timeout, metadata=None, with_call=False, protocol_options=None):
   206      raise NotImplementedError()
   207    GetMinMaxHitPoints.future = None
   208  
   209  
   210  def beta_create_MonsterStorage_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None):
   211    """The Beta API is deprecated for 0.15.0 and later.
   212    
   213    It is recommended to use the GA API (classes and functions in this
   214    file not marked beta) for all further purposes. This function was
   215    generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0"""
   216    method_implementations = {
   217      ('MyGame.Example.MonsterStorage', 'GetMaxHitPoint'): face_utilities.stream_unary_inline(servicer.GetMaxHitPoint),
   218      ('MyGame.Example.MonsterStorage', 'GetMinMaxHitPoints'): face_utilities.unary_unary_inline(servicer.GetMinMaxHitPoints),
   219      ('MyGame.Example.MonsterStorage', 'Retrieve'): face_utilities.unary_stream_inline(servicer.Retrieve),
   220      ('MyGame.Example.MonsterStorage', 'Store'): face_utilities.unary_unary_inline(servicer.Store),
   221    }
   222    server_options = beta_implementations.server_options(thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout)
   223    return beta_implementations.server(method_implementations, options=server_options)
   224  
   225  
   226  def beta_create_MonsterStorage_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None):
   227    """The Beta API is deprecated for 0.15.0 and later.
   228    
   229    It is recommended to use the GA API (classes and functions in this
   230    file not marked beta) for all further purposes. This function was
   231    generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0"""
   232    cardinalities = {
   233      'GetMaxHitPoint': cardinality.Cardinality.STREAM_UNARY,
   234      'GetMinMaxHitPoints': cardinality.Cardinality.UNARY_UNARY,
   235      'Retrieve': cardinality.Cardinality.UNARY_STREAM,
   236      'Store': cardinality.Cardinality.UNARY_UNARY,
   237    }
   238    stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, thread_pool=pool, thread_pool_size=pool_size)
   239    return beta_implementations.dynamic_stub(channel, 'MyGame.Example.MonsterStorage', cardinalities, options=stub_options)
   240except ImportError:
   241  pass

View as plain text