ver Feb19thv4
corrected a series of sheetcopilot task configs
This commit is contained in:
31
clear_sheetcopilot_jsons.py
Normal file
31
clear_sheetcopilot_jsons.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import json
|
||||
import shutil
|
||||
import os
|
||||
import os.path
|
||||
from typing import Dict, List
|
||||
from typing import Any
|
||||
|
||||
path = "evaluation_examples/examples/sheetcopilot"
|
||||
for f in filter(lambda f: f.endswith(".json"), os.listdir(path)):
|
||||
with open(os.path.join(path, f)) as f_obj:
|
||||
config: Dict[str, Any] = json.load(f_obj)
|
||||
|
||||
options: List[Dict[str, Any]] = []
|
||||
deletes = False
|
||||
for opt in config["evaluator"]["options"]["rules"]:
|
||||
if opt["type"] == "style" and opt["props"] == [ "font_name", "font_color"
|
||||
, "font_bold", "font_italic"
|
||||
, "font_underline", "bgcolor"
|
||||
]:
|
||||
deletes = True
|
||||
continue
|
||||
else:
|
||||
options.append(opt)
|
||||
|
||||
if deletes:
|
||||
config["evaluator"]["options"]["rules"] = options
|
||||
shutil.move(os.path.join(path, f), os.path.join(path, f + ".old"))
|
||||
with open(os.path.join(path, f), "w") as f_obj:
|
||||
json.dump(config, f_obj, indent="\t", ensure_ascii=False)
|
||||
Reference in New Issue
Block a user