Skip to content

Instantly share code, notes, and snippets.

@ladyrick
Created April 17, 2019 16:53
Show Gist options
  • Save ladyrick/8935cf6c4f4519faccca2d76cdb94a86 to your computer and use it in GitHub Desktop.
Save ladyrick/8935cf6c4f4519faccca2d76cdb94a86 to your computer and use it in GitHub Desktop.
from google.protobuf import text_format
def ParseFromBinary(bytestr, message):
message.ParseFromString(bytestr)
def ParseFromText(string, message):
text_format.Merge(string, message)
def SerializeToBinary(message):
return message.SerializeToString()
def SerializeToText(message):
return text_format.MessageToString(message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment