baseschema

This commit is contained in:
Victor Shyba 2019-03-11 00:10:53 -03:00 committed by Lex Berezhny
parent 11086b93f1
commit 550f064302

View file

@ -0,0 +1,15 @@
import json
import google.protobuf.json_format as json_pb # pylint: disable=no-name-in-module
from google.protobuf.message import Message # pylint: disable=no-name-in-module,import-error
class Schema(Message):
@classmethod
def load(cls, message):
raise NotImplementedError
@classmethod
def _load(cls, data, message):
if isinstance(data, dict):
data = json.dumps(data)
return json_pb.Parse(data, message)