
    >[g                     X   d dl Z d dlmZ d dlmZ d dlZd dlmZmZ d dl	m
Z
mZmZ  ej                  d      Zd Zd Zd d	Zd!d
ee   defdZej(                  j+                  d e             d        Zej(                  j+                  d e             d        Zedk(  rd dlZd dlZ ej6                  d      Zej;                  dd       ej=                         ZejA                  ejB                        Z"ejB                  jG                  d      Z$ e%e$      dk\  r e jL                  de$d         re$d   Z'ndZ' e( ee"d   e'            e"d<   e"d   r/ ee"ejB                        Z) e*e)        ejV                  d       y e*djY                  ejB                               yy)"    N)	signature)Optional)enable_halving_search_cvenable_iterative_imputer)all_displaysall_estimatorsall_functionsznumpydoc.validatec               #     K   t               } t               }| |z   D ]  \  }}|j                  d      rg }t        |      D ]N  }|j                  d      rt	        ||      }t        |d      st        |t              s>|j                  |       P |j                  d        t        |t              D ]  }||f 
  y w)N___call__)key)r   r   
startswithdirgetattrhasattr
isinstancepropertyappendsortedstr)
estimatorsdisplaysnameKlassmethods
method_objmethods          X/var/www/html/bid-api/venv/lib/python3.12/site-packages/sklearn/tests/test_docstrings.pyget_all_methodsr      s     !J~H!H,e??3JDs# -Jz:.*Z2Rt$  	tW#.F- / -s   A<C?ACc               #      K   t               } | D ]1  \  }}d|j                  vs|j                   d|j                    3 y w)Nzutils.fixes.)r	   
__module____name__)	functionsr   funcs      r   get_all_functions_namesr&   %   sA     I4/__%Qt}}o66 s
   !A Ac              #      K   | D ]<  \  }}|dv r|dv r!||t        ||      }t        |t              r0||dv r7||f > yw)za
    Ignore some errors based on the method type.

    These rules are specific for scikit-learn.)RT02GL01GL02)PR02GL08N)EX01SA01ES01)r   r   r   )errorsr   r   codemessager   s         r   filter_errorsr3   -   sp     
  g ++ ##(9f>P /J*h/ $*B"BGmK  s   AAr   returnc                 l   |"t        |d      rd}n|t        d      t        |4t        ||      }	 t	        t        |            }|j                  dz   |z   }nd}|}ddj                  t	        | d         ||z   | d   d	d
j                  d | d   D              g      z   }|S # t        $ r d}Y jw xY w)a~  Pretty print original docstring and the obtained errors

    Parameters
    ----------
    res : dict
        result of numpydoc.validate.validate
    Klass : {Estimator, Display, None}
        estimator object or None
    method : str
        if estimator is not None, either the method name or None.

    Returns
    -------
    str
       String representation of the error.
    __init__z0At least one of Klass, method should be providedzM
Parsing of the method signature failed, possibly because this is a property.r!    z

file	docstringz# Errors
c              3   F   K   | ]  \  }}d j                  ||        yw)z	 - {}: {}N)format).0r1   r2   s      r   	<genexpr>zrepr_errors.<locals>.<genexpr>   s%      GTmdG""41}s   !r0   )	r   
ValueErrorNotImplementedErrorr   r   r   	TypeErrorr#   join)resr   r   objobj_signatureobj_namemsgs          r   repr_errorsrH   Z   s    " ~5*%F]OPP%%eV$		#/M >>C'&0
6;;F}$II GJ8} 	

 
C J/  	7 	s   B% %B32B3function_namec                     t         j                  |       }t        t        |d   d            |d<   |d   rt	        |d|        }t        |      y)z)Check function docstrings using numpydoc.r0   functionr   zTested function: N)numpydoc_validationvalidatelistr3   rH   r?   )rI   requestrC   rG   s       r   test_function_docstringrQ      sW     
&
&}
5Cs8}ZHICM
8}#(9-&IJo     zKlass, methodc                    | j                   }|| j                  g}||j                  |       dj                  |      }t        j                  |      }t        t        |d   ||             |d<   |d   rt        || |      }t        |      y )Nr!   r0   )r   )
r"   r#   r   rB   rM   rN   rO   r3   rH   r?   )r   r   rP   base_import_pathimport_pathrC   rG   s          r   test_docstringrV      s    ''#U^^4K6"((;'K

&
&{
3Cs8}fEJKCM
8}#uf-o rR   __main__z!Validate docstring with numpydoc.)descriptionrU   zImport path to validate)helpr!      z(?:[A-Z][a-z]*)+r0   rL      z#All docstring checks passed for {}!)N)NN)-reinspectr   typingr   pytestsklearn.experimentalr   r   sklearn.utils.discoveryr   r   r	   importorskiprM   r   r&   r3   r   rH   markparametrizerQ   rV   r#   argparsesysArgumentParserparseradd_argument
parse_argsargsrN   rU   rC   splitimport_path_sectionslenmatchr   rO   rG   printexitr<    rR   r   <module>ru      s   	    P O)f))*=>  (7*Z4# 4# 4n *A*CD	 E	 /*;< =$ z$X$$1TUF
,EFD

&
&t'7'7
8C++11#6
  A%("((1"5+ &b)s8}f=>CM
8}#d&6&67c
3::4;K;KLM? rR   