File size: 817 Bytes
4943752 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
"""
SkippedAttackResult Class
============================
"""
from textattack.shared import utils
from .attack_result import AttackResult
class SkippedAttackResult(AttackResult):
"""The result of a skipped attack."""
def __init__(self, original_result):
super().__init__(original_result, original_result)
def str_lines(self, color_method=None):
lines = (
self.goal_function_result_str(color_method),
self.original_text(color_method),
)
return tuple(map(str, lines))
def goal_function_result_str(self, color_method=None):
skipped_str = utils.color_text("[SKIPPED]", "gray", color_method)
return (
self.original_result.get_colored_output(color_method)
+ " --> "
+ skipped_str
)
|