matlab-prodserver-client 24.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. google/__init__.py +7 -0
  2. google/protobuf_ml/__init__.py +33 -0
  3. google/protobuf_ml/descriptor.py +1230 -0
  4. google/protobuf_ml/descriptor_database.py +177 -0
  5. google/protobuf_ml/descriptor_pb2.py +1925 -0
  6. google/protobuf_ml/descriptor_pool.py +1295 -0
  7. google/protobuf_ml/internal/__init__.py +0 -0
  8. google/protobuf_ml/internal/_parameterized.py +443 -0
  9. google/protobuf_ml/internal/api_implementation.py +168 -0
  10. google/protobuf_ml/internal/builder.py +130 -0
  11. google/protobuf_ml/internal/containers.py +708 -0
  12. google/protobuf_ml/internal/decoder.py +1068 -0
  13. google/protobuf_ml/internal/descriptor_database_test.py +127 -0
  14. google/protobuf_ml/internal/descriptor_pool_test.py +1149 -0
  15. google/protobuf_ml/internal/descriptor_test.py +1076 -0
  16. google/protobuf_ml/internal/encoder.py +829 -0
  17. google/protobuf_ml/internal/enum_type_wrapper.py +124 -0
  18. google/protobuf_ml/internal/extension_dict.py +213 -0
  19. google/protobuf_ml/internal/generator_test.py +354 -0
  20. google/protobuf_ml/internal/import_test.py +49 -0
  21. google/protobuf_ml/internal/json_format_test.py +1285 -0
  22. google/protobuf_ml/internal/keywords_test.py +103 -0
  23. google/protobuf_ml/internal/message_factory_test.py +299 -0
  24. google/protobuf_ml/internal/message_listener.py +78 -0
  25. google/protobuf_ml/internal/message_test.py +2573 -0
  26. google/protobuf_ml/internal/proto_builder_test.py +106 -0
  27. google/protobuf_ml/internal/python_message.py +1539 -0
  28. google/protobuf_ml/internal/reflection_test.py +3381 -0
  29. google/protobuf_ml/internal/service_reflection_test.py +139 -0
  30. google/protobuf_ml/internal/symbol_database_test.py +133 -0
  31. google/protobuf_ml/internal/test_util.py +878 -0
  32. google/protobuf_ml/internal/testing_refleaks.py +142 -0
  33. google/protobuf_ml/internal/text_encoding_test.py +67 -0
  34. google/protobuf_ml/internal/text_format_test.py +2447 -0
  35. google/protobuf_ml/internal/type_checkers.py +435 -0
  36. google/protobuf_ml/internal/unknown_fields_test.py +461 -0
  37. google/protobuf_ml/internal/well_known_types.py +887 -0
  38. google/protobuf_ml/internal/well_known_types_test.py +1013 -0
  39. google/protobuf_ml/internal/wire_format.py +268 -0
  40. google/protobuf_ml/internal/wire_format_test.py +252 -0
  41. google/protobuf_ml/json_format.py +912 -0
  42. google/protobuf_ml/message.py +424 -0
  43. google/protobuf_ml/message_factory.py +189 -0
  44. google/protobuf_ml/proto_builder.py +134 -0
  45. google/protobuf_ml/reflection.py +95 -0
  46. google/protobuf_ml/service.py +228 -0
  47. google/protobuf_ml/service_reflection.py +295 -0
  48. google/protobuf_ml/symbol_database.py +194 -0
  49. google/protobuf_ml/text_encoding.py +110 -0
  50. google/protobuf_ml/text_format.py +1842 -0
  51. google/protobuf_ml/unknown_fields.py +120 -0
  52. matlab/__init__.py +43 -0
  53. matlab/bin/win64/libmwfoundation_matlabdata.dll +0 -0
  54. matlab/bin/win64/libmwfoundation_matlabdata_standalone.dll +0 -0
  55. matlab/extern/bin/win64/libMatlabDataArray.dll +0 -0
  56. matlab/extern/bin/win64/matlabmultidimarrayforpython.cp310-win_amd64.pyd +0 -0
  57. matlab/extern/bin/win64/matlabmultidimarrayforpython.cp39-win_amd64.pyd +0 -0
  58. matlab/extern/bin/win64/matlabmultidimarrayforpython.pyd +0 -0
  59. matlab/production_server/__init__.py +2 -0
  60. matlab/production_server/_internal_mps/__init__.py +2 -0
  61. matlab/production_server/_internal_mps/feval_handler.py +76 -0
  62. matlab/production_server/_internal_mps/invocation_handler_utils.py +52 -0
  63. matlab/production_server/_internal_mps/matlab_array_builder.py +201 -0
  64. matlab/production_server/_internal_mps/matlab_response_builder.py +134 -0
  65. matlab/production_server/_proto_generated/MATLABArray_pb2.py +129 -0
  66. matlab/production_server/_proto_generated/MATLABError_pb2.py +27 -0
  67. matlab/production_server/_proto_generated/MATLABParams_pb2.py +26 -0
  68. matlab/production_server/_proto_generated/MATLABResult_pb2.py +27 -0
  69. matlab/production_server/_proto_generated/__init__.py +0 -0
  70. matlab/production_server/client.py +140 -0
  71. matlab/production_server/mpsexceptions.py +56 -0
  72. matlab_prodserver_client-24.2.dist-info/LICENSE.txt +27 -0
  73. matlab_prodserver_client-24.2.dist-info/METADATA +94 -0
  74. matlab_prodserver_client-24.2.dist-info/RECORD +77 -0
  75. matlab_prodserver_client-24.2.dist-info/WHEEL +5 -0
  76. matlab_prodserver_client-24.2.dist-info/top_level.txt +3 -0
  77. six.py +953 -0
