`L iXddlZddlmZddlmZddlZddlmZmZddl m Z m Z m Z ejdZdZdZd d Zd!d eed efd Zej(j+d edZej(j+dedZedk(rddlZddlZej6dZej;ddej=ZejAejBZ"ejBjGdZ$e%e$dk\rejLde$dre$dZ'ndZ'e(ee"de'e"d<e"dr/ee"ejBZ)e*e)ejVdye*djYejByy)"N) signature)Optional)enable_halving_search_cvenable_iterative_imputer) all_displaysall_estimators all_functionsznumpydoc.validatec#Kt}t}||zD]\}}|jdrg}t|D]N}|jdrt ||}t |dst |ts>|j|P|jdt|tD]}||f yw)N___call__)key) rr startswithdirgetattrhasattr isinstancepropertyappendsortedstr) estimatorsdisplaysnameKlassmethods method_objmethods c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sklearn/tests/test_docstrings.pyget_all_methodsrs!J~H!H, e ??3  J %Ds# -Jz:.*Z2Rt$  % tW#. F-   s Ayw)za Ignore some errors based on the method type. These rules are specific for scikit-learn.)RT02GL01GL02)PR02GL08N)EX01SA01ES01)rrr)errorsrrcodemessagers r filter_errorsr3-su  % g + +  # #(9f>P /J*h/  $*B"B GmK%sAArreturnc l|"t|drd}n| tdt|4t||} t t |}|jdz|z}nd}|}ddjt |d||z|dd d jd |d Dgz}|S#t $rd}YjwxYw) 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 c3FK|]\}}dj||yw)z - {}: {}N)format).0r1r2s r zrepr_errors..s&6CdG ""41s!r0) r ValueErrorNotImplementedErrorrrr TypeErrorr#join)resrrobj obj_signatureobj_namemsgs r repr_errorsrHZs"~ 5* %F ]OP P% % eV$  #/M>>C'&0  6;; F  } $    IIGJ8}     C J/ 7  sB%% B32B3 function_namectj|}tt|dd|d<|drt |d|}t |y)z)Check function docstrings using numpydoc.r0functionrzTested function: N)numpydoc_validationvalidatelistr3rHr?)rIrequestrCrGs rtest_function_docstringrQsW  & &} 5Cs8}ZHICM 8}#(9-&IJoz Klass, methodc|j}||jg}||j|dj|}tj |}t t|d|||d<|drt|||}t|y)Nr!r0)r) r"r#rrBrMrNrOr3rHr?)rrrPbase_import_path import_pathrCrGs rtest_docstringrVs''#U^^4K 6"((;'K  & &{ 3Cs8}fEJKCM 8}#uf-orR__main__z!Validate docstring with numpydoc.) descriptionrUzImport path to validate)helpr!z(?:[A-Z][a-z]*)+r0rLz#All docstring checks passed for {}!)N)NN)-reinspectrtypingrpytestsklearn.experimentalrrsklearn.utils.discoveryrrr importorskiprMrr&r3rrHmark parametrizerQrVr#argparsesysArgumentParserparser add_argument parse_argsargsrNrUrCsplitimport_path_sectionslenmatchrrOrGprintexitr<rRrrus  PO)f))*=> (7*Z4#4#4n*A*CD E /*;<=$ z $X $ $1T UF  ,EF    D  & &t'7'7 8C++11#6   A%("((1"5+&b)s8}f=>CM 8}#d&6&67 c   3::4;K;KLM?rR