class_docstr: Generates filenames when you write a :class:`~ray.data.Dataset`.
  
  Use this class to customize the filenames used when writing a Dataset.
  
  Some methods write each row to a separate file, while others write each block to a
  separate file. For example, :meth:`ray.data.Dataset.write_images` writes individual
  rows, and :func:`ray.data.Dataset.write_parquet` writes blocks of data. For more
  information about blocks, see :ref:`Data internals <datasets_scheduling>`.
  
  If you're writing each row to a separate file, implement
  :meth:`~FilenameProvider.get_filename_for_row`. Otherwise, implement
  :meth:`~FilenameProvider.get_filename_for_block`.
  
  Example:
  
      This snippet shows you how to encode labels in written files. For example, if
      `"cat"` is a label, you might write a file named `cat_000000_000000_000000.png`.
  
      .. testcode::
  
          import ray
          from ray.data.datasource import FilenameProvider
  
          class ImageFilenameProvider(FilenameProvider):
  
              def __init__(self, file_format: str):
                  self.file_format = file_format
  
              def get_filename_for_row(self, row, task_index, block_index, row_index):
                  return (
                      f"{row['label']}_{task_index:06}_{block_index:06}"
                      f"_{row_index:06}.{self.file_format}"
                  )
  
          ds = ray.data.read_parquet("s3://anonymous@ray-example-data/images.parquet")
          ds.write_images(
              "/tmp/results",
              column="image",
              filename_provider=ImageFilenameProvider("png")
          )
docstr: Generate a filename for a block of data.
  
  .. note::
      Filenames must be unique and deterministic for a given task and block index.
  
      A block consists of multiple rows and corresponds to a single output file.
      Each task might produce a different number of blocks.
  
  Args:
      block: The block that will be written to a file.
      task_index: The index of the the write task.
      block_index: The index of the block *within* the write task.
code: def get_filename_for_block(
      self, block: Block, task_index: int, block_index: int
  ) -> str:
      """Generate a filename for a block of data.
  
      .. note::
          Filenames must be unique and deterministic for a given task and block index.
  
          A block consists of multiple rows and corresponds to a single output file.
          Each task might produce a different number of blocks.
  
      Args:
          block: The block that will be written to a file.
          task_index: The index of the the write task.
          block_index: The index of the block *within* the write task.
      """
      raise NotImplementedError
  
file_path: ray/python/ray/data/datasource/filename_provider.py
imports: from typing import Any, Dict, Optional
  from ray.data.block import Block
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 1 for calling the FilenameProvider obj's underlying member method code with example usage: obj.get_filename_for_block(block, task_index, block_index) without return types