def import_json_file(path, **kwargs): if not os.path.exists(path): raise Exception("Can't importFromJsonFile, file does not exist! {0}".format(path)) with open(path, 'r') as fp: data = json.load(fp, **kwargs) return core.import_dict(data)
def import_yaml_file(path, **kwargs): if not os.path.exists(path): raise Exception("Can't importFromYamlFile, file does not exist! {0}".format(path)) with open(path, 'r') as fp: data = yaml.load(fp) return core.import_dict(data)
def import_json(str_, **kwargs): data = json.loads(str_, **kwargs) return core.import_dict(data)
def import_yaml(str_, **kwargs): data = yaml.load(str_) return core.import_dict(data)