class_docstr: Class which generates and stores classification batches.
  
  Each classification batch contains result of the classification of one
  batch of adversarial images.
class_docstr_tok: ["Class","which","generates","and","stores","classification","batches",".","Each","classification","batch","contains","result","of","the","classification","of","one","batch","of","adversarial","images","."]
docstr: Populates data from adversarial batches and writes to datastore.
  
  Args:
    submissions: instance of CompetitionSubmissions
    adv_batches: instance of AversarialBatches
docstr_tok: ["Populates","data","from","adversarial","batches","and","writes","to","datastore",".","Args",":","submissions",":","instance","of","CompetitionSubmissions","adv_batches",":","instance","of","AversarialBatches"]
code: def init_from_adversarial_batches_write_to_datastore(
      self, submissions, adv_batches
  ):
      """Populates data from adversarial batches and writes to datastore.
  
      Args:
        submissions: instance of CompetitionSubmissions
        adv_batches: instance of AversarialBatches
      """
      # prepare classification batches
      idx = 0
      for s_id in iterkeys(submissions.defenses):
          for adv_id in iterkeys(adv_batches.data):
              class_batch_id = CLASSIFICATION_BATCH_ID_PATTERN.format(
                  idx
              )
              idx += 1
              self.data[class_batch_id] = {
                  "adversarial_batch_id": adv_id,
                  "submission_id": s_id,
                  "result_path": os.path.join(
                      self._round_name,
                      CLASSIFICATION_BATCHES_SUBDIR,
                      s_id + "_" + adv_id + ".csv",
                  ),
              }
      # save them to datastore
      client = self._datastore_client
      with client.no_transact_batch() as batch:
          for key, value in iteritems(self.data):
              entity = client.entity(
                  client.key(KIND_CLASSIFICATION_BATCH, key)
              )
              entity.update(value)
              batch.put(entity)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import csv
  from io import BytesIO
  from io import StringIO
  import logging
  import os
  import pickle
  import time
  from six import iteritems
  from six import iterkeys
  from six import itervalues
  from six import PY3
label_desc: Use image node_id 6 for calling the ClassificationBatches obj's underlying member method code with example usage: obj.init_from_adversarial_batches_write_to_datastore(submissions, adv_batches) without return types