Refactor: reformat all code for lefthook using ruff and gofmt (#16585)

This commit is contained in:
Wang Qi
2026-07-03 12:53:39 +08:00
committed by GitHub
parent 19fcb4a981
commit 6a4b9be426
588 changed files with 11123 additions and 15412 deletions

View File

@@ -21,9 +21,11 @@ class LoopItemParam(ComponentParamBase):
"""
Define the LoopItem component parameters.
"""
def check(self):
return True
class LoopItem(ComponentBase, ABC):
component_name = "LoopItem"
@@ -31,7 +33,6 @@ class LoopItem(ComponentBase, ABC):
super().__init__(canvas, id, param)
self._idx = 0
def _invoke(self, **kwargs):
if self.check_if_canceled("LoopItem processing"):
return
@@ -45,7 +46,7 @@ class LoopItem(ComponentBase, ABC):
return
self._idx += 1
def evaluate_condition(self,var, operator, value):
def evaluate_condition(self, var, operator, value):
if isinstance(var, str):
if operator == "contains":
return value in var
@@ -140,11 +141,7 @@ class LoopItem(ComponentBase, ABC):
else:
raise ValueError("Invalid input mode.")
conditions.append(self.evaluate_condition(var, operator, value))
should_end = (
all(conditions) if logical_operator == "and"
else any(conditions) if logical_operator == "or"
else None
)
should_end = all(conditions) if logical_operator == "and" else any(conditions) if logical_operator == "or" else None
if should_end is None:
raise ValueError("Invalid logical operator,should be 'and' or 'or'.")
@@ -164,4 +161,4 @@ class LoopItem(ComponentBase, ABC):
return False
def thoughts(self) -> str:
return "Next turn..."
return "Next turn..."