
    3;ji                         d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d Zd Zed	             Zd
 Z G d dee          ZdS )    N)UserDict)	lru_cache)quote)	docscrape)ReprHTMLMixinc                     | j         }t          j        | d|pd          }|dS |                    d          }t	          |           dt	          |           }| d| S )zURL to the relevant section of the docstring using a Text Fragment

    https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Text_fragments
    z	 : (.+)\n N   z,-z	#:~:text=)__doc__researchgroupr   )estimator_class
param_namedoc_link	docstringm
param_typetext_fragments          Y/root/voice-cloning/.venv/lib/python3.11/site-packages/sklearn/utils/_repr_html/params.py_generate_link_to_param_docr      s~    
  'I
	Z+++Y_"==Ay t JZ((??E*,=,=??M00000    c                     t          j        |           } t          j                    }d|_        d|_        d|_        t          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.
       r
   2   zuser-setdefault)r   r   param_value)htmlescapereprlibReprmaxlistmaxtuple	maxstringrepr)namevaluenon_default_paramsrcleaned_valuer   s         r   _read_paramsr+   &   sp     ;tDAAIAJAKKu..M#'999yJ$DWWWr   c                 *    t          j        |           S N)r   NumpyDocString)r   s    r   _scrape_estimator_docstringr/   6   s    #I...r   c           	         d}d}d}t          j        | j                  }|r$t          |          x}rd |d         D             }ni }g }| D ]}t	          || |         | j                  }	t          | j        || j                  }
|                    |d          x}r-|j	         d|j
         dd	                    |j                   }nd}| j        r#|
r!|r|                    |
|	d
         |          }n|	d
         }|                     |j        di |	d|i           |                    d                    |                    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>
    z
        <a class="param-doc-link"
            rel="noreferrer" target="_blank" href="{link}">
            {param_name}
            <span class="param-doc-description">{param_description}</span>
        </a>
    c                     i | ]
}|j         |S  )r&   ).0param_docstrings     r   
<dictcomp>z%_params_html_repr.<locals>.<dictcomp>e   s-     
 
 
  /
 
 
r   
ParametersNz: z<br><br>z<br>r   )linkr   param_descriptionparam_display
)rowsr2   )inspectgetdocr   r/   r+   non_defaultr   r   getr&   typejoindescformatappend)paramsPARAMS_TABLE_TEMPLATEPARAM_ROW_TEMPLATE!PARAM_AVAILABLE_DOC_LINK_TEMPLATEestimator_class_docsstructured_docstring	param_mapr;   rowparamr7   param_numpydocr8   r9   s                 r   _params_html_reprrO   ;   s   	)% #>&*@AA  ;<P Q QQ
 
#7#E
 
 
		
 	D U US&+v/ABB*6+A3XX&]]3555> 	%!& 6 6.*= 6 6;;~2336 6 
 !%? 		0t 		0(9 		0=DD ."3 E  MM ",/M-&-SSSS]SSSTTTT ''TYYt__'===r   c                   B     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.
    Nr	   )rE   r>   r   r   c                x    t                                          |pi            || _        || _        || _        d S r-   )super__init__r>   r   r   )selfrE   r>   r   r   	__class__s        r   rT   zParamsDict.__init__   s<     	2&&&&. r   )	__name__
__module____qualname__r   rO   
_html_reprtuplerT   __classcell__)rV   s   @r   rQ   rQ      se         . #J %%''4RT! ! ! ! ! ! ! ! ! ! !r   rQ   )r   r<   r   r    collectionsr   	functoolsr   urllib.parser   sklearn.externals._numpydocr   sklearn.utils._repr_html.baser   r   r+   r/   rO   rQ   r2   r   r   <module>rb      s
     				                          1 1 1 1 1 1 7 7 7 7 7 71 1 1,X X X  / / /I> I> I>X !  !  !  !  !  !  !  !  !  !r   