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: Reads both the checkpoint state file as well as contents of the directory and merges them into one list.
  :return: list of checkpoint objects
docstr_tok: ["Reads","both","the","checkpoint","state","file","as","well","as","contents","of","the","directory","and","merges","them","into","one","list",".",":","return",":","list","of","checkpoint","objects"]
code: def get_all(self) -> List[SingleCheckpoint]:
      """
      Reads both the checkpoint state file as well as contents of the directory and merges them into one list.
      :return: list of checkpoint objects
      """
      # discover all checkpoint files in directory if requested or if a valid checkpoint-state file doesn't exist
      all_checkpoints = _filter_checkpoint_files(
          os.listdir(self._checkpoint_dir)
      )
      last_checkpoint = self._checkpoint_state_file.read()
      if last_checkpoint is not None:
          # remove excess checkpoints: higher checkpoint number, but not recent (e.g. from a previous run)
          all_checkpoints = all_checkpoints[
              : all_checkpoints.index(last_checkpoint) + 1
          ]
      elif not self._checkpoint_state_optional:
          # if last_checkpoint is not discovered from the checkpoint-state file and it isn't optional, then
          # all checkpoint files discovered must be partial or invalid, so don't return anything
          all_checkpoints.clear()
      return all_checkpoints
  
imports: import os
  import re
  from typing import List, Union, Tuple
label_desc: Use image node_id 3 for calling the CheckpointStateReader obj's underlying member method code with example usage: obj.get_all() and returns: all_checkpoints