Repository: huggingface/datasets
File: src/datasets/load.py (Python)

Code before:
def infer_module_for_data_files(
    data_files: DataFilesDict, path: Optional[str] = None, download_config: Optional[DownloadConfig] = None
) -> Tuple[Optional[str], Dict[str, Any]]:
    """Infer module (and builder kwargs) from data files. Raise if module names for different splits don't match.

    Args:
        data_files ([`DataFilesDict`]): Dict of list of data files.
        path (str, *optional*): Dataset name or path.
        download_config ([`DownloadConfig`], *optional*):
            Specific download configuration parameters to authenticate on the Hugging Face Hub for private remote files.

    Returns:
        tuple[str, dict[str, Any]]: Tuple with
            - inferred module name
            - builder kwargs
    """
    split_modules = {
        split: infer_module_for_data_files_list(data_files_list, download_config=download_config)
        for split, data_files_list in data_files.items()
    }
    module_name, default_builder_kwargs = next(iter(split_modules.values()))
    if any((module_name, default_builder_kwargs) != split_module for split_module in split_modules.values()):
        raise ValueError(f"Couldn't infer the same data file format for all splits. Got {split_modules}")
    if not module_name:
        path = f" in {path}. " if path else ". "
        raise DataFilesNotFoundError(f"No (supported) data files or dataset script found{path}")
    return module_name, default_builder_kwargs


def update_hash_with_config_parameters(hash: str, config_parameters: dict) -> str:
    """
    Used to update hash of packaged modules which is used for creating unique cache directories to reflect
    different config parameters which are passed in metadata from readme.
    """
    params_to_exclude = {"config_name", "version", "description"}
    params_to_add_to_hash = {
        param: value for param, value in sorted(config_parameters.items()) if param not in params_to_exclude
    }
    m = Hasher()
    m.update(hash)
    m.update(params_to_add_to_hash)
    return m.hexdigest()


def create_builder_configs_from_metadata_configs(
    module_path: str,
    metadata_configs: MetadataConfigs,
    supports_metadata: bool,
    base_path: Optional[str] = None,
    default_builder_kwargs: Dict[str, Any] = None,
    download_config: Optional[DownloadConfig] = None,

Review comment (suggestion):
Maybe `NotADatasetError` would be a better name for this error (the "dataset script" is not a data file)

Code after:
def infer_module_for_data_files(
    data_files: DataFilesDict, path: Optional[str] = None, download_config: Optional[DownloadConfig] = None
) -> Tuple[Optional[str], Dict[str, Any]]:
    """Infer module (and builder kwargs) from data files. Raise if module names for different splits don't match.

    Args:
        data_files ([`DataFilesDict`]): Dict of list of data files.
        path (str, *optional*): Dataset name or path.
        download_config ([`DownloadConfig`], *optional*):
            Specific download configuration parameters to authenticate on the Hugging Face Hub for private remote files.

    Returns:
        tuple[str, dict[str, Any]]: Tuple with
            - inferred module name
            - builder kwargs
    """
    split_modules = {
        split: infer_module_for_data_files_list(data_files_list, download_config=download_config)
        for split, data_files_list in data_files.items()
    }
    module_name, default_builder_kwargs = next(iter(split_modules.values()))
    if any((module_name, default_builder_kwargs) != split_module for split_module in split_modules.values()):
        raise ValueError(f"Couldn't infer the same data file format for all splits. Got {split_modules}")
    if not module_name:
        raise DataFilesNotFoundError("No (supported) data files found" + (f" in {path}" if path else ""))
    return module_name, default_builder_kwargs


def update_hash_with_config_parameters(hash: str, config_parameters: dict) -> str:
    """
    Used to update hash of packaged modules which is used for creating unique cache directories to reflect
    different config parameters which are passed in metadata from readme.
    """
    params_to_exclude = {"config_name", "version", "description"}
    params_to_add_to_hash = {
        param: value for param, value in sorted(config_parameters.items()) if param not in params_to_exclude
    }
    m = Hasher()
    m.update(hash)
    m.update(params_to_add_to_hash)
    return m.hexdigest()


def create_builder_configs_from_metadata_configs(
    module_path: str,
    metadata_configs: MetadataConfigs,
    supports_metadata: bool,
    base_path: Optional[str] = None,
    default_builder_kwargs: Dict[str, Any] = None,
    download_config: Optional[DownloadConfig] = None,
) -> Tuple[List[BuilderConfig], str]: