ronantakizawa/codereview-bench huggingface dataset:
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/uugear_wittypi5_hat_plus.h (C/C++)

Code before:

// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 22
#endif

// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 4
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 5
#endif

// --- FLASH ---

#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif

// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif

// Sometimes the xosc may take longer to stabilize
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif

#endif


Review comment (suggestion):
This needs to be changed to:
```
pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (16 * 1024 * 1024))
```

Code after:

// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 22
#endif

// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 4
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 5
#endif

// --- FLASH ---
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (16 * 1024 * 1024))
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif

pico_board_cmake_set_default(PICO_RP2350_A2_SUPPORTED, 1)
#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif

// Sometimes the xosc may take longer to stabilize
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif

#endif
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/uugear_wittypi5_hat_plus.h (C/C++)

Code before:

// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 4
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 5
#endif

// --- FLASH ---

#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif

// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif

// Sometimes the xosc may take longer to stabilize
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif

#endif


Review comment (suggestion):
This needs to be changed to
```
pico_board_cmake_set_default(PICO_RP2350_A2_SUPPORTED, 1)
```

Code after:

// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 4
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 5
#endif

// --- FLASH ---
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (16 * 1024 * 1024))
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif

pico_board_cmake_set_default(PICO_RP2350_A2_SUPPORTED, 1)
#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif

// Sometimes the xosc may take longer to stabilize
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif

#endif
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/olimex_rp2350_xl.h (C/C++)

Code before:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// This header may be included by other board headers as "boards/olimex_rp2350_xl.h"

#ifndef _BOARDS_OLIMEX_PICO2_XL
#define _BOARDS_OLIMEX_PICO2_XL

pico_board_cmake_set(PICO_PLATFORM, rp2350)

// Check https://github.com/OLIMEX/RP2350-PICO2-XXL

// For board detection
#define OLIMEX_PICO2_XL

// --- RP2350 VARIANT ---
#define PICO_RP2350A 0

// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif

// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN

Review comment (suggestion):
For consistency with the filename, please change this to `_BOARDS_OLIMEX_RP2350_XL_H` (alternatively, I guess you could rename the file?)

Code after:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// This header may be included by other board headers as "boards/olimex_rp2350_xl.h"

#ifndef _BOARDS_OLIMEX_RP2350_XL_H
#define _BOARDS_OLIMEX_RP2350_XL_H

pico_board_cmake_set(PICO_PLATFORM, rp2350)

// Check https://github.com/OLIMEX/RP2350-PICO2-XXL

// For board detection
#define OLIMEX_RP2350_XL

// --- RP2350 VARIANT ---
#define PICO_RP2350A 0

// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif

// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/olimex_rp2350_xxl.h (C/C++)

Code before:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// This header may be included by other board headers as "boards/olimex_rp2350_xxl.h

#ifndef _BOARDS_OLIMEX_PICO2_XXL
#define _BOARDS_OLIMEX_PICO2_XXL

pico_board_cmake_set(PICO_PLATFORM, rp2350)

// Check https://github.com/OLIMEX/RP2350-PICO2-XXL

// For board detection
#define OLIMEX_PICO2_XXL

// --- RP2350 VARIANT ---
#define PICO_RP2350A 0

// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif


Review comment (suggestion):
Missing double-quote at the end of this line!
(plus all the same comments as for `olimex_rp2350_xl.h`)

Code after:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// This header may be included by other board headers as "boards/olimex_rp2350_xxl.h"

#ifndef _BOARDS_OLIMEX_RP2350_XXL_H
#define _BOARDS_OLIMEX_RP2350_XXL_H

pico_board_cmake_set(PICO_PLATFORM, rp2350)

// Check https://github.com/OLIMEX/RP2350-PICO2-XXL

// For board detection
#define OLIMEX_RP2350_XXL

// --- RP2350 VARIANT ---
#define PICO_RP2350A 0

// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif
Repository: raspberrypi/pico-sdk
File: src/boards/include/boards/olimex_rp2350_xl.h (C/C++)

Code before:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// This header may be included by other board headers as "boards/olimex_rp2350_xl.h"

#ifndef _BOARDS_OLIMEX_RP2350_XL
#define _BOARDS_OLIMEX_RP2350_XL

pico_board_cmake_set(PICO_PLATFORM, rp2350)

