
    Q3jT                     `    d dl Z d dlZd dlmZ d dlmZ d dlmZmZ d Z	d Z
 G d dee      Zy)	    N)UserDict)ReprHTMLMixin)generate_link_to_param_docget_docstringc                     t        j                  |       } t        j                         }d|_        d|_        d|_        t        j                  |j                  |            }| |v rdnd}|| |dS )zCategorizes parameters as 'default' or 'user-set' and formats their values.
    Escapes or truncates parameter values for display safety and readability.
          2   zuser-setdefault)
param_type
param_nameparam_value)htmlescapereprlibReprmaxlistmaxtuple	maxstringrepr)namevaluenon_default_paramsrcleaned_valuer   s         L/DATA/.local/lib/python3.12/site-packages/sklearn/utils/_repr_html/params.py_read_paramsr      sd     ;;tDAAIAJAKKKu.M#'99yJ$DWW    c           	         d}d}d}g }| D ]  }t        || |   | j                        }t        | j                  || j                        }t        | j                  d|      }| j                  r|r|r|j                  ||d   |      }	n|d   }	|j                   |j                  d
i |d|	i        |j                  dj                  |      	      S )a   Generate HTML representation of estimator parameters.

    Creates an HTML table with parameter names and values, wrapped in a
    collapsible details element. Parameters are styled differently based
    on whether they are default or user-set values.
    a/  
        <div class="estimator-table">
            <details>
                <summary>Parameters</summary>
                <table class="parameters-table">
                  <tbody>
                    {rows}
                  </tbody>
                </table>
            </details>
        </div>
    aW  
        <tr class="{param_type}">
            <td><i class="copy-paste-icon"
                 onclick="copyToClipboard('{param_name}',
                          this.parentElement.nextElementSibling)"
            ></i></td>
            <td class="param">{param_display}</td>
            <td class="value">{param_value}</td>
        </tr>
    aY  
        <a class="param-doc-link"
            style="anchor-name: --doc-link-{param_name};"
            rel="noreferrer" target="_blank" href="{link}">
            {param_name}
            <span class="param-doc-description"
            style="position-anchor: --doc-link-{param_name};">
            {param_description}</span>
        </a>
    
Parametersr   )linkr   param_descriptionparam_display
)rows )	r   non_defaultr   estimator_classdoc_linkr   formatappendjoin)
paramsPARAMS_TABLE_TEMPLATEPARAM_ROW_TEMPLATE!PARAM_AVAILABLE_DOC_LINK_TEMPLATEr%   rowparamr!   r"   r#   s
             r   _params_html_reprr3      s    		)% DS&+v/A/AB)&*@*@#vW)&*@*@,PST??t(9=DD ."3 E M ",/M-&--SS]ST# & !''TYYt_'==r   c                   <     e Zd ZdZeZd e       ddd fd
Z xZS )
ParamsDictaQ  Dictionary-like class to store and provide an HTML representation.

    It builds an HTML structure to be used with Jupyter notebooks or similar
    environments. It allows storing metadata to track non-default parameters.

    Parameters
    ----------
    params : dict, default=None
        The original dictionary of parameters and their values.

    non_default : tuple, default=(,)
        The list of non-default parameters.

    estimator_class : type, default=None
        The class of the estimator. It allows to find the online documentation
        link for each parameter.

    doc_link : str, default=""
        The base URL to the online documentation for the estimator class.
        Used to generate parameter-specific documentation links in the HTML
        representation. If empty, documentation links will not be generated.
    N )r-   r'   r(   r)   c                V    t         |   |xs i        || _        || _        || _        y )N)super__init__r'   r(   r)   )selfr-   r'   r(   r)   	__class__s        r   r9   zParamsDict.__init__z   s-     	2&&. r   )	__name__
__module____qualname____doc__r3   
_html_reprtupler9   __classcell__)r;   s   @r   r5   r5   `   s'    . #J %'4RT! !r   r5   )r   r   collectionsr   sklearn.utils._repr_html.baser   sklearn.utils._repr_html.commonr   r   r   r3   r5   r&   r   r   <module>rF      s2        7X >>B !  !r   