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: Tries to read the checkpoint state file. If that fails, discovers latest by reading the entire directory.
  :return: checkpoint object representing the latest checkpoint
docstr_tok: ["Tries","to","read","the","checkpoint","state","file",".","If","that","fails",",","discovers","latest","by","reading","the","entire","directory",".",":","return",":","checkpoint","object","representing","the","latest","checkpoint"]
code: def get_latest(self) -> SingleCheckpoint:
      """
      Tries to read the checkpoint state file. If that fails, discovers latest by reading the entire directory.
      :return: checkpoint object representing the latest checkpoint
      """
      latest = self._checkpoint_state_file.read()
      if latest is None and self._checkpoint_state_optional:
          all_checkpoints = _filter_checkpoint_files(
              os.listdir(self._checkpoint_dir)
          )
          if len(all_checkpoints) > 0:
              latest = all_checkpoints[-1]
      return latest
  
imports: import os
  import re
  from typing import List, Union, Tuple
label_desc: Use image node_id 2 for calling the CheckpointStateReader obj's underlying member method code with example usage: obj.get_latest() and returns: latest