// Check https://github.com/OLIMEX/RP2350-PICO2-XXL

// For board detection
#define OLIMEX_RP2350_XL

// --- RP2350 VARIANT ---
#define PICO_RP2350A 0

// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif

// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 25

Review comment (suggestion):
Much better now, but the https://github.com/raspberrypi/pico-sdk/blob/develop/tools/check_board_header.py script is still complaining that this ought to be `_BOARDS_OLIMEX_RP2350_XL_H`

Code after:
/*
 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
//       SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// This header may be included by other board headers as "boards/olimex_rp2350_xl.h"

#ifndef _BOARDS_OLIMEX_RP2350_XL_H
#define _BOARDS_OLIMEX_RP2350_XL_H

pico_board_cmake_set(PICO_PLATFORM, rp2350)

// Check https://github.com/OLIMEX/RP2350-PICO2-XXL

// For board detection
#define OLIMEX_RP2350_XL

// --- RP2350 VARIANT ---
#define PICO_RP2350A 0

// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif

// --- LED ---
#ifndef PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_LED_PIN 25
Repository: raspberrypi/pico-sdk
File: src/host/hardware_gpio/include/hardware/gpio.h (C/C++)

Code before:
// For each bit in value,
// 1 = out
// 0 = in
void gpio_set_dir_all_bits(uint32_t value);
void gpio_set_dir_all_bits64(uint64_t values);

// Set a single GPIO to input/output.
// true = out
// 0 = in
void gpio_set_dir(uint gpio, bool out);

// Check if a specific GPIO direction is OUT
bool gpio_is_dir_out(uint gpio);

// Get a specific GPIO direction
// 1 = out
// 0 = in
uint gpio_get_dir(uint gpio);

#if PICO_SECURE
void gpio_assign_to_ns(uint gpio, bool ns);
#endif

// debugging
#ifndef PICO_DEBUG_PIN_BASE
#define PICO_DEBUG_PIN_BASE 19u
#endif

// note these two macros may only be used once per compilation unit
#define CU_REGISTER_DEBUG_PINS(p, ...)
#define CU_SELECT_DEBUG_PINS(x)
#define DEBUG_PINS_ENABLED(p) false

#define DEBUG_PINS_SET(p, v) ((void)0)
#define DEBUG_PINS_CLR(p, v) ((void)0)
#define DEBUG_PINS_XOR(p, v) ((void)0)

void gpio_debug_pins_init();

#ifdef __cplusplus
}
#endif

#endif


Review comment (bug):
For completeness, maybe you also want `PICO_DEBUG_PIN_COUNT` ?

Code after:
// For each bit in value,
// 1 = out
// 0 = in
void gpio_set_dir_all_bits(uint32_t value);
void gpio_set_dir_all_bits64(uint64_t values);

// Set a single GPIO to input/output.
// true = out
// 0 = in
void gpio_set_dir(uint gpio, bool out);

// Check if a specific GPIO direction is OUT
bool gpio_is_dir_out(uint gpio);

// Get a specific GPIO direction
// 1 = out
// 0 = in
uint gpio_get_dir(uint gpio);

#if PICO_SECURE
void gpio_assign_to_ns(uint gpio, bool ns);
#endif
extern void gpio_debug_pins_init(void);

#ifdef __cplusplus
}
#endif


// PICO_CONFIG: PICO_DEBUG_PIN_BASE, First pin to use for debug output (if enabled), min=0, max=31 on RP2350B, 29 otherwise, default=19, group=hardware_gpio
#ifndef PICO_DEBUG_PIN_BASE
#define PICO_DEBUG_PIN_BASE 19u
#endif

// PICO_CONFIG: PICO_DEBUG_PIN_COUNT, Number of pins to use for debug output (if enabled), min=1, max=32 on RP2350B, 30 otherwise, default=3, group=hardware_gpio
#ifndef PICO_DEBUG_PIN_COUNT
#define PICO_DEBUG_PIN_COUNT 3u
#endif

#ifndef __cplusplus
// note these two macros may only be used once per and only apply per compilation unit (hence the CU_)
#define CU_REGISTER_DEBUG_PINS(...) enum __unused DEBUG_PIN_TYPE { _none = 0, __VA_ARGS__ }; static enum DEBUG_PIN_TYPE __selected_debug_pins;
#define CU_SELECT_DEBUG_PINS(x) static enum DEBUG_PIN_TYPE __selected_debug_pins = (x);
#define DEBUG_PINS_ENABLED(p) (__selected_debug_pins == (p))
#else
#define CU_REGISTER_DEBUG_PINS(p...) \
    enum DEBUG_PIN_TYPE { _none = 0, p }; \
    template <enum DEBUG_PIN_TYPE> class __debug_pin_settings { \
        public: \
            static inline bool enabled() { return false; } \
    };
Repository: ray-project/ray
File: .buildkite/release-automation/verify-macos-wheels.sh (Shell)

Code before:
#!/bin/bash

set -euo pipefail

set -x

# TODO(#54047): Python 3.13 is skipped due to the bug
# we should re-enable it when the bug is fixed.
PYTHON_VERSIONS=("3.10" "3.11" "3.12" "3.14")
BAZELISK_VERSION="v1.16.0"

export USE_BAZEL_VERSION="${USE_BAZEL_VERSION:-6.5.0}"

# Sets RAY_VERSION and RAY_COMMIT
source .buildkite/release-automation/set-ray-version.sh

install_bazel() {
    URL="https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-darwin-arm64"

    TARGET="$TMP_DIR/bin/bazel"
    curl -sfL -R -o "${TARGET}" "${URL}"
    chmod +x "${TARGET}"
}

install_miniforge() {
    # Install miniforge3 based on the architecture used
    mkdir -p "$TMP_DIR/miniforge3"
    curl -sfL https://github.com/conda-forge/miniforge/releases/download/25.3.0-1/Miniforge3-25.3.0-1-MacOSX-arm64.sh -o "$TMP_DIR/miniforge3/miniforge.sh"
    bash "$TMP_DIR/miniforge3/miniforge.sh" -b -u -p "$TMP_DIR/miniforge3"
    rm -rf "$TMP_DIR/miniforge3/miniforge.sh"

    # Initialize conda. This replaces calling `conda init bash`.
    # Conda init command requires a shell restart which should not be done on BK.
    source "$TMP_DIR/miniforge3/etc/profile.d/conda.sh"

Review comment (bug):
why 3.13 is still skipping? if 3.13 is still failing, are we sure 3.14 is working?

this issue that is failing this test for python 3.13 is this: https://github.com/ray-project/ray/issues/54047

could you check manually if it works for this new python 3.14 wheel? if not, then `3.14` should not be added here.

Code after:
#!/bin/bash

set -euo pipefail

set -x

# TODO(#54047): Python 3.13 is skipped due to the bug
# we should re-enable it when the bug is fixed.

PYTHON_VERSIONS=("3.10" "3.11" "3.12")
BAZELISK_VERSION="v1.16.0"

export USE_BAZEL_VERSION="${USE_BAZEL_VERSION:-6.5.0}"

# Sets RAY_VERSION and RAY_COMMIT
source .buildkite/release-automation/set-ray-version.sh

install_bazel() {
    URL="https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-darwin-arm64"

    TARGET="$TMP_DIR/bin/bazel"
    curl -sfL -R -o "${TARGET}" "${URL}"
    chmod +x "${TARGET}"
}

install_miniforge() {
    # Install miniforge3 based on the architecture used
    mkdir -p "$TMP_DIR/miniforge3"
    curl -sfL https://github.com/conda-forge/miniforge/releases/download/25.3.0-1/Miniforge3-25.3.0-1-MacOSX-arm64.sh -o "$TMP_DIR/miniforge3/miniforge.sh"
    bash "$TMP_DIR/miniforge3/miniforge.sh" -b -u -p "$TMP_DIR/miniforge3"
    rm -rf "$TMP_DIR/miniforge3/miniforge.sh"

    # Initialize conda. This replaces calling `conda init bash`.
    # Conda init command requires a shell restart which should not be done on BK.
Repository: ray-project/ray
File: python/ray/data/_internal/execution/operators/union_operator.py (Python)

Code before:
        self._metrics.on_output_dequeued(refs)
        return refs

    def get_stats(self) -> StatsDict:
        return self._stats

    def _try_round_robin(self) -> None:
        """Try to move blocks from input buffers to output in round-robin order.

        Pulls one block from the current input, then advances to the next.
        If the current input's buffer is empty but not exhausted, stops and
        waits (blocking behavior) to maintain deterministic ordering.
        """
        num_inputs = len(self._input_buffers)

        for _ in range(num_inputs):
            buffer = self._input_buffers[self._current_input_index]

            if buffer.has_next():
                refs = buffer.get_next()
                self._metrics.on_input_dequeued(refs)
                self._output_buffer.append(refs)
                self._metrics.on_output_queued(refs)
            elif not self._input_done_flags[self._current_input_index]:
                break

            self._current_input_index = (self._current_input_index + 1) % num_inputs


Review comment (suggestion):
We can't block the scheduling loop.

Instead

 - Create a pointer at what input we're dequeuing from next
 - If there's block in that input, take it, then move the pointer to next pointer
 - If there's none, then return.
 - On the next iteration you start from the same input pointers points at (and do so until it gets an input)
 - 

Code after:
        return refs

    def get_stats(self) -> StatsDict:
        return self._stats

    def _try_round_robin(self) -> None:
        """Try to move blocks from input buffers to output in round-robin order.

        Pulls one block from the current input, then advances to the next.
        If the current input's buffer is empty but not done, we return
        without advancing to the next input so the scheduling won't be blocked.

        This ensures deterministic ordering of output blocks:
        - We iterate through inputs in a fixed order (0, 1, 2, ..., 0, 1, ...).
        - We only advance to the next input after consuming exactly one block
          from the current input (or if the current input is exhausted).
        - If an input is not ready (empty but not done), we return
          rather than skipping it, preserving the round-robin sequence.
        """
        num_inputs = len(self._input_buffers)

        while True:
            buffer = self._input_buffers[self._current_input_index]

            if buffer.has_next():
                refs = buffer.get_next()
                self._metrics.on_input_dequeued(refs)
                self._output_buffer.append(refs)
                self._metrics.on_output_queued(refs)
            elif not self._input_done_flags[self._current_input_index] or all(
                not buffer.has_next() for buffer in self._input_buffers
            ):
                return

            self._current_input_index = (self._current_input_index + 1) % num_inputs
Repository: ray-project/ray
File: python/ray/data/_internal/operator_schema_exporter.py (Python)

Code before:
"""Exporter API for Ray Data operator schema."""

import logging
import os
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, Dict, Optional

import ray
from ray._private.event.export_event_logger import (
    EventLogType,
    check_export_api_enabled,
    get_export_event_logger,
)

logger = logging.getLogger(__name__)


@dataclass(frozen=True)
class OperatorSchema:
    """Represents an Ray Data operator schema

    Attributes:
        operator_uuid: The uuid of the operator.
        schema_fields: The schema fields of the operator.
    """

    operator_uuid: str
    schema_fields: Dict[str, str]


def operator_schema_to_proto(operator_schema: OperatorSchema) -> Any:
    """Convert the operator schema to a protobuf message.

    Args:
        operator_schema: OperatorSchema object containing the schema details

    Returns:
        The protobuf message representing the operator schema.
    """

    from ray.core.generated.export_dataset_operator_schema_pb2 import (
        ExportDatasetOperatorSchema as ProtoOperatorSchema,
    )

    # Create the protobuf message

Review comment (suggestion):
```suggestion
    """Represents a Ray Data operator schema
```

Code after:
"""Exporter API for Ray Data operator schema."""

import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, Dict, Optional

import ray
from ray._private.event.export_event_logger import (
    EventLogType,
    check_export_api_enabled,
    get_export_event_logger,
)

logger = logging.getLogger(__name__)


@dataclass(frozen=True)
class OperatorSchema:
    """Represents a Ray Data operator schema

    Attributes:
        operator_uuid: The uuid of the operator.
        schema_fields: The schema fields of the operator.
    """

    operator_uuid: str
    schema_fields: Dict[str, str]  # Mapping from name to type


def operator_schema_to_proto(operator_schema: OperatorSchema) -> Any:
    """Convert the operator schema to a protobuf message.

    Args:
        operator_schema: OperatorSchema object containing the schema details

    Returns:
        The protobuf message representing the operator schema.
    """

    from ray.core.generated.export_dataset_operator_schema_pb2 import (
        ExportDatasetOperatorSchema as ProtoOperatorSchema,
    )

    # Create the protobuf message
    proto_operator_schema = ProtoOperatorSchema(