• 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.63.0.dev0'
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
106
107 # This class is part of an EXPERIMENTAL API.
108class Greeter(object):
109    """The greeting service definition.
110    """
111
112    @staticmethod
113    def SayHello(request,
114            target,
115            options=(),
116            channel_credentials=None,
117            call_credentials=None,
118            insecure=False,
119            compression=None,
120            wait_for_ready=None,
121            timeout=None,
122            metadata=None):
123        return grpc.experimental.unary_unary(
124            request,
125            target,
126            '/helloworld.Greeter/SayHello',
127            helloworld__pb2.HelloRequest.SerializeToString,
128            helloworld__pb2.HelloReply.FromString,
129            options,
130            channel_credentials,
131            insecure,
132            call_credentials,
133            compression,
134            wait_for_ready,
135            timeout,
136            metadata,
137            _registered_method=True)
138
139    @staticmethod
140    def SayHelloStreamReply(request,
141            target,
142            options=(),
143            channel_credentials=None,
144            call_credentials=None,
145            insecure=False,
146            compression=None,
147            wait_for_ready=None,
148            timeout=None,
149            metadata=None):
150        return grpc.experimental.unary_stream(
151            request,
152            target,
153            '/helloworld.Greeter/SayHelloStreamReply',
154            helloworld__pb2.HelloRequest.SerializeToString,
155            helloworld__pb2.HelloReply.FromString,
156            options,
157            channel_credentials,
158            insecure,
159            call_credentials,
160            compression,
161            wait_for_ready,
162            timeout,
163            metadata,
164            _registered_method=True)
165
166    @staticmethod
167    def SayHelloBidiStream(request_iterator,
168            target,
169            options=(),
170            channel_credentials=None,
171            call_credentials=None,
172            insecure=False,
173            compression=None,
174            wait_for_ready=None,
175            timeout=None,
176            metadata=None):
177        return grpc.experimental.stream_stream(
178            request_iterator,
179            target,
180            '/helloworld.Greeter/SayHelloBidiStream',
181            helloworld__pb2.HelloRequest.SerializeToString,
182            helloworld__pb2.HelloReply.FromString,
183            options,
184            channel_credentials,
185            insecure,
186            call_credentials,
187            compression,
188            wait_for_ready,
189            timeout,
190            metadata,
191            _registered_method=True)
192