"""Dataset split helpers for BYOM evaluation."""

from __future__ import annotations

from typing import TYPE_CHECKING


if TYPE_CHECKING:
    from collections.abc import Sequence


def build_split_loader_map(
    requested_splits: Sequence[str],
    train_loader: object | None,
    val_loader: object | None,
    test_loader: object | None,
) -> dict[str, object]:
    """Create split->loader map while skipping missing loaders."""
    candidates = {"train": train_loader, "val": val_loader, "test": test_loader}
    return {
        split: candidates[split]
        for split in requested_splits
        if split in candidates and candidates[split] is not None
    }
