class LoadInfo(object):
def load_from_file(self, file):
with open(file) as f:
data = f.read()
self.config = json.loads(data)
def load_from_str(self, info):
if isinstance(info, dict):
self.config = info
elif isinstance(info, str):
self.config = json.loads(info)
else:
raise ValueError('Load config error')