class_docstr: Shuffles / writes Examples beam collection to sharded TFRecord files.
  
  The given examples are not directly writen to the final tfrecord file, but to
  temporary files.
class_docstr_tok: ["Shuffles","\/","writes","Examples","beam","collection","to","sharded","TFRecord","files",".","The","given","examples","are","not","directly","writen","to","the","final","tfrecord","file",",","but","to","temporary","files","."]
docstr: Init BeamWriter.
  
  Note that file "{filepath_prefix}.shard_lengths.json" is also created. It
  contains a list with the number of examples in each final shard. Eg:
  "[10,11,10,11]".
  
  Args:
    serializer: class that can serialize examples.
    filename_template: template to format sharded filenames.
    hash_salt: string, the salt to use for hashing of keys.
    disable_shuffling: bool, specifies whether to shuffle the records.
    file_format: file_adapters.FileFormat, format of the record files in which
      the dataset will be read/written from.
    shard_config: the configuration for creating shards.
docstr_tok: ["Init","BeamWriter",".","Note","that","file","``","{","filepath_prefix","}",".shard_lengths.json","''","is","also","created",".","It","contains","a","list","with","the","number","of","examples","in","each","final","shard",".","Eg",":","''","[","10,11,10,11","]","''",".","Args",":","serializer",":","class","that","can","serialize","examples",".","filename_template",":","template","to","format","sharded","filenames",".","hash_salt",":","string",",","the","salt","to","use","for","hashing","of","keys",".","disable_shuffling",":","bool",",","specifies","whether","to","shuffle","the","records",".","file_format",":","file_adapters.FileFormat",",","format","of","the","record","files","in","which","the","dataset","will","be","read\/written","from",".","shard_config",":","the","configuration","for","creating","shards","."]
code: def __init__(
      self,
      serializer: example_serializer.Serializer,
      filename_template: naming.ShardedFileTemplate,
      hash_salt,
      disable_shuffling: bool,
      file_format: file_adapters.FileFormat = file_adapters.DEFAULT_FILE_FORMAT,
      shard_config: Optional[shard_utils.ShardConfig] = None,
  ):
      """Init BeamWriter.
  
      Note that file "{filepath_prefix}.shard_lengths.json" is also created. It
      contains a list with the number of examples in each final shard. Eg:
      "[10,11,10,11]".
  
      Args:
        serializer: class that can serialize examples.
        filename_template: template to format sharded filenames.
        hash_salt: string, the salt to use for hashing of keys.
        disable_shuffling: bool, specifies whether to shuffle the records.
        file_format: file_adapters.FileFormat, format of the record files in which
          the dataset will be read/written from.
        shard_config: the configuration for creating shards.
      """
      self._original_state = dict(
          serializer=serializer,
          filename_template=filename_template,
          hash_salt=hash_salt,
          disable_shuffling=disable_shuffling,
          file_format=file_format,
          shard_config=shard_config,
      )
      self._filename_template = filename_template
      self._split_info_path = (
          f"{filename_template.filepath_prefix()}.split_info.json"
      )
      self._serializer = serializer
      self._hasher = hashing.Hasher(hash_salt)
      self._split_info = None
      self._file_format = file_format
      self._disable_shuffling = disable_shuffling
      self._shard_config = shard_config or shard_utils.ShardConfig()
  
imports: import dataclasses
  import functools
  import itertools
  import json
  import os
  from typing import Any, Iterable, List, Optional, Tuple
  from absl import logging
  from etils import epath
  from tensorflow_datasets.core import example_parser
  from tensorflow_datasets.core import example_serializer
  from tensorflow_datasets.core import file_adapters
  from tensorflow_datasets.core import hashing
  from tensorflow_datasets.core import lazy_imports_lib
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import shuffle
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.utils import file_utils
  from tensorflow_datasets.core.utils import shard_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import apache_beam
label_desc: Use image node_id 1 to create a new BeamWriter object from inherited base classes: object with example: obj = BeamWriter(serializer, filename_template, hash_salt, disable_shuffling, file_format, shard_config)