docstr: Calculates all metrics related to number of succesful, failed and
  skipped results in an attack.
  
  Args:
      results (``AttackResult`` objects):
          Attack results for each instance in dataset
code: def calculate(self, results):
      """Calculates all metrics related to number of succesful, failed and
      skipped results in an attack.
  
      Args:
          results (``AttackResult`` objects):
              Attack results for each instance in dataset
      """
      self.results = results
      self.total_attacks = len(self.results)
  
      for i, result in enumerate(self.results):
          if isinstance(result, FailedAttackResult):
              self.failed_attacks += 1
              continue
          elif isinstance(result, SkippedAttackResult):
              self.skipped_attacks += 1
              continue
          else:
              self.successful_attacks += 1
  
      # Calculated numbers
      self.all_metrics["successful_attacks"] = self.successful_attacks
      self.all_metrics["failed_attacks"] = self.failed_attacks
      self.all_metrics["skipped_attacks"] = self.skipped_attacks
  
      # Percentages wrt the calculations
      self.all_metrics[
          "original_accuracy"
      ] = self.original_accuracy_perc()
      self.all_metrics[
          "attack_accuracy_perc"
      ] = self.attack_accuracy_perc()
      self.all_metrics[
          "attack_success_rate"
      ] = self.attack_success_rate_perc()
  
      return self.all_metrics
  
file_path: TextAttack/textattack/metrics/attack_metrics/attack_success_rate.py
imports: from textattack.attack_results import FailedAttackResult, SkippedAttackResult
  from textattack.metrics import Metric
label_desc: Use image node_id 2 for calling the AttackSuccessRate obj's underlying member method code with example usage: obj.calculate(results) and returns: self