Python google.protobuf.reflection.MakeClass() Examples
The following are 24
code examples of google.protobuf.reflection.MakeClass().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
google.protobuf.reflection
, or try the search function
.
Example #1
Source File: reflection_test.py From coremltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
def testMakeClassWithNestedDescriptor(self): leaf_desc = descriptor.Descriptor('leaf', 'package.parent.child.leaf', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) child_desc = descriptor.Descriptor('child', 'package.parent.child', '', containing_type=None, fields=[], nested_types=[leaf_desc], enum_types=[], extensions=[]) sibling_desc = descriptor.Descriptor('sibling', 'package.parent.sibling', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) parent_desc = descriptor.Descriptor('parent', 'package.parent', '', containing_type=None, fields=[], nested_types=[child_desc, sibling_desc], enum_types=[], extensions=[]) message_class = reflection.MakeClass(parent_desc) self.assertIn('child', message_class.__dict__) self.assertIn('sibling', message_class.__dict__) self.assertIn('leaf', message_class.child.__dict__)
Example #2
Source File: reflection_test.py From keras-lambda with MIT License | 6 votes |
def testParsingNestedClass(self): """Test that the generated class can parse a nested message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('C')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'bar {' ' baz {' ' deep: 4' ' }' '}') text_format.Merge(msg_str, msg) self.assertEqual(msg.bar.baz.deep, 4)
Example #3
Source File: reflection_test.py From keras-lambda with MIT License | 6 votes |
def testMakeClassWithNestedDescriptor(self): leaf_desc = descriptor.Descriptor('leaf', 'package.parent.child.leaf', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) child_desc = descriptor.Descriptor('child', 'package.parent.child', '', containing_type=None, fields=[], nested_types=[leaf_desc], enum_types=[], extensions=[]) sibling_desc = descriptor.Descriptor('sibling', 'package.parent.sibling', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) parent_desc = descriptor.Descriptor('parent', 'package.parent', '', containing_type=None, fields=[], nested_types=[child_desc, sibling_desc], enum_types=[], extensions=[]) message_class = reflection.MakeClass(parent_desc) self.assertIn('child', message_class.__dict__) self.assertIn('sibling', message_class.__dict__) self.assertIn('leaf', message_class.child.__dict__)
Example #4
Source File: reflection_test.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
def testParsingNestedClass(self): """Test that the generated class can parse a nested message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('C')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'bar {' ' baz {' ' deep: 4' ' }' '}') text_format.Merge(msg_str, msg) self.assertEqual(msg.bar.baz.deep, 4)
Example #5
Source File: reflection_test.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 6 votes |
def testMakeClassWithNestedDescriptor(self): leaf_desc = descriptor.Descriptor('leaf', 'package.parent.child.leaf', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) child_desc = descriptor.Descriptor('child', 'package.parent.child', '', containing_type=None, fields=[], nested_types=[leaf_desc], enum_types=[], extensions=[]) sibling_desc = descriptor.Descriptor('sibling', 'package.parent.sibling', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) parent_desc = descriptor.Descriptor('parent', 'package.parent', '', containing_type=None, fields=[], nested_types=[child_desc, sibling_desc], enum_types=[], extensions=[]) message_class = reflection.MakeClass(parent_desc) self.assertIn('child', message_class.__dict__) self.assertIn('sibling', message_class.__dict__) self.assertIn('leaf', message_class.child.__dict__)
Example #6
Source File: reflection_test.py From go2mapillary with GNU General Public License v3.0 | 6 votes |
def testParsingNestedClass(self): """Test that the generated class can parse a nested message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('C')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'bar {' ' baz {' ' deep: 4' ' }' '}') text_format.Merge(msg_str, msg) self.assertEqual(msg.bar.baz.deep, 4)
Example #7
Source File: reflection_test.py From go2mapillary with GNU General Public License v3.0 | 6 votes |
def testMakeClassWithNestedDescriptor(self): leaf_desc = descriptor.Descriptor('leaf', 'package.parent.child.leaf', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) child_desc = descriptor.Descriptor('child', 'package.parent.child', '', containing_type=None, fields=[], nested_types=[leaf_desc], enum_types=[], extensions=[]) sibling_desc = descriptor.Descriptor('sibling', 'package.parent.sibling', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) parent_desc = descriptor.Descriptor('parent', 'package.parent', '', containing_type=None, fields=[], nested_types=[child_desc, sibling_desc], enum_types=[], extensions=[]) message_class = reflection.MakeClass(parent_desc) self.assertIn('child', message_class.__dict__) self.assertIn('sibling', message_class.__dict__) self.assertIn('leaf', message_class.child.__dict__)
Example #8
Source File: reflection_test.py From coremltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
def testParsingNestedClass(self): """Test that the generated class can parse a nested message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('C')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'bar {' ' baz {' ' deep: 4' ' }' '}') text_format.Merge(msg_str, msg) self.assertEqual(msg.bar.baz.deep, 4)
Example #9
Source File: reflection_test.py From lambda-packs with MIT License | 6 votes |
def testMakeClassWithNestedDescriptor(self): leaf_desc = descriptor.Descriptor('leaf', 'package.parent.child.leaf', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) child_desc = descriptor.Descriptor('child', 'package.parent.child', '', containing_type=None, fields=[], nested_types=[leaf_desc], enum_types=[], extensions=[]) sibling_desc = descriptor.Descriptor('sibling', 'package.parent.sibling', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) parent_desc = descriptor.Descriptor('parent', 'package.parent', '', containing_type=None, fields=[], nested_types=[child_desc, sibling_desc], enum_types=[], extensions=[]) message_class = reflection.MakeClass(parent_desc) self.assertIn('child', message_class.__dict__) self.assertIn('sibling', message_class.__dict__) self.assertIn('leaf', message_class.child.__dict__)
Example #10
Source File: reflection_test.py From botchallenge with MIT License | 6 votes |
def testParsingNestedClass(self): """Test that the generated class can parse a nested message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('C')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'bar {' ' baz {' ' deep: 4' ' }' '}') text_format.Merge(msg_str, msg) self.assertEqual(msg.bar.baz.deep, 4)
Example #11
Source File: reflection_test.py From botchallenge with MIT License | 6 votes |
def testMakeClassWithNestedDescriptor(self): leaf_desc = descriptor.Descriptor('leaf', 'package.parent.child.leaf', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) child_desc = descriptor.Descriptor('child', 'package.parent.child', '', containing_type=None, fields=[], nested_types=[leaf_desc], enum_types=[], extensions=[]) sibling_desc = descriptor.Descriptor('sibling', 'package.parent.sibling', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) parent_desc = descriptor.Descriptor('parent', 'package.parent', '', containing_type=None, fields=[], nested_types=[child_desc, sibling_desc], enum_types=[], extensions=[]) message_class = reflection.MakeClass(parent_desc) self.assertIn('child', message_class.__dict__) self.assertIn('sibling', message_class.__dict__) self.assertIn('leaf', message_class.child.__dict__)
Example #12
Source File: reflection_test.py From sklearn-theano with BSD 3-Clause "New" or "Revised" License | 6 votes |
def testParsingNestedClass(self): """Test that the generated class can parse a nested message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('C')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'bar {' ' baz {' ' deep: 4' ' }' '}') text_format.Merge(msg_str, msg) self.assertEqual(msg.bar.baz.deep, 4)
Example #13
Source File: reflection_test.py From sklearn-theano with BSD 3-Clause "New" or "Revised" License | 6 votes |
def testMakeClassWithNestedDescriptor(self): leaf_desc = descriptor.Descriptor('leaf', 'package.parent.child.leaf', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) child_desc = descriptor.Descriptor('child', 'package.parent.child', '', containing_type=None, fields=[], nested_types=[leaf_desc], enum_types=[], extensions=[]) sibling_desc = descriptor.Descriptor('sibling', 'package.parent.sibling', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) parent_desc = descriptor.Descriptor('parent', 'package.parent', '', containing_type=None, fields=[], nested_types=[child_desc, sibling_desc], enum_types=[], extensions=[]) message_class = reflection.MakeClass(parent_desc) self.assertIn('child', message_class.__dict__) self.assertIn('sibling', message_class.__dict__) self.assertIn('leaf', message_class.child.__dict__)
Example #14
Source File: reflection_test.py From auto-alt-text-lambda-api with MIT License | 6 votes |
def testParsingNestedClass(self): """Test that the generated class can parse a nested message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('C')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'bar {' ' baz {' ' deep: 4' ' }' '}') text_format.Merge(msg_str, msg) self.assertEqual(msg.bar.baz.deep, 4)
Example #15
Source File: reflection_test.py From auto-alt-text-lambda-api with MIT License | 6 votes |
def testMakeClassWithNestedDescriptor(self): leaf_desc = descriptor.Descriptor('leaf', 'package.parent.child.leaf', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) child_desc = descriptor.Descriptor('child', 'package.parent.child', '', containing_type=None, fields=[], nested_types=[leaf_desc], enum_types=[], extensions=[]) sibling_desc = descriptor.Descriptor('sibling', 'package.parent.sibling', '', containing_type=None, fields=[], nested_types=[], enum_types=[], extensions=[]) parent_desc = descriptor.Descriptor('parent', 'package.parent', '', containing_type=None, fields=[], nested_types=[child_desc, sibling_desc], enum_types=[], extensions=[]) message_class = reflection.MakeClass(parent_desc) self.assertIn('child', message_class.__dict__) self.assertIn('sibling', message_class.__dict__) self.assertIn('leaf', message_class.child.__dict__)
Example #16
Source File: reflection_test.py From lambda-packs with MIT License | 6 votes |
def testParsingNestedClass(self): """Test that the generated class can parse a nested message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('C')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'bar {' ' baz {' ' deep: 4' ' }' '}') text_format.Merge(msg_str, msg) self.assertEqual(msg.bar.baz.deep, 4)
Example #17
Source File: reflection_test.py From botchallenge with MIT License | 5 votes |
def testParsingFlatClass(self): """Test that the generated class can parse a flat message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('B')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'flat: 0 ' 'flat: 1 ' 'flat: 2 ') text_format.Merge(msg_str, msg) self.assertEqual(msg.flat, [0, 1, 2])
Example #18
Source File: reflection_test.py From coremltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
def testParsingFlatClass(self): """Test that the generated class can parse a flat message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('B')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'flat: 0 ' 'flat: 1 ' 'flat: 2 ') text_format.Merge(msg_str, msg) self.assertEqual(msg.flat, [0, 1, 2])
Example #19
Source File: reflection_test.py From sklearn-theano with BSD 3-Clause "New" or "Revised" License | 5 votes |
def testParsingFlatClass(self): """Test that the generated class can parse a flat message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('B')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'flat: 0 ' 'flat: 1 ' 'flat: 2 ') text_format.Merge(msg_str, msg) self.assertEqual(msg.flat, [0, 1, 2])
Example #20
Source File: reflection_test.py From go2mapillary with GNU General Public License v3.0 | 5 votes |
def testParsingFlatClass(self): """Test that the generated class can parse a flat message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('B')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'flat: 0 ' 'flat: 1 ' 'flat: 2 ') text_format.Merge(msg_str, msg) self.assertEqual(msg.flat, [0, 1, 2])
Example #21
Source File: reflection_test.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def testParsingFlatClass(self): """Test that the generated class can parse a flat message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('B')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'flat: 0 ' 'flat: 1 ' 'flat: 2 ') text_format.Merge(msg_str, msg) self.assertEqual(msg.flat, [0, 1, 2])
Example #22
Source File: reflection_test.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def testParsingFlatClass(self): """Test that the generated class can parse a flat message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('B')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'flat: 0 ' 'flat: 1 ' 'flat: 2 ') text_format.Merge(msg_str, msg) self.assertEqual(msg.flat, [0, 1, 2])
Example #23
Source File: reflection_test.py From keras-lambda with MIT License | 5 votes |
def testParsingFlatClass(self): """Test that the generated class can parse a flat message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('B')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'flat: 0 ' 'flat: 1 ' 'flat: 2 ') text_format.Merge(msg_str, msg) self.assertEqual(msg.flat, [0, 1, 2])
Example #24
Source File: reflection_test.py From lambda-packs with MIT License | 5 votes |
def testParsingFlatClass(self): """Test that the generated class can parse a flat message.""" file_descriptor = descriptor_pb2.FileDescriptorProto() file_descriptor.ParseFromString(self._GetSerializedFileDescriptor('B')) msg_descriptor = descriptor.MakeDescriptor( file_descriptor.message_type[0]) msg_class = reflection.MakeClass(msg_descriptor) msg = msg_class() msg_str = ( 'flat: 0 ' 'flat: 1 ' 'flat: 2 ') text_format.Merge(msg_str, msg) self.assertEqual(msg.flat, [0, 1, 2])