From 99971b0796e164b1e77b514022c0a4349d4d5127 Mon Sep 17 00:00:00 2001 From: Balaji Veeramani Date: Mon, 10 Nov 2025 17:39:14 -0800 Subject: [PATCH] [Data] Convert rST-style to Google-style docstrings in ray.data This change improves documentation consistency by converting rST-style docstrings (:param:, :return:) to Google-style format (Args:, Returns:) in the python/ray/data module. Signed-off-by: Balaji Veeramani --- .../datasource/delta_sharing_datasource.py | 8 ++++++-- python/ray/data/block.py | 16 ++++++++++------ python/ray/data/preprocessors/encoder.py | 11 +++++++---- python/ray/data/preprocessors/utils.py | 11 ++++++----- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/python/ray/data/_internal/datasource/delta_sharing_datasource.py b/python/ray/data/_internal/datasource/delta_sharing_datasource.py index de7dcaecbf36..1a6914e5606d 100644 --- a/python/ray/data/_internal/datasource/delta_sharing_datasource.py +++ b/python/ray/data/_internal/datasource/delta_sharing_datasource.py @@ -49,8 +49,12 @@ def setup_delta_sharing_connections(self, url: str): """ Set up delta sharing connections based on the url. - :param url: a url under the format "#.." - : + Args: + url: A URL under the format "#..
" + + Returns: + A tuple of (table, rest_client) where table is a delta_sharing Table + object and rest_client is a DataSharingRestClient instance. """ from delta_sharing.protocol import DeltaSharingProfile, Table from delta_sharing.rest_client import DataSharingRestClient diff --git a/python/ray/data/block.py b/python/ray/data/block.py index ef118265c560..cdc83c9fc205 100644 --- a/python/ray/data/block.py +++ b/python/ray/data/block.py @@ -703,8 +703,9 @@ def hash(self) -> BlockColumn: Internally, Polars is used to compute row-level hashes even when the original column is backed by Pandas or PyArrow. - :return: A column of 64-bit integer hashes, returned in the same format as the underlying backend - (e.g., Pandas Series or PyArrow Array). + Returns: + A column of 64-bit integer hashes, returned in the same format as the + underlying backend (e.g., Pandas Series or PyArrow Array). """ raise NotImplementedError() @@ -720,10 +721,13 @@ def is_composed_of_lists(self, types: Optional[Tuple] = None) -> bool: """ Checks whether the column is composed of list-like elements. - :param types: Optional tuple of backend-specific types to check against. - If not provided, defaults to list-like types appropriate - for the underlying backend (e.g., PyArrow list types). - :return: True if the column is made up of list-like values; False otherwise. + Args: + types: Optional tuple of backend-specific types to check against. + If not provided, defaults to list-like types appropriate + for the underlying backend (e.g., PyArrow list types). + + Returns: + True if the column is made up of list-like values; False otherwise. """ raise NotImplementedError() diff --git a/python/ray/data/preprocessors/encoder.py b/python/ray/data/preprocessors/encoder.py index f065ca9a24be..aea249209876 100644 --- a/python/ray/data/preprocessors/encoder.py +++ b/python/ray/data/preprocessors/encoder.py @@ -789,10 +789,13 @@ def unique_post_fn(drop_na_values: bool = False) -> Callable[[Set], Dict[str, in Returns a post-processing function that generates an encoding map by sorting the unique values produced during aggregation or stats computation. - :param drop_na_values: If True, NA/null values will be silently dropped from the encoding map. - If False, raises an error if any NA/null values are present. - :return: A callable that takes a set of unique values and returns a dictionary - mapping each value to a unique integer index. + Args: + drop_na_values: If True, NA/null values will be silently dropped from the + encoding map. If False, raises an error if any NA/null values are present. + + Returns: + A callable that takes a set of unique values and returns a dictionary + mapping each value to a unique integer index. """ def gen_value_index(values: Set) -> Dict[str, int]: diff --git a/python/ray/data/preprocessors/utils.py b/python/ray/data/preprocessors/utils.py index 40e8d19c5c54..6d2212062361 100644 --- a/python/ray/data/preprocessors/utils.py +++ b/python/ray/data/preprocessors/utils.py @@ -134,11 +134,12 @@ def add_callable_stat( This supports legacy use cases where arbitrary callables are needed and cannot be run via Dataset.aggregate(). - :param post_key_fn: - :param stat_fn: A zero-argument callable that returns the stat. - :param post_process_fn: Function to apply to the result. - :param columns: - :param stat_key_fn: + Args: + stat_fn: A zero-argument callable that returns the stat. + post_process_fn: Function to apply to the result. + stat_key_fn: + post_key_fn: + columns: """ self._aggregators.append( CallableStatSpec(