class_docstr: CacheFilesWriter class to write the cached files.
class_docstr_tok: ["CacheFilesWriter","class","to","write","the","cached","files","."]
docstr: Writes TFRecord and metadata files.
  
  Args:
    tfrecord_cache_files: TFRecordCacheFiles object including a list of
      TFRecord files and the meta data yaml file to save the metadata
      including data size and label_map.
    *args: Non-keyword of parameters used in the `_get_example` method.
    **kwargs: Keyword parameters used in the `_get_example` method.
docstr_tok: ["Writes","TFRecord","and","metadata","files",".","Args",":","tfrecord_cache_files",":","TFRecordCacheFiles","object","including","a","list","of","TFRecord","files","and","the","meta","data","yaml","file","to","save","the","metadata","including","data","size","and","label_map",".","*","args",":","Non-keyword","of","parameters","used","in","the","`","_get_example","`","method",".","*","*","kwargs",":","Keyword","parameters","used","in","the","`","_get_example","`","method","."]
code: def write_files(
      self,
      tfrecord_cache_files: cache_files.TFRecordCacheFiles,
      *args,
      **kwargs,
  ) -> None:
      """Writes TFRecord and metadata files.
  
      Args:
        tfrecord_cache_files: TFRecordCacheFiles object including a list of
          TFRecord files and the meta data yaml file to save the metadata
          including data size and label_map.
        *args: Non-keyword of parameters used in the `_get_example` method.
        **kwargs: Keyword parameters used in the `_get_example` method.
      """
      writers = tfrecord_cache_files.get_writers()
  
      # Writes tf.Example into TFRecord files.
      size = 0
      for idx, tf_example in enumerate(
          self._get_example(*args, **kwargs)
      ):
          if self.max_num_images and idx >= self.max_num_images:
              break
          if idx % 100 == 0:
              tf.compat.v1.logging.info("On image %d" % idx)
          writers[idx % len(writers)].write(
              tf_example.SerializeToString()
          )
          size = idx + 1
  
      for writer in writers:
          writer.close()
  
      # Writes metadata into metadata_file.
      metadata = {"size": size, "label_map": self.label_map}
      tfrecord_cache_files.save_metadata(metadata)
  
imports: import abc
  import collections
  import hashlib
  import json
  import math
  import os
  import tempfile
  from typing import Any, Dict, List, Mapping, Optional
  import xml.etree.ElementTree
  import tensorflow
  from mediapipe.model_maker.python.core.data import cache_files
  from official.vision.data import tfrecord_lib
label_desc: Use image node_id 2 for calling the CacheFilesWriter obj's underlying member method code with example usage: obj.write_files(tfrecord_cache_files) without return types