forked from LBRYCommunity/lbry-sdk
baseschema
This commit is contained in:
parent
11086b93f1
commit
550f064302
1 changed files with 15 additions and 0 deletions
15
lbrynet/schema/baseschema.py
Normal file
15
lbrynet/schema/baseschema.py
Normal 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)
|
Loading…
Reference in a new issue