class_docstr: An attack generates adversarial examples on text.
  
  This is an abstract class that contains main helper functionality for
  attacks. An attack is comprised of a search method, goal function,
  a transformation, and a set of one or more linguistic constraints that
  successful examples must meet.
class_docstr_tok: ["An","attack","generates","adversarial","examples","on","text",".","This","is","an","abstract","class","that","contains","main","helper","functionality","for","attacks",".","An","attack","is","comprised","of","a","search","method",",","goal","function",",","a","transformation",",","and","a","set","of","one","or","more","linguistic","constraints","that","successful","examples","must","meet","."]
docstr: Calls the ``SearchMethod`` to perturb the ``AttackedText`` stored in
  ``initial_result``.
  
  :param initial_result: The initial ``GoalFunctionResult`` from which
      to perturb.
  :return: A ``SuccessfulAttackResult``, ``FailedAttackResult``,
          or ``MaximizedAttackResult``.
docstr_tok: ["Calls","the","``","SearchMethod","``","to","perturb","the","``","AttackedText","``","stored","in","``","initial_result","``",".",":","param","initial_result",":","The","initial","``","GoalFunctionResult","``","from","which","to","perturb",".",":","return",":","A","``","SuccessfulAttackResult","``",",","``","FailedAttackResult","``",",","or","``","MaximizedAttackResult","``","."]
code: def attack_one(self, initial_result):
      """
      Calls the ``SearchMethod`` to perturb the ``AttackedText`` stored in
      ``initial_result``.
  
      :param initial_result: The initial ``GoalFunctionResult`` from which
          to perturb.
      :return: A ``SuccessfulAttackResult``, ``FailedAttackResult``,
              or ``MaximizedAttackResult``.
      """
      final_result = self.search_method(initial_result)
      self.clear_cache()
      if final_result.goal_status == GoalFunctionResultStatus.SUCCEEDED:
          return SuccessfulAttackResult(
              initial_result,
              final_result,
          )
      elif (
          final_result.goal_status == GoalFunctionResultStatus.SEARCHING
      ):
          return FailedAttackResult(
              initial_result,
              final_result,
          )
      elif (
          final_result.goal_status
          == GoalFunctionResultStatus.MAXIMIZING
      ):
          return MaximizedAttackResult(
              initial_result,
              final_result,
          )
      else:
          raise ValueError(
              f"Unrecognized goal status " f"{final_result.goal_status}"
          )
  
imports: import lru
  from collections import deque
  from ...common import logger
  from textattack.attack_results import FailedAttackResult, MaximizedAttackResult, SuccessfulAttackResult
  from textattack.goal_function_results import GoalFunctionResultStatus
  from textattack.shared import AttackedText, utils
  from textattack.transformations import CompositeTransformation
label_desc: Use image node_id 8 for calling the Attack obj's underlying member method code with example usage: obj.attack_one(initial_result) and returns: SuccessfulAttackResult, FailedAttackResult, MaximizedAttackResult