MCPcopy Index your code
hub / github.com/QData/TextAttack / FailedAttackResult

Class FailedAttackResult

textattack/attack_results/failed_attack_result.py:12–30  ·  view source on GitHub ↗

The result of a failed attack.

Source from the content-addressed store, hash-verified

10
11
12class FailedAttackResult(AttackResult):
13 """The result of a failed attack."""
14
15 def __init__(self, original_result, perturbed_result=None):
16 perturbed_result = perturbed_result or original_result
17 super().__init__(original_result, perturbed_result)
18
19 def str_lines(self, color_method=None):
20 lines = (
21 self.goal_function_result_str(color_method),
22 self.original_text(color_method),
23 )
24 return tuple(map(str, lines))
25
26 def goal_function_result_str(self, color_method=None):
27 failed_str = utils.color_text("[FAILED]", "red", color_method)
28 return (
29 self.original_result.get_colored_output(color_method) + " --> " + failed_str
30 )

Callers 1

_attackMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected