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,139 @@
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
+ """Tests for google.protobuf_ml.internal.service_reflection."""
32
+
33
+ __author__ = 'petar@google.com (Petar Petrov)'
34
+
35
+
36
+ import unittest
37
+
38
+ from google.protobuf_ml import unittest_pb2
39
+ from google.protobuf_ml import service_reflection
40
+ from google.protobuf_ml import service
41
+
42
+
43
+ class FooUnitTest(unittest.TestCase):
44
+
45
+ def testService(self):
46
+ class MockRpcChannel(service.RpcChannel):
47
+ def CallMethod(self, method, controller, request, response, callback):
48
+ self.method = method
49
+ self.controller = controller
50
+ self.request = request
51
+ callback(response)
52
+
53
+ class MockRpcController(service.RpcController):
54
+ def SetFailed(self, msg):
55
+ self.failure_message = msg
56
+
57
+ self.callback_response = None
58
+
59
+ class MyService(unittest_pb2.TestService):
60
+ pass
61
+
62
+ self.callback_response = None
63
+
64
+ def MyCallback(response):
65
+ self.callback_response = response
66
+
67
+ rpc_controller = MockRpcController()
68
+ channel = MockRpcChannel()
69
+ srvc = MyService()
70
+ srvc.Foo(rpc_controller, unittest_pb2.FooRequest(), MyCallback)
71
+ self.assertEqual('Method Foo not implemented.',
72
+ rpc_controller.failure_message)
73
+ self.assertEqual(None, self.callback_response)
74
+
75
+ rpc_controller.failure_message = None
76
+
77
+ service_descriptor = unittest_pb2.TestService.GetDescriptor()
78
+ srvc.CallMethod(service_descriptor.methods[1], rpc_controller,
79
+ unittest_pb2.BarRequest(), MyCallback)
80
+ self.assertTrue(srvc.GetRequestClass(service_descriptor.methods[1]) is
81
+ unittest_pb2.BarRequest)
82
+ self.assertTrue(srvc.GetResponseClass(service_descriptor.methods[1]) is
83
+ unittest_pb2.BarResponse)
84
+ self.assertEqual('Method Bar not implemented.',
85
+ rpc_controller.failure_message)
86
+ self.assertEqual(None, self.callback_response)
87
+
88
+ class MyServiceImpl(unittest_pb2.TestService):
89
+ def Foo(self, rpc_controller, request, done):
90
+ self.foo_called = True
91
+ def Bar(self, rpc_controller, request, done):
92
+ self.bar_called = True
93
+
94
+ srvc = MyServiceImpl()
95
+ rpc_controller.failure_message = None
96
+ srvc.Foo(rpc_controller, unittest_pb2.FooRequest(), MyCallback)
97
+ self.assertEqual(None, rpc_controller.failure_message)
98
+ self.assertEqual(True, srvc.foo_called)
99
+
100
+ rpc_controller.failure_message = None
101
+ srvc.CallMethod(service_descriptor.methods[1], rpc_controller,
102
+ unittest_pb2.BarRequest(), MyCallback)
103
+ self.assertEqual(None, rpc_controller.failure_message)
104
+ self.assertEqual(True, srvc.bar_called)
105
+
106
+ def testServiceStub(self):
107
+ class MockRpcChannel(service.RpcChannel):
108
+ def CallMethod(self, method, controller, request,
109
+ response_class, callback):
110
+ self.method = method
111
+ self.controller = controller
112
+ self.request = request
113
+ callback(response_class())
114
+
115
+ self.callback_response = None
116
+
117
+ def MyCallback(response):
118
+ self.callback_response = response
119
+
120
+ channel = MockRpcChannel()
121
+ stub = unittest_pb2.TestService_Stub(channel)
122
+ rpc_controller = 'controller'
123
+ request = 'request'
124
+
125
+ # GetDescriptor now static, still works as instance method for compatibility
126
+ self.assertEqual(unittest_pb2.TestService_Stub.GetDescriptor(),
127
+ stub.GetDescriptor())
128
+
129
+ # Invoke method.
130
+ stub.Foo(rpc_controller, request, MyCallback)
131
+
132
+ self.assertIsInstance(self.callback_response, unittest_pb2.FooResponse)
133
+ self.assertEqual(request, channel.request)
134
+ self.assertEqual(rpc_controller, channel.controller)
135
+ self.assertEqual(stub.GetDescriptor().methods[0], channel.method)
136
+
137
+
138
+ if __name__ == '__main__':
139
+ unittest.main()
@@ -0,0 +1,133 @@
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
+ """Tests for google.protobuf_ml.symbol_database."""
32
+
33
+ import unittest
34
+
35
+ from google.protobuf_ml import unittest_pb2
36
+ from google.protobuf_ml import descriptor
37
+ from google.protobuf_ml import descriptor_pool
38
+ from google.protobuf_ml import symbol_database
39
+
40
+
41
+ class SymbolDatabaseTest(unittest.TestCase):
42
+
43
+ def _Database(self):
44
+ if descriptor._USE_C_DESCRIPTORS:
45
+ # The C++ implementation does not allow mixing descriptors from
46
+ # different pools.
47
+ db = symbol_database.SymbolDatabase(pool=descriptor_pool.Default())
48
+ else:
49
+ db = symbol_database.SymbolDatabase()
50
+ # Register representative types from unittest_pb2.
51
+ db.RegisterFileDescriptor(unittest_pb2.DESCRIPTOR)
52
+ db.RegisterMessage(unittest_pb2.TestAllTypes)
53
+ db.RegisterMessage(unittest_pb2.TestAllTypes.NestedMessage)
54
+ db.RegisterMessage(unittest_pb2.TestAllTypes.OptionalGroup)
55
+ db.RegisterMessage(unittest_pb2.TestAllTypes.RepeatedGroup)
56
+ db.RegisterEnumDescriptor(unittest_pb2.ForeignEnum.DESCRIPTOR)
57
+ db.RegisterEnumDescriptor(unittest_pb2.TestAllTypes.NestedEnum.DESCRIPTOR)
58
+ db.RegisterServiceDescriptor(unittest_pb2._TESTSERVICE)
59
+ return db
60
+
61
+ def testGetPrototype(self):
62
+ instance = self._Database().GetPrototype(
63
+ unittest_pb2.TestAllTypes.DESCRIPTOR)
64
+ self.assertTrue(instance is unittest_pb2.TestAllTypes)
65
+
66
+ def testGetMessages(self):
67
+ messages = self._Database().GetMessages(
68
+ ['google/protobuf_ml/unittest.proto'])
69
+ self.assertTrue(
70
+ unittest_pb2.TestAllTypes is
71
+ messages['protobuf_unittest.TestAllTypes'])
72
+
73
+ def testGetSymbol(self):
74
+ self.assertEqual(
75
+ unittest_pb2.TestAllTypes, self._Database().GetSymbol(
76
+ 'protobuf_unittest.TestAllTypes'))
77
+ self.assertEqual(
78
+ unittest_pb2.TestAllTypes.NestedMessage, self._Database().GetSymbol(
79
+ 'protobuf_unittest.TestAllTypes.NestedMessage'))
80
+ self.assertEqual(
81
+ unittest_pb2.TestAllTypes.OptionalGroup, self._Database().GetSymbol(
82
+ 'protobuf_unittest.TestAllTypes.OptionalGroup'))
83
+ self.assertEqual(
84
+ unittest_pb2.TestAllTypes.RepeatedGroup, self._Database().GetSymbol(
85
+ 'protobuf_unittest.TestAllTypes.RepeatedGroup'))
86
+
87
+ def testEnums(self):
88
+ # Check registration of types in the pool.
89
+ self.assertEqual(
90
+ 'protobuf_unittest.ForeignEnum',
91
+ self._Database().pool.FindEnumTypeByName(
92
+ 'protobuf_unittest.ForeignEnum').full_name)
93
+ self.assertEqual(
94
+ 'protobuf_unittest.TestAllTypes.NestedEnum',
95
+ self._Database().pool.FindEnumTypeByName(
96
+ 'protobuf_unittest.TestAllTypes.NestedEnum').full_name)
97
+
98
+ def testFindMessageTypeByName(self):
99
+ self.assertEqual(
100
+ 'protobuf_unittest.TestAllTypes',
101
+ self._Database().pool.FindMessageTypeByName(
102
+ 'protobuf_unittest.TestAllTypes').full_name)
103
+ self.assertEqual(
104
+ 'protobuf_unittest.TestAllTypes.NestedMessage',
105
+ self._Database().pool.FindMessageTypeByName(
106
+ 'protobuf_unittest.TestAllTypes.NestedMessage').full_name)
107
+
108
+ def testFindServiceByName(self):
109
+ self.assertEqual(
110
+ 'protobuf_unittest.TestService',
111
+ self._Database().pool.FindServiceByName(
112
+ 'protobuf_unittest.TestService').full_name)
113
+
114
+ def testFindFileContainingSymbol(self):
115
+ # Lookup based on either enum or message.
116
+ self.assertEqual(
117
+ 'google/protobuf_ml/unittest.proto',
118
+ self._Database().pool.FindFileContainingSymbol(
119
+ 'protobuf_unittest.TestAllTypes.NestedEnum').name)
120
+ self.assertEqual(
121
+ 'google/protobuf_ml/unittest.proto',
122
+ self._Database().pool.FindFileContainingSymbol(
123
+ 'protobuf_unittest.TestAllTypes').name)
124
+
125
+ def testFindFileByName(self):
126
+ self.assertEqual(
127
+ 'google/protobuf_ml/unittest.proto',
128
+ self._Database().pool.FindFileByName(
129
+ 'google/protobuf_ml/unittest.proto').name)
130
+
131
+
132
+ if __name__ == '__main__':
133
+ unittest.main()