
    Q3j^
                     \    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 Z	ed        Z
d Zy)    N)	lru_cache)quote)	docscrapec                     | j                   }t        j                  | d|xs d      }|y|j                  d      j	                  d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groupreplacer   )estimator_class
param_namedoc_link	docstringm
param_typetext_fragments          L/DATA/.local/lib/python3.12/site-packages/sklearn/utils/_repr_html/common.pygenerate_link_to_param_docr      s}    
  ''I
		ZL
+Y_"=Ay  ##C,JZ()E*,=+>?MZy00    c                 ,    t        j                  |       S N)r   NumpyDocString)r   s    r   scrape_estimator_docstringr   #   s    ##I..r   c                    t        j                  |       }|r+t        |      x}r||   D ci c]  }|j                  | }}ni }|j	                  |d      x}rft        j                  |j                         dt        j                  |j                         ddj                  d |j                  D               }|S d}|S c c}w )a  Extract and format docstring information for a specific item.

    Parses the estimator's docstring to retrieve documentation for a
    specific parameter or attribute, formatting it as HTML-escaped text.

    Parameters
    ----------
    estimator_class : type
        The estimator class whose docstring will be parsed.

    section_name : str
        The numpydoc section to search in (e.g., "Parameters", "Attributes").

    item : str
        The name of the parameter or attribute to retrieve documentation for.

    Returns
    -------
    item_description : str or None
        HTML-formatted docstring to be used as a tooltip. Returns None if the
        estimator has no docstring or if the item is not found in the
        specified section.
    Nz: z<br><br>z<br>c              3   F   K   | ]  }t        j                  |        y wr   )htmlescape).0lines     r   	<genexpr>z get_docstring.<locals>.<genexpr>N   s     L9K4;;t,9Ks   !)
inspectgetdocr   namegetr   r    typejoindesc)	r   section_nameitemestimator_class_docsstructured_docstringitem_docstringdocstring_mapitem_numpydocitem_descriptions	            r   get_docstringr3   (   s    0 #>>/: :;O PPP #7|"D
"D /"D 	 

 %))$55}5{{=--./r{{=--./x{{L9K9KLLMO 	   
s   C)r   r$   r   	functoolsr   urllib.parser   sklearn.externals._numpydocr   r   r   r3    r   r   <module>r8      s7      	   11, / /*r   