
    Q3j9                     h    d dl Z d dlZd dlmZ d dl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                 b   t        | t        j                        r/t        j                  | dddd      } t	        j
                  |       S t        j                         }dD ]  }t        ||d        d|_	        t        | t              r| dS t	        j
                  |j                  |             S )	N   ,T   )	precision	separatorsuppress_small	threshold)maxlistmaxdictmaxtuplemaxsetmaxfrozensetmaxdequemaxarray	   z.4g)
isinstancenpndarrayarray2stringhtmlescapereprlibReprsetattr	maxstringfloatrepr)valuerattrs      W/DATA/.local/lib/python3.12/site-packages/sklearn/utils/_repr_html/fitted_attributes.py_read_fitted_attrr'      s    %$Q#da
 {{5!!A 	4 AK%;;qvve}%%    c                 <   d}d}d}g }| j                         D ]`  \  }}t        | j                  || j                        }t	        | j                  d|      }| j                  r,|r*|r(|j                  |t        j                  |      |      }	ndt        j                  |       d}	t        |      dk(  r0t        j                  t        |d	               t        |d
         f}
nrt        j                  |d	         }t        j                  t        |d               }t        j                  t        |d               }| d| d| t        |d
         f}
|j                   |j
                  |
d|	i       c |j                  dj                  |            S )zGenerate HTML representation of estimator fitted attributes.

    Creates an HTML table with fitted attribute names and values
    wrapped in a collapsible details element. When attributes are arrays,
    shape and dtype are shown.
    a  
        <div class="estimator-table">
            <details>
                <summary>Fitted attributes</summary>
                <table class="parameters-table">
                    <tbody>
                        <tr>
                        <th>Name</th>
                        <th>Type</th>
                        <th>Value</th>
                        </tr>
                        {rows}
                    </tbody>
                </table>
            </details>
        </div>
    z
       <tr class="default">
           <td class="param">{fitted_attr_display}</td>
           <td class="fitted-att-type">{0}</td>
           <td>{1}</td>


       </tr>
    aq  
        <a class="param-doc-link"
            style="anchor-name: --doc-link-{fitted_attr_name};"
            rel="noreferrer" target="_blank" href="{link}">
            {fitted_attr_name}
            <span class="param-doc-description"
            style="position-anchor: --doc-link-{fitted_attr_name};">
            {fitted_attr_description}</span>
        </a>
    
Attributes)linkfitted_attr_namefitted_attr_descriptionz8<a class="param-doc-link" style="text-decoration:none;">z</a>r   	type_namer#   dtypeshape[]fitted_attr_display
)rows)itemsr   estimator_classdoc_linkr   formatr   r   lenstrr'   appendjoin)fitted_attributesFITTED_ATTR_TEMPLATEFITTED_ATTR_ROW_TEMPLATE'FITTED_ATTR_AVAILABLE_DOC_LINK_TEMPLATEr5   name	attr_infor+   r-   r3   html_row_valuesr.   r/   r0   s                 r&   _fitted_attr_html_reprrE   ,   s   " 	/+ D,224i)--&&

 #0--|T#
 %%$3J"I"P"P!%T!2(? #Q # K;;t$%T+  
 y>QC	+ 678!)G"45O
 Ik$:;IKKIg$6 78EKKIg$6 78E +QugQug.!)G"45O 	+$++ $7	
M 5Z  &&DIIdO&<<r(   c                   0     e Zd ZdZeZdddd fd
Z xZS )	AttrsDicta  Dictionary-like class to store and provide an HTML representation.

    It builds an HTML structure to be used with Jupyter notebooks or similar
    environments.

    Parameters
    ----------
    fitted_attrs : dict, default=None
        Dictionary of fitted attributes and their values.

    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 )fitted_attrsr7   r8   c                H    t         |   |xs i        || _        || _        y )N)super__init__r7   r8   )selfrI   r7   r8   	__class__s       r&   rL   zAttrsDict.__init__   s$    +,. r(   )__name__
__module____qualname____doc__rE   
_html_reprrL   __classcell__)rN   s   @r&   rG   rG      s     ( (J'+TB ! !r(   rG   )r   r   collectionsr   numpyr   sklearn.utils._repr_html.baser   sklearn.utils._repr_html.commonr   r   r'   rE   rG    r(   r&   <module>rZ      s5         7&6]=@!x !r(   