@@ -81,8 +81,8 @@ def __init__(
8181 constraints : List [Union [Constraint , PreTransformationConstraint ]],
8282 transformation : Transformation ,
8383 search_method : SearchMethod ,
84- transformation_cache_size = 2 ** 15 ,
85- constraint_cache_size = 2 ** 15 ,
84+ transformation_cache_size = 2 ** 15 ,
85+ constraint_cache_size = 2 ** 15 ,
8686 ):
8787 """Initialize an attack object.
8888
@@ -371,22 +371,23 @@ def _attack(self, initial_result):
371371 final_result = self .search_method (initial_result )
372372 self .clear_cache ()
373373 if final_result .goal_status == GoalFunctionResultStatus .SUCCEEDED :
374- return SuccessfulAttackResult (
374+ result = SuccessfulAttackResult (
375375 initial_result ,
376376 final_result ,
377377 )
378378 elif final_result .goal_status == GoalFunctionResultStatus .SEARCHING :
379- return FailedAttackResult (
379+ result = FailedAttackResult (
380380 initial_result ,
381381 final_result ,
382382 )
383383 elif final_result .goal_status == GoalFunctionResultStatus .MAXIMIZING :
384- return MaximizedAttackResult (
384+ result = MaximizedAttackResult (
385385 initial_result ,
386386 final_result ,
387387 )
388388 else :
389389 raise ValueError (f"Unrecognized goal status { final_result .goal_status } " )
390+ return result
390391
391392 def attack (self , example , ground_truth_output ):
392393 """Attack a single example.
0 commit comments