o
    ôjÇ  ã                   @   s0   d dl Z d dlZd dlmZ dd„ Zdd„ ZdS )é    N)Úsuppressc                 C   s$   t | tjƒ ot | tjƒot | ¡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)Úx© r
   úi/var/www/html/academy/tools/voices/clone/cosy-venv/lib/python3.10/site-packages/sklearn/utils/_missing.pyÚis_scalar_nan	   s
    
ÿýr   c                 C   s@   t tƒ� ddlm} | |u W  d  ƒ S 1 sw   Y  dS )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   r
   r
   r   Úis_pandas_na/   s
   
 ýr   )r   r   Ú
contextlibr   r   r   r
   r
   r
   r   Ú<module>   s
   &