
    {Kgw                     ,    d dl Z d dlZd dlmZ d Zd Zy)    N)suppressc                     t        | t        j                         xr1 t        | t        j                        xr t	        j
                  |       S )a  Test if x is NaN.

    This function is meant to overcome the issue that np.isnan does not allow
    non-numerical types as input, and that np.nan is not float('nan').

    Parameters
    ----------
    x : any type
        Any scalar value.

    Returns
    -------
    bool
        Returns true if x is NaN, and false otherwise.

    Examples
    --------
    >>> import numpy as np
    >>> from sklearn.utils._missing import is_scalar_nan
    >>> is_scalar_nan(np.nan)
    True
    >>> is_scalar_nan(float("nan"))
    True
    >>> is_scalar_nan(None)
    False
    >>> is_scalar_nan("")
    False
    >>> is_scalar_nan([np.nan])
    False
    )
isinstancenumbersIntegralRealmathisnan)xs    Z/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/sklearn/utils/_missing.pyis_scalar_nanr      s@    @ q'**++ 	q',,'	JJqM    c                 `    t        t              5  ddlm} | |u cddd       S # 1 sw Y   yxY w)a  Test if x is pandas.NA.

    We intentionally do not use this function to return `True` for `pd.NA` in
    `is_scalar_nan`, because estimators that support `pd.NA` are the exception
    rather than the rule at the moment. When `pd.NA` is more universally
    supported, we may reconsider this decision.

    Parameters
    ----------
    x : any type

    Returns
    -------
    boolean
    r   )NANF)r   ImportErrorpandasr   )r   r   s     r   is_pandas_nar   ,   s'      
+	Bw 
		
 s   
$-)r	   r   
contextlibr   r   r    r   r   <module>r      s      #Lr   