Repository: pandas-dev/pandas
File: pandas/util/_validators.py (Python)

Code before:
    """
    Validate na arguments.

    Parameters
    ----------
    value : object
        Value to validate.
    name : str
        Name of the argument, used to raise an informative error message.
    allow_no_default : bool, default False
        Whether to allow ``value`` to be ``lib.no_default``.
    allow_bool : bool, default False
        Whether to allow ``value`` to be an instance of bool.

    Raises
    ______
    ValueError
        When ``value`` is determined to be invalid.
    """
    if allow_no_default and value is lib.no_default:
        return
    if allow_bool and isinstance(value, bool):
        return
    if isna(value):
        return
    raise ValueError(f"{name} must be a valid NA value; got {value}")


def validate_fillna_kwargs(value, method, validate_scalar_dict_value: bool = True):
    """
    Validate the keyword arguments to 'fillna'.

    This checks that exactly one of 'value' and 'method' is specified.
    If 'method' is specified, this validates that it's a valid method.

    Parameters
    ----------
    value, method : object
        The 'value' and 'method' keyword arguments for 'fillna'.
    validate_scalar_dict_value : bool, default True
        Whether to validate that 'value' is a scalar or dict. Specifically,
        validate that it is not a list or tuple.

    Returns
    -------
    value, method : object
    """
    from pandas.core.missing import clean_fill_method

    if value is None and method is None:
        raise ValueError("Must specify a fill 'value' or 'method'.")

Review comment (suggestion):
```suggestion
    raise ValueError(f"{name} must be a bool (True/False) or a valid NA value; got {value}")
```

Code after:

    Parameters
    ----------
    value : object
        Value to validate.
    name : str
        Name of the argument, used to raise an informative error message.

    Raises
    ______
    ValueError
        When ``value`` is determined to be invalid.
    """
    if (
        value is lib.no_default
        or isinstance(value, bool)
        or value is None
        or value is NA
        or (lib.is_float(value) and np.isnan(value))
    ):
        return
    raise ValueError(f"{name} must be None, pd.NA, np.nan, True, or False; got {value}")


def validate_fillna_kwargs(value, method, validate_scalar_dict_value: bool = True):
    """
    Validate the keyword arguments to 'fillna'.

    This checks that exactly one of 'value' and 'method' is specified.
    If 'method' is specified, this validates that it's a valid method.

    Parameters
    ----------
    value, method : object
        The 'value' and 'method' keyword arguments for 'fillna'.
    validate_scalar_dict_value : bool, default True
        Whether to validate that 'value' is a scalar or dict. Specifically,
        validate that it is not a list or tuple.

    Returns
    -------
    value, method : object
    """
    from pandas.core.missing import clean_fill_method

    if value is None and method is None:
        raise ValueError("Must specify a fill 'value' or 'method'.")
    if value is None and method is not None:
        method = clean_fill_method(method)

    elif value is not None and method is None: