Generate a new Message instance from this Descriptor and a byte string. DEPRECATED: ParseMessage is deprecated because it is using MakeClass(). Please use MessageFactory.GetPrototype() instead. Args: descriptor: Protobuf Descriptor object byte_str: Serialized protocol buffer byte str
(descriptor, byte_str)
| 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(). |
nothing calls this directly
no test coverage detected