o
    `^h                     @   s   dddZ dddZd S )Nc                 C   sv   |du r"t | drt | jdr| j }ndd t| jd D }n	t |dr+| }tt|t|kr9td|S )a(  Check feature names.

    Parameters
    ----------
    X : array-like of shape (n_samples, n_features)
        Input data.

    feature_names : None or array-like of shape (n_names,), dtype=str
        Feature names to check or `None`.

    Returns
    -------
    feature_names : list of str
        Feature names validated. If `feature_names` is `None`, then a list of
        feature names is provided, i.e. the column names of a pandas dataframe
        or a generic list of feature names (e.g. `["x0", "x1", ...]`) for a
        NumPy array.
    Ncolumnstolistc                 S   s   g | ]}d | qS )x ).0ir   r   Z/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/sklearn/inspection/_pd_utils.py
<listcomp>   s    z(_check_feature_names.<locals>.<listcomp>   z,feature_names should not contain duplicates.)hasattrr   r   rangeshapelenset
ValueError)Xfeature_namesr   r   r   _check_feature_names   s   
r   c              
   C   s^   t | tr-|du rtd| dz|| W S  ty, } z	td| d|d}~ww | S )a  Get feature index.

    Parameters
    ----------
    fx : int or str
        Feature index or name.

    feature_names : list of str, default=None
        All feature names from which to search the indices.

    Returns
    -------
    idx : int
        Feature index.
    Nz+Cannot plot partial dependence for feature z since the list of feature names was not provided, neither as column names of a pandas data-frame nor via the feature_names parameter.zFeature z not in feature_names)
isinstancestrr   index)fxr   er   r   r   _get_feature_index(   s   

r   )N)r   r   r   r   r   r   <module>   s   
#