• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2"""Client and server classes corresponding to protobuf-defined services."""
3import grpc
4import warnings
5
6import helloworld_pb2 as helloworld__pb2
7
8GRPC_GENERATED_VERSION = '1.64.0'
9GRPC_VERSION = grpc.__version__
10EXPECTED_ERROR_RELEASE = '1.65.0'
11SCHEDULED_RELEASE_DATE = 'June 25, 2024'
12_version_not_supported = False
13
14try:
15    from grpc._utilities import first_version_is_lower
16    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
17except ImportError:
18    _version_not_supported = True
19
20if _version_not_supported:
21    warnings.warn(
22        f'The grpc package installed is at version {GRPC_VERSION},'
23        + f' but the generated code in helloworld_pb2_grpc.py depends on'
24        + f' grpcio>={GRPC_GENERATED_VERSION}.'
25        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
26        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
27        + f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
28        + f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
29        RuntimeWarning
30    )
31
32
33class GreeterStub(object):
34    """The greeting service definition.
35    """
36
37    def __init__(self, channel):
38        """Constructor.
39
40        Args:
41            channel: A grpc.Channel.
42        """
43        self.SayHello = channel.unary_unary(
44                '/helloworld.Greeter/SayHello',
45                request_serializer=helloworld__pb2.HelloRequest.SerializeToString,
46                response_deserializer=helloworld__pb2.HelloReply.FromString,
47                _registered_method=True)
48        self.SayHelloStreamReply = channel.unary_stream(
49                '/helloworld.Greeter/SayHelloStreamReply',
50                request_serializer=helloworld__pb2.HelloRequest.SerializeToString,
51                response_deserializer=helloworld__pb2.HelloReply.FromString,
52                _registered_method=True)
53        self.SayHelloBidiStream = channel.stream_stream(
54                '/helloworld.Greeter/SayHelloBidiStream',
55                request_serializer=helloworld__pb2.HelloRequest.SerializeToString,
56                response_deserializer=helloworld__pb2.HelloReply.FromString,
57                _registered_method=True)
58
59
60class GreeterServicer(object):
61    """The greeting service definition.
62    """
63
64    def SayHello(self, request, context):
65        """Sends a greeting
66        """
67        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
68        context.set_details('Method not implemented!')
69        raise NotImplementedError('Method not implemented!')
70
71    def SayHelloStreamReply(self, request, context):
72        """Missing associated documentation comment in .proto file."""
73        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
74        context.set_details('Method not implemented!')
75        raise NotImplementedError('Method not implemented!')
76
77    def SayHelloBidiStream(self, request_iterator, context):
78        """Missing associated documentation comment in .proto file."""
79        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
80        context.set_details('Method not implemented!')
81        raise NotImplementedError('Method not implemented!')
82
83
84def add_GreeterServicer_to_server(servicer, server):
85    rpc_method_handlers = {
86            'SayHello': grpc.unary_unary_rpc_method_handler(
87                    servicer.SayHello,
88                    request_deserializer=helloworld__pb2.HelloRequest.FromString,
89                    response_serializer=helloworld__pb2.HelloReply.SerializeToString,
90            ),
91            'SayHelloStreamReply': grpc.unary_stream_rpc_method_handler(
92                    servicer.SayHelloStreamReply,
93                    request_deserializer=helloworld__pb2.HelloRequest.FromString,
94                    response_serializer=helloworld__pb2.HelloReply.SerializeToString,
95            ),
96            'SayHelloBidiStream': grpc.stream_stream_rpc_method_handler(
97                    servicer.SayHelloBidiStream,
98                    request_deserializer=helloworld__pb2.HelloRequest.FromString,
99                    response_serializer=helloworld__pb2.HelloReply.SerializeToString,
100            ),
101    }
102    generic_handler = grpc.method_handlers_generic_handler(
103            'helloworld.Greeter', rpc_method_handlers)
104    server.add_generic_rpc_handlers((generic_handler,))
105    server.add_registered_method_handlers('helloworld.Greeter', rpc_method_handlers)
106
107
108 # This class is part of an EXPERIMENTAL API.
109class Greeter(object):
110    """The greeting service definition.
111    """
112
113    @staticmethod
114    def SayHello(request,
115            target,
116            options=(),
117            channel_credentials=None,
118            call_credentials=None,
119            insecure=False,
120            compression=None,
121            wait_for_ready=None,
122            timeout=None,
123            metadata=None):
124        return grpc.experimental.unary_unary(
125            request,
126            target,
127            '/helloworld.Greeter/SayHello',
128            helloworld__pb2.HelloRequest.SerializeToString,
129            helloworld__pb2.HelloReply.FromString,
130            options,
131            channel_credentials,
132            insecure,
133            call_credentials,
134            compression,
135            wait_for_ready,
136            timeout,
137            metadata,
138            _registered_method=True)
139
140    @staticmethod
141    def SayHelloStreamReply(request,
142            target,
143            options=(),
144            channel_credentials=None,
145            call_credentials=None,
146            insecure=False,
147            compression=None,
148            wait_for_ready=None,
149            timeout=None,
150            metadata=None):
151        return grpc.experimental.unary_stream(
152            request,
153            target,
154            '/helloworld.Greeter/SayHelloStreamReply',
155            helloworld__pb2.HelloRequest.SerializeToString,
156            helloworld__pb2.HelloReply.FromString,
157            options,
158            channel_credentials,
159            insecure,
160            call_credentials,
161            compression,
162            wait_for_ready,
163            timeout,
164            metadata,
165            _registered_method=True)
166
167    @staticmethod
168    def SayHelloBidiStream(request_iterator,
169            target,
170            options=(),
171            channel_credentials=None,
172            call_credentials=None,
173            insecure=False,
174            compression=None,
175            wait_for_ready=None,
176            timeout=None,
177            metadata=None):
178        return grpc.experimental.stream_stream(
179            request_iterator,
180            target,
181            '/helloworld.Greeter/SayHelloBidiStream',
182            helloworld__pb2.HelloRequest.SerializeToString,
183            helloworld__pb2.HelloReply.FromString,
184            options,
185            channel_credentials,
186            insecure,
187            call_credentials,
188            compression,
189            wait_for_ready,
190            timeout,
191            metadata,
192            _registered_method=True)
193