class_docstr: A Splitter that can be composed with other splitters.
  
  This Splitter writes to the riegeli file format.
  
  See README for details.
class_docstr_tok: ["A","Splitter","that","can","be","composed","with","other","splitters",".","This","Splitter","writes","to","the","riegeli","file","format",".","See","README","for","details","."]
docstr: Fixes chunk indices in the ChunkedMessage.
docstr_tok: ["Fixes","chunk","indices","in","the","ChunkedMessage","."]
code: def _fix_chunks(self) -> None:
      """Fixes chunk indices in the ChunkedMessage."""
      if not self._fix_chunk_order:
          return
  
      # The chunk_index of each nested ChunkedMessage is set to the length of the
      # list when the chunk was added. This would be fine if the chunks were
      # always added to the end of the list. However, this is not always the case
      # the indices must be updated.
  
      # Use the address of each chunk (python `id`) as lookup keys to the
      # ordered chunk indices.
      chunk_indices = {
          id(chunk): i for i, chunk in enumerate(self._chunks)
      }
  
      to_fix = [self._chunked_message]
      while to_fix:
          for field in to_fix.pop().chunked_fields:
              if field.message.chunked_fields:
                  to_fix.append(field.message)
              if not field.message.HasField("chunk_index"):
                  continue
              chunk_addr = self._add_chunk_order[
                  field.message.chunk_index
              ]
              assert (
                  chunk_addr in chunk_indices
              ), f"Found unexpected chunk {chunk_addr}"
              new_chunk_index = chunk_indices[chunk_addr]
              field.message.chunk_index = new_chunk_index
  
      self._add_chunk_order = [id(chunk) for chunk in self._chunks]
      self._fix_chunk_order = False
  
imports: import abc
  from collections.abc import Sequence
  import time
  from typing import Optional, Union
  from absl import logging
  import riegeli
  from google.protobuf import message
  from tensorflow.python.lib.io import file_io
  from tensorflow.tools.proto_splitter import chunk_pb2
  from tensorflow.tools.proto_splitter import util
  from tensorflow.tools.proto_splitter import version
  from tensorflow.tools.proto_splitter import versions_pb2
label_desc: Use image node_id 7 for calling the ComposableSplitter obj's underlying member method code with example usage: obj._fix_chunks() without return types