def get_path_line_number(self, path, with_attrs=False):
path = path.split("| ")[1] if (with_attrs is True) else path
orig = self.parsed
path = get_dict_from_path(path, self.separator)
res = traverse_and_remove_path(orig, path)
orig = json.dumps(orig, indent=4).split("\n")
if(len(orig) != self.file_line_number):
raise ValueError("This json file formatting is not compatible. Please run `python -m json.tool file`")
with_del = json.dumps(res, indent=4).split("\n")
return(list_compare_idx(orig, with_del) + 1)
评论列表
文章目录