32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
#!/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)
|