class_docstr: Base class for file writer.
  
  FileWriter consumes a DataSource and generates benchmark data as described
  in the DataSource. DataSource contains benchmark data metadata such as value
  generators, total number of records, and number of partitioned files.
  
  SubClass must implement `_write_to_path` function to write data under the
  given path and follow the spec described in DataSource.
class_docstr_tok: ["Base","class","for","file","writer",".","FileWriter","consumes","a","DataSource","and","generates","benchmark","data","as","described","in","the","DataSource",".","DataSource","contains","benchmark","data","metadata","such","as","value","generators",",","total","number","of","records",",","and","number","of","partitioned","files",".","SubClass","must","implement","`","_write_to_path","`","function","to","write","data","under","the","given","path","and","follow","the","spec","described","in","DataSource","."]
docstr: Returns a dict mapping filenames to the number of records in that file.
  
  Args:
    data_source: A DataSource describing the data to be written.
  
  Returns:
    A dict mapping filename to number of records in that file.
docstr_tok: ["Returns","a","dict","mapping","filenames","to","the","number","of","records","in","that","file",".","Args",":","data_source",":","A","DataSource","describing","the","data","to","be","written",".","Returns",":","A","dict","mapping","filename","to","number","of","records","in","that","file","."]
code: def _get_filenames_to_num_records(self, data_source):
      """Returns a dict mapping filenames to the number of records in that file.
  
      Args:
        data_source: A DataSource describing the data to be written.
  
      Returns:
        A dict mapping filename to number of records in that file.
      """
      filenames_to_num_records = {}
      partitions = data_source.partitions
      record_per_partition = data_source.num_records // partitions
      remaining = data_source.num_records % partitions
  
      partition_length = len(str(partitions))
      for file_index in range(partitions):
          # Add leading zero to index_name e.g. 0001
          index_name = str(file_index).zfill(partition_length)
          filename = f"part-{index_name}.{self.extension}"
  
          num_records = record_per_partition
          if remaining and file_index < remaining:
              num_records = num_records + 1
          filenames_to_num_records[filename] = num_records
      return filenames_to_num_records
  
file_path: io/tests/test_atds_avro/utils/file_writer.py
imports: import abc
  import os
  import shutil
  import hashlib
  import tempfile
  import tensorflow
label_desc: Use image node_id 9 for calling the FileWriter obj's underlying member method code with example usage: obj._get_filenames_to_num_records(data_source) and returns: filenames_to_num_records