class_docstr: A reference to data persisted as a directory in local or remote storage.
  
  Access the checkpoint contents locally using ``checkpoint.to_directory()``
  or ``checkpoint.as_directory``.
  
  Example creating a checkpoint using ``Checkpoint.from_directory``:
  
      >>> from ray.train import Checkpoint
      >>> checkpoint = Checkpoint.from_directory("/tmp/example_checkpoint_dir")
      >>> checkpoint.filesystem  # doctest: +ELLIPSIS
      <pyarrow._fs.LocalFileSystem object...
      >>> checkpoint.path
      '/tmp/example_checkpoint_dir'
  
  Example creating a checkpoint from a remote URI:
  
      >>> checkpoint = Checkpoint("s3://bucket/path/to/checkpoint")
      >>> checkpoint.filesystem  # doctest: +ELLIPSIS
      <pyarrow._s3fs.S3FileSystem object...
      >>> checkpoint.path
      'bucket/path/to/checkpoint'
  
  Example creating a checkpoint with a custom filesystem:
  
      >>> checkpoint = Checkpoint(
      ...     path="bucket/path/to/checkpoint",
      ...     filesystem=pyarrow.fs.S3FileSystem(),
      ... )
      >>> checkpoint.filesystem  # doctest: +ELLIPSIS
      <pyarrow._s3fs.S3FileSystem object...
      >>> checkpoint.path
      'bucket/path/to/checkpoint'
  
  Attributes:
      path: A path on the filesystem containing the checkpoint contents.
      filesystem: PyArrow FileSystem that can be used to access data at the `path`.
class_docstr_tok: ["A","reference","to","data","persisted","as","a","directory","in","local","or","remote","storage",".","Access","the","checkpoint","contents","locally","using","``","checkpoint.to_directory","(",")","``","or","``","checkpoint.as_directory","``",".","Example","creating","a","checkpoint","using","``","Checkpoint.from_directory","``",":",">",">",">","from","ray.train","import","Checkpoint",">",">",">","checkpoint","=","Checkpoint.from_directory","(","``","\/tmp\/example_checkpoint_dir","''",")",">",">",">","checkpoint.filesystem","#","doctest",":","+ELLIPSIS","<","pyarrow._fs.LocalFileSystem","object","...",">",">",">","checkpoint.path","'\/tmp\/example_checkpoint_dir'","Example","creating","a","checkpoint","from","a","remote","URI",":",">",">",">","checkpoint","=","Checkpoint","(","``","s3",":","\/\/bucket\/path\/to\/checkpoint","''",")",">",">",">","checkpoint.filesystem","#","doctest",":","+ELLIPSIS","<","pyarrow._s3fs.S3FileSystem","object","...",">",">",">","checkpoint.path","'bucket\/path\/to\/checkpoint'","Example","creating","a","checkpoint","with","a","custom","filesystem",":",">",">",">","checkpoint","=","Checkpoint","(","...","path=","''","bucket\/path\/to\/checkpoint","''",",","...","filesystem=pyarrow.fs.S3FileSystem","(",")",",","...",")",">",">",">","checkpoint.filesystem","#","doctest",":","+ELLIPSIS","<","pyarrow._s3fs.S3FileSystem","object","...",">",">",">","checkpoint.path","'bucket\/path\/to\/checkpoint'","Attributes",":","path",":","A","path","on","the","filesystem","containing","the","checkpoint","contents",".","filesystem",":","PyArrow","FileSystem","that","can","be","used","to","access","data","at","the","`","path","`","."]
docstr: Return the metadata dict stored with the checkpoint.
  
  If no metadata is stored, an empty dict is returned.
docstr_tok: ["Return","the","metadata","dict","stored","with","the","checkpoint",".","If","no","metadata","is","stored",",","an","empty","dict","is","returned","."]
code: def get_metadata(self) -> Dict[str, Any]:
      """Return the metadata dict stored with the checkpoint.
  
      If no metadata is stored, an empty dict is returned.
      """
      metadata_path = os.path.join(self.path, _METADATA_FILE_NAME)
      if not _exists_at_fs_path(self.filesystem, metadata_path):
          return {}
  
      with self.filesystem.open_input_file(metadata_path) as f:
          return json.loads(f.readall().decode("utf-8"))
  
imports: import contextlib
  import glob
  import json
  import logging
  import os
  import platform
  import shutil
  import tempfile
  import traceback
  import uuid
  from typing import Any, Dict, Iterator, List, Optional, Union
  import pyarrow.fs
  from ray.air._internal.filelock import TempFileLock
  from ray.train._internal.storage import _download_from_fs_path, _exists_at_fs_path
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 3 for calling the Checkpoint obj's underlying member method code with example usage: obj.get_metadata() and returns: dict, json