openml/datasets/functions.py
def _name_to_id(
    dataset_name: str, version: Optional[int] = None, error_if_multiple: bool = False
) -> int:
    """ Attempt to find the dataset id of the dataset with the given name.

    If multiple datasets with the name exist, and ``error_if_multiple`` is ``False``,
    then return the least recent still active dataset.

    Raises an error if no dataset with the name is found.
    Raises an error if a version is specified but it could not be found.

    Parameters
    ----------
    dataset_name : str
        The name of the dataset for which to find its id.
    version : int
        Version to retrieve. If not specified, the oldest active version is returned.
    error_if_multiple : bool (default=False)
        If `False`, if multiple datasets match, return the least recent active dataset.
        If `True`, if multiple datasets match, raise an error.
    download_qualities : bool, optional (default=True)
        If `True`, also download qualities.xml file. If False it skip the qualities.xml.

    Returns
    -------
    int
       The id of the dataset.
    """
    status = None if version is not None else "active"
    candidates = list_datasets(data_name=dataset_name, status=status, data_version=version)
    if error_if_multiple and len(candidates) > 1:
        raise ValueError("Multiple active datasets exist with name {}".format(dataset_name))
    if len(candidates) == 0:
        no_dataset_for_name = "No active datasets exist with name {}".format(dataset_name)
        and_version = " and version {}".format(version) if version is not None else ""
        raise RuntimeError(no_dataset_for_name + and_version)

    # Dataset ids are chronological so we can just sort based on ids (instead of version)
    return sorted(candidates)[0]
 Attempt to find the dataset id of the dataset with the given name.

    If multiple datasets with the name exist, and ``error_if_multiple`` is ``False``,
    then return the least recent still active dataset.

    Raises an error if no dataset with the name is found.
    Raises an error if a version is specified but it could not be found.

    Parameters
    ----------
    dataset_name : str
        The name of the dataset for which to find its id.
    version : int
        Version to retrieve. If not specified, the oldest active version is returned.
    error_if_multiple : bool (default=False)
        If `False`, if multiple datasets match, return the least recent active dataset.
        If `True`, if multiple datasets match, raise an error.
    download_qualities : bool, optional (default=True)
        If `True`, also download qualities.xml file. If False it skip the qualities.xml.

    Returns
    -------
    int
       The id of the dataset.
    
Attempt to find the dataset id of the dataset with the given name.

Raises an error if no dataset with the name is found.
Raises an error if a version is specified but it could not be found.

Parameters

dataset_name : str
The name of the dataset for which to find its id.
version : int
Version to retrieve. If not specified, the oldest active version is returned.
error_if_multiple : bool (default=False)
If `False`, if multiple datasets match, return the least recent active dataset.
If `True`, if multiple datasets match, raise an error.
download_qualities : bool, optional (default=True)
If `True`, also download qualities.xml file. If False it skip the qualities.xml.

Returns

int
The id of the dataset.
Attempt to find the dataset id of the dataset with the given name . Raises an error if no dataset with the name is found . Raises an error if a version is specified but it could not be found . Parameters dataset_name : str The name of the dataset for which to find its id . version : int Version to retrieve . If not specified the oldest active version is returned . error_if_multiple : bool ( default = False ) If ` False ` if multiple datasets match return the least recent active dataset . If ` True ` if multiple datasets match raise an error . download_qualities : bool optional ( default = True ) If ` True ` also download qualities . xml file . If False it skip the qualities . xml . Returns int The id of the dataset .
def _name_to_id(
    dataset_name: str, version: Optional[int] = None, error_if_multiple: bool = False
) -> int:
    status = None if version is not None else "active"
    candidates = list_datasets(data_name=dataset_name, status=status, data_version=version)
    if error_if_multiple and len(candidates) > 1:
        raise ValueError("Multiple active datasets exist with name {}".format(dataset_name))
    if len(candidates) == 0:
        no_dataset_for_name = "No active datasets exist with name {}".format(dataset_name)
        and_version = " and version {}".format(version) if version is not None else ""
        raise RuntimeError(no_dataset_for_name + and_version)
    return sorted(candidates)[0]
def _name_to_id ( dataset_name : str , version : Optional [ int ] = None , error_if_multiple : bool = False ) -> int : status = None if version is not None else "active" candidates = list_datasets ( data_name = dataset_name , status = status , data_version = version ) if error_if_multiple and len ( candidates ) > 1 : raise ValueError ( "Multiple active datasets exist with name {}" . format ( dataset_name ) ) if len ( candidates ) == 0 : no_dataset_for_name = "No active datasets exist with name {}" . format ( dataset_name ) and_version = " and version {}" . format ( version ) if version is not None else "" raise RuntimeError ( no_dataset_for_name + and_version ) return sorted ( candidates ) [ 0 ]
Attempt to find the dataset id of the dataset with the given name.
Attempt to find the dataset id of the dataset with the given name .
""" Attempt to find the dataset id of the dataset with the given name.

    If multiple datasets with the name exist, and ``error_if_multiple`` is ``False``,
    then return the least recent still active dataset.

    Raises an error if no dataset with the name is found.
    Raises an error if a version is specified but it could not be found.

    Parameters
    ----------
    dataset_name : str
        The name of the dataset for which to find its id.
    version : int
        Version to retrieve. If not specified, the oldest active version is returned.
    error_if_multiple : bool (default=False)
        If `False`, if multiple datasets match, return the least recent active dataset.
        If `True`, if multiple datasets match, raise an error.
    download_qualities : bool, optional (default=True)
        If `True`, also download qualities.xml file. If False it skip the qualities.xml.

    Returns
    -------
    int
       The id of the dataset.
    """ # Dataset ids are chronological so we can just sort based on ids (instead of version)
dataset_name
str
version
Optional[int]
error_if_multiple
bool