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: Deletes tmp directory and returns shard_lengths and total_size.
  
  Returns:
    List of length <number of shards> containing the number of examples stored
    in each shard, and size of the files (in bytes).
docstr_tok: ["Deletes","tmp","directory","and","returns","shard_lengths","and","total_size",".","Returns",":","List","of","length","<","number","of","shards",">","containing","the","number","of","examples","stored","in","each","shard",",","and","size","of","the","files","(","in","bytes",")","."]
code: def finalize(self) -> Tuple[List[int], int]:
      """Deletes tmp directory and returns shard_lengths and total_size.
  
      Returns:
        List of length <number of shards> containing the number of examples stored
        in each shard, and size of the files (in bytes).
      """
      if self._split_info is None:
          split_info_path = epath.Path(self._split_info_path)
          self._split_info = json.loads(split_info_path.read_bytes())
          split_info_path.unlink()
      return (
          self._split_info["shard_lengths"],
          self._split_info["total_size"],
      )
  
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 15 for calling the BeamWriter obj's underlying member method code with example usage: obj.finalize() and returns: self,  self