@@ -0,0 +1,134 @@
1
+ # Protocol Buffers - Google's data interchange format
2
+ # Copyright 2008 Google Inc. All rights reserved.
3
+ # https://developers.google.com/protocol-buffers/
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are
7
+ # met:
8
+ #
9
+ # * Redistributions of source code must retain the above copyright
10
+ # notice, this list of conditions and the following disclaimer.
11
+ # * Redistributions in binary form must reproduce the above
12
+ # copyright notice, this list of conditions and the following disclaimer
13
+ # in the documentation and/or other materials provided with the
14
+ # distribution.
15
+ # * Neither the name of Google Inc. nor the names of its
16
+ # contributors may be used to endorse or promote products derived from
17
+ # this software without specific prior written permission.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ """Dynamic Protobuf class creator."""
32
+
33
+ from collections import OrderedDict
34
+ import hashlib
35
+ import os
36
+
37
+ from google.protobuf_ml import descriptor_pb2
38
+ from google.protobuf_ml import descriptor
39
+ from google.protobuf_ml import message_factory
40
+
41
+
42
+ def _GetMessageFromFactory(factory, full_name):
43
+ """Get a proto class from the MessageFactory by name.
44
+
45
+ Args:
46
+ factory: a MessageFactory instance.
47
+ full_name: str, the fully qualified name of the proto type.
48
+ Returns:
49
+ A class, for the type identified by full_name.
50
+ Raises:
51
+ KeyError, if the proto is not found in the factory's descriptor pool.
52
+ """
53
+ proto_descriptor = factory.pool.FindMessageTypeByName(full_name)
54
+ proto_cls = factory.GetPrototype(proto_descriptor)
55
+ return proto_cls
56
+
57
+
58
+ def MakeSimpleProtoClass(fields, full_name=None, pool=None):
59
+ """Create a Protobuf class whose fields are basic types.
60
+
61
+ Note: this doesn't validate field names!
62
+
63
+ Args:
64
+ fields: dict of {name: field_type} mappings for each field in the proto. If
65
+ this is an OrderedDict the order will be maintained, otherwise the
66
+ fields will be sorted by name.
67
+ full_name: optional str, the fully-qualified name of the proto type.
68
+ pool: optional DescriptorPool instance.
69
+ Returns:
70
+ a class, the new protobuf class with a FileDescriptor.
71
+ """
72
+ factory = message_factory.MessageFactory(pool=pool)
73
+
74
+ if full_name is not None:
75
+ try:
76
+ proto_cls = _GetMessageFromFactory(factory, full_name)
77
+ return proto_cls
78
+ except KeyError:
79
+ # The factory's DescriptorPool doesn't know about this class yet.
80
+ pass
81
+
82
+ # Get a list of (name, field_type) tuples from the fields dict. If fields was
83
+ # an OrderedDict we keep the order, but otherwise we sort the field to ensure
84
+ # consistent ordering.
85
+ field_items = fields.items()
86
+ if not isinstance(fields, OrderedDict):
87
+ field_items = sorted(field_items)
88
+
89
+ # Use a consistent file name that is unlikely to conflict with any imported
90
+ # proto files.
91
+ fields_hash = hashlib.sha1()
92
+ for f_name, f_type in field_items:
93
+ fields_hash.update(f_name.encode('utf-8'))
94
+ fields_hash.update(str(f_type).encode('utf-8'))
95
+ proto_file_name = fields_hash.hexdigest() + '.proto'
96
+
97
+ # If the proto is anonymous, use the same hash to name it.
98
+ if full_name is None:
99
+ full_name = ('net.proto2.python.public.proto_builder.AnonymousProto_' +
100
+ fields_hash.hexdigest())
101
+ try:
102
+ proto_cls = _GetMessageFromFactory(factory, full_name)
103
+ return proto_cls
104
+ except KeyError:
105
+ # The factory's DescriptorPool doesn't know about this class yet.
106
+ pass
107
+
108
+ # This is the first time we see this proto: add a new descriptor to the pool.
109
+ factory.pool.Add(
110
+ _MakeFileDescriptorProto(proto_file_name, full_name, field_items))
111
+ return _GetMessageFromFactory(factory, full_name)
112
+
113
+
114
+ def _MakeFileDescriptorProto(proto_file_name, full_name, field_items):
115
+ """Populate FileDescriptorProto for MessageFactory's DescriptorPool."""
116
+ package, name = full_name.rsplit('.', 1)
117
+ file_proto = descriptor_pb2.FileDescriptorProto()
118
+ file_proto.name = os.path.join(package.replace('.', '/'), proto_file_name)
119
+ file_proto.package = package
120
+ desc_proto = file_proto.message_type.add()
121
+ desc_proto.name = name
122
+ for f_number, (f_name, f_type) in enumerate(field_items, 1):
123
+ field_proto = desc_proto.field.add()
124
+ field_proto.name = f_name
125
+ # # If the number falls in the reserved range, reassign it to the correct
126
+ # # number after the range.
127
+ if f_number >= descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER:
128
+ f_number += (
129
+ descriptor.FieldDescriptor.LAST_RESERVED_FIELD_NUMBER -
130
+ descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER + 1)
131
+ field_proto.number = f_number
132
+ field_proto.label = descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL
133
+ field_proto.type = f_type
134
+ return file_proto
@@ -0,0 +1,95 @@
1
+ # Protocol Buffers - Google's data interchange format
2
+ # Copyright 2008 Google Inc. All rights reserved.
3
+ # https://developers.google.com/protocol-buffers/
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are
7
+ # met:
8
+ #
9
+ # * Redistributions of source code must retain the above copyright
10
+ # notice, this list of conditions and the following disclaimer.
11
+ # * Redistributions in binary form must reproduce the above
12
+ # copyright notice, this list of conditions and the following disclaimer
13
+ # in the documentation and/or other materials provided with the
14
+ # distribution.
15
+ # * Neither the name of Google Inc. nor the names of its
16
+ # contributors may be used to endorse or promote products derived from
17
+ # this software without specific prior written permission.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ # This code is meant to work on Python 2.4 and above only.
32
+
33
+ """Contains a metaclass and helper functions used to create
34
+ protocol message classes from Descriptor objects at runtime.
35
+
36
+ Recall that a metaclass is the "type" of a class.
37
+ (A class is to a metaclass what an instance is to a class.)
38
+
39
+ In this case, we use the GeneratedProtocolMessageType metaclass
40
+ to inject all the useful functionality into the classes
41
+ output by the protocol compiler at compile-time.
42
+
43
+ The upshot of all this is that the real implementation
44
+ details for ALL pure-Python protocol buffers are *here in
45
+ this file*.
46
+ """
47
+
48
+ __author__ = 'robinson@google.com (Will Robinson)'
49
+
50
+
51
+ from google.protobuf_ml import message_factory
52
+ from google.protobuf_ml import symbol_database
53
+
54
+ # The type of all Message classes.
55
+ # Part of the public interface, but normally only used by message factories.
56
+ GeneratedProtocolMessageType = message_factory._GENERATED_PROTOCOL_MESSAGE_TYPE
57
+
58
+ MESSAGE_CLASS_CACHE = {}
59
+
60
+
61
+ # Deprecated. Please NEVER use reflection.ParseMessage().
62
+ def ParseMessage(descriptor, byte_str):
63
+ """Generate a new Message instance from this Descriptor and a byte string.
64
+
65
+ DEPRECATED: ParseMessage is deprecated because it is using MakeClass().
66
+ Please use MessageFactory.GetPrototype() instead.
67
+
68
+ Args:
69
+ descriptor: Protobuf Descriptor object
70
+ byte_str: Serialized protocol buffer byte string
71
+
72
+ Returns:
73
+ Newly created protobuf Message object.
74
+ """
75
+ result_class = MakeClass(descriptor)
76
+ new_msg = result_class()
77
+ new_msg.ParseFromString(byte_str)
78
+ return new_msg
79
+
80
+
81
+ # Deprecated. Please NEVER use reflection.MakeClass().
82
+ def MakeClass(descriptor):
83
+ """Construct a class object for a protobuf described by descriptor.
84
+
85
+ DEPRECATED: use MessageFactory.GetPrototype() instead.
86
+
87
+ Args:
88
+ descriptor: A descriptor.Descriptor object describing the protobuf.
89
+ Returns:
90
+ The Message class object described by the descriptor.
91
+ """
92
+ # Original implementation leads to duplicate message classes, which won't play
93
+ # well with extensions. Message factory info is also missing.
94
+ # Redirect to message_factory.
95
+ return symbol_database.Default().GetPrototype(descriptor)
@@ -0,0 +1,228 @@
1
+ # Protocol Buffers - Google's data interchange format
2
+ # Copyright 2008 Google Inc. All rights reserved.
3
+ # https://developers.google.com/protocol-buffers/
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are
7
+ # met:
8
+ #
9
+ # * Redistributions of source code must retain the above copyright
10
+ # notice, this list of conditions and the following disclaimer.
11
+ # * Redistributions in binary form must reproduce the above
12
+ # copyright notice, this list of conditions and the following disclaimer
13
+ # in the documentation and/or other materials provided with the
14
+ # distribution.
15
+ # * Neither the name of Google Inc. nor the names of its
16
+ # contributors may be used to endorse or promote products derived from
17
+ # this software without specific prior written permission.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ """DEPRECATED: Declares the RPC service interfaces.
32
+
33
+ This module declares the abstract interfaces underlying proto2 RPC
34
+ services. These are intended to be independent of any particular RPC
35
+ implementation, so that proto2 services can be used on top of a variety
36
+ of implementations. Starting with version 2.3.0, RPC implementations should
37
+ not try to build on these, but should instead provide code generator plugins
38
+ which generate code specific to the particular RPC implementation. This way
39
+ the generated code can be more appropriate for the implementation in use
40
+ and can avoid unnecessary layers of indirection.
41
+ """
42
+
43
+ __author__ = 'petar@google.com (Petar Petrov)'
44
+
45
+
46
+ class RpcException(Exception):
47
+ """Exception raised on failed blocking RPC method call."""
48
+ pass
49
+
50
+
51
+ class Service(object):
52
+
53
+ """Abstract base interface for protocol-buffer-based RPC services.
54
+
55
+ Services themselves are abstract classes (implemented either by servers or as
56
+ stubs), but they subclass this base interface. The methods of this
57
+ interface can be used to call the methods of the service without knowing
58
+ its exact type at compile time (analogous to the Message interface).
59
+ """
60
+
61
+ def GetDescriptor():
62
+ """Retrieves this service's descriptor."""
63
+ raise NotImplementedError
64
+
65
+ def CallMethod(self, method_descriptor, rpc_controller,
66
+ request, done):
67
+ """Calls a method of the service specified by method_descriptor.
68
+
69
+ If "done" is None then the call is blocking and the response
70
+ message will be returned directly. Otherwise the call is asynchronous
71
+ and "done" will later be called with the response value.
72
+
73
+ In the blocking case, RpcException will be raised on error.
74
+
75
+ Preconditions:
76
+
77
+ * method_descriptor.service == GetDescriptor
78
+ * request is of the exact same classes as returned by
79
+ GetRequestClass(method).
80
+ * After the call has started, the request must not be modified.
81
+ * "rpc_controller" is of the correct type for the RPC implementation being
82
+ used by this Service. For stubs, the "correct type" depends on the
83
+ RpcChannel which the stub is using.
84
+
85
+ Postconditions:
86
+
87
+ * "done" will be called when the method is complete. This may be
88
+ before CallMethod() returns or it may be at some point in the future.
89
+ * If the RPC failed, the response value passed to "done" will be None.
90
+ Further details about the failure can be found by querying the
91
+ RpcController.
92
+ """
93
+ raise NotImplementedError
94
+
95
+ def GetRequestClass(self, method_descriptor):
96
+ """Returns the class of the request message for the specified method.
97
+
98
+ CallMethod() requires that the request is of a particular subclass of
99
+ Message. GetRequestClass() gets the default instance of this required
100
+ type.
101
+
102
+ Example:
103
+ method = service.GetDescriptor().FindMethodByName("Foo")
104
+ request = stub.GetRequestClass(method)()
105
+ request.ParseFromString(input)
106
+ service.CallMethod(method, request, callback)
107
+ """
108
+ raise NotImplementedError
109
+
110
+ def GetResponseClass(self, method_descriptor):
111
+ """Returns the class of the response message for the specified method.
112
+
113
+ This method isn't really needed, as the RpcChannel's CallMethod constructs
114
+ the response protocol message. It's provided anyway in case it is useful
115
+ for the caller to know the response type in advance.
116
+ """
117
+ raise NotImplementedError
118
+
119
+
120
+ class RpcController(object):
121
+
122
+ """An RpcController mediates a single method call.
123
+
124
+ The primary purpose of the controller is to provide a way to manipulate
125
+ settings specific to the RPC implementation and to find out about RPC-level
126
+ errors. The methods provided by the RpcController interface are intended
127
+ to be a "least common denominator" set of features which we expect all
128
+ implementations to support. Specific implementations may provide more
129
+ advanced features (e.g. deadline propagation).
130
+ """
131
+
132
+ # Client-side methods below
133
+
134
+ def Reset(self):
135
+ """Resets the RpcController to its initial state.
136
+
137
+ After the RpcController has been reset, it may be reused in
138
+ a new call. Must not be called while an RPC is in progress.
139
+ """
140
+ raise NotImplementedError
141
+
142
+ def Failed(self):
143
+ """Returns true if the call failed.
144
+
145
+ After a call has finished, returns true if the call failed. The possible
146
+ reasons for failure depend on the RPC implementation. Failed() must not
147
+ be called before a call has finished. If Failed() returns true, the
148
+ contents of the response message are undefined.
149
+ """
150
+ raise NotImplementedError
151
+
152
+ def ErrorText(self):
153
+ """If Failed is true, returns a human-readable description of the error."""
154
+ raise NotImplementedError
155
+
156
+ def StartCancel(self):
157
+ """Initiate cancellation.
158
+
159
+ Advises the RPC system that the caller desires that the RPC call be
160
+ canceled. The RPC system may cancel it immediately, may wait awhile and
161
+ then cancel it, or may not even cancel the call at all. If the call is
162
+ canceled, the "done" callback will still be called and the RpcController
163
+ will indicate that the call failed at that time.
164
+ """
165
+ raise NotImplementedError
166
+
167
+ # Server-side methods below
168
+
169
+ def SetFailed(self, reason):
170
+ """Sets a failure reason.
171
+
172
+ Causes Failed() to return true on the client side. "reason" will be
173
+ incorporated into the message returned by ErrorText(). If you find
174
+ you need to return machine-readable information about failures, you
175
+ should incorporate it into your response protocol buffer and should
176
+ NOT call SetFailed().
177
+ """
178
+ raise NotImplementedError
179
+
180
+ def IsCanceled(self):
181
+ """Checks if the client cancelled the RPC.
182
+
183
+ If true, indicates that the client canceled the RPC, so the server may
184
+ as well give up on replying to it. The server should still call the
185
+ final "done" callback.
186
+ """
187
+ raise NotImplementedError
188
+
189
+ def NotifyOnCancel(self, callback):
190
+ """Sets a callback to invoke on cancel.
191
+
192
+ Asks that the given callback be called when the RPC is canceled. The
193
+ callback will always be called exactly once. If the RPC completes without
194
+ being canceled, the callback will be called after completion. If the RPC
195
+ has already been canceled when NotifyOnCancel() is called, the callback
196
+ will be called immediately.
197
+
198
+ NotifyOnCancel() must be called no more than once per request.
199
+ """
200
+ raise NotImplementedError
201
+
202
+
203
+ class RpcChannel(object):
204
+
205
+ """Abstract interface for an RPC channel.
206
+
207
+ An RpcChannel represents a communication line to a service which can be used
208
+ to call that service's methods. The service may be running on another
209
+ machine. Normally, you should not use an RpcChannel directly, but instead
210
+ construct a stub {@link Service} wrapping it. Example:
211
+
212
+ Example:
213
+ RpcChannel channel = rpcImpl.Channel("remotehost.example.com:1234")
214
+ RpcController controller = rpcImpl.Controller()
215
+ MyService service = MyService_Stub(channel)
216
+ service.MyMethod(controller, request, callback)
217
+ """
218
+
219
+ def CallMethod(self, method_descriptor, rpc_controller,
220
+ request, response_class, done):
221
+ """Calls the method identified by the descriptor.
222
+
223
+ Call the given method of the remote service. The signature of this
224
+ procedure looks the same as Service.CallMethod(), but the requirements
225
+ are less strict in one important way: the request object doesn't have to
226
+ be of any specific class as long as its descriptor is method.input_type.
227
+ """
228
+ raise NotImplementedError