class_docstr: Class for scanning checkpoint directory and updating the checkpoint state
class_docstr_tok: ["Class","for","scanning","checkpoint","directory","and","updating","the","checkpoint","state"]
docstr: :param checkpoint_dir: path to checkpoint directory
  :param read_all: whether to scan the directory for existing checkpoints
docstr_tok: [":","param","checkpoint_dir",":","path","to","checkpoint","directory",":","param","read_all",":","whether","to","scan","the","directory","for","existing","checkpoints"]
code: def __init__(self, checkpoint_dir: str, read_all: bool = False):
      """
      :param checkpoint_dir: path to checkpoint directory
      :param read_all: whether to scan the directory for existing checkpoints
      """
      self._checkpoint_dir = checkpoint_dir
      self._checkpoint_state_file = CheckpointStateFile(checkpoint_dir)
      self._all_checkpoints = list()
      # Read checkpoint state and initialize
      state_reader = CheckpointStateReader(checkpoint_dir)
      if read_all:
          self._all_checkpoints = state_reader.get_all()
      else:
          latest = state_reader.get_latest()
          if latest is not None:
              self._all_checkpoints = [latest]
  
imports: import os
  import re
  from typing import List, Union, Tuple
label_desc: Use image node_id 1 to create a new CheckpointStateUpdater object from inherited base classes: object with example: obj = CheckpointStateUpdater(checkpoint_dir, read_all)