Merge branch 'main' of github.com:xlang-ai/OSWorld

This commit is contained in:
yuanmengqi
2025-07-18 14:17:37 +00:00
21 changed files with 36 additions and 26 deletions

View File

@@ -459,7 +459,11 @@ def load_xlsx_styles(xlsx_file: Workbook, sheet_name: str, book_name: str, **opt
for r in fmt.rules:
active_cells: List[Cell] = []
if r.type == "expression":
condition: Callable[[str], bool] = formula_parser.ast("=" + r.formula[0])[1].compile()
try:
condition: Callable[[str], bool] = formula_parser.ast("=" + r.formula[0])[1].compile()
except:
logger.exception("Formula parsing error: %s. Skipping.", repr(r.formula[0]))
continue
logger.debug("Expression condition: %s", r.formula[0])
arguments: List[Any] = []
@@ -493,9 +497,15 @@ def load_xlsx_styles(xlsx_file: Workbook, sheet_name: str, book_name: str, **opt
if nb_contiguous_nothings>50:
break
continue
elif condition(cell_value, *arguments):
logger.debug("Active Cell %s(%s) for %s", repr(cell), str(cell_value), r.formula[0])
active_cells.append(cell)
else:
try:
satisfies_condition: bool = condition(cell_value, *arguments)
except:
logger.exception("Error in formula calculation with cell value %d", repr(cell_value))
satisfies_condition = False
if satisfies_condition:
logger.debug("Active Cell %s(%s) for %s", repr(cell), repr(cell_value), r.formula[0])
active_cells.append(cell)
else:
raise NotImplementedError("Not Implemented Condition Type: {:}".format(r.type))