def _TearDown(self):
    """Performs operations to clean things up after performing diagnostics."""
    if not self.teardown_completed:
      temp_file_dict.clear()

      try:
        for fpath in self.temporary_files:
          os.remove(fpath)
        if self.delete_directory:
          os.rmdir(self.directory)
      except __HOLE__:
        pass

      if self.threads > 1 or self.processes > 1:
        args = [obj for obj in self.temporary_objects]
        self.Apply(_DeleteWrapper, args, _PerfdiagExceptionHandler,
                   arg_checker=DummyArgChecker,
                   parallel_operations_override=True,
                   process_count=self.processes, thread_count=self.threads)
      else:
        for object_name in self.temporary_objects:
          self.Delete(object_name, self.gsutil_api)
    self.teardown_completed = True
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/commands/perfdiag.py/PerfDiagCommand._TearDown