refactor: add string validation for feedback attrs and remove unused var (#1035)

This commit is contained in:
you-n-g
2025-07-08 20:24:31 +08:00
committed by GitHub
parent 3f9c1afea8
commit e0ba3b0eee
2 changed files with 4 additions and 1 deletions
@@ -70,6 +70,10 @@ class CoSTEERSingleFeedback(Feedback):
if not isinstance(data["final_decision"], bool):
raise ValueError(f"'final_decision' must be a boolean, not {type(data['final_decision'])}")
for attr in "execution", "return_checking", "code":
if data[attr] is not None and not isinstance(data[attr], str):
raise ValueError(f"'{attr}' must be a string, not {type(data[attr])}")
return data
def __str__(self) -> str:
@@ -62,7 +62,6 @@ class PipelineCoSTEEREvaluator(CoSTEEREvaluator):
result = implementation.run(env=env, entry=f"python -m coverage run main.py --debug")
else:
result = implementation.run(env=env, entry=f"python -m coverage run main.py")
execute_ret_code = result.exit_code
result.stdout = remove_eda_part(result.stdout)
if result.exit_code != 0:
stdout += f"Code failed to run. Please check the stdout:\n Following the stdout of the debug mode run:\n{result.stdout.strip()}\n"