ƺ>XdZddlmZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZmZmZejd krdd lmZndd lmZejd ZddZGdde ZdS)z)Docstring checker from the basic checker.) annotationsN)nodes) interfaces)utils) _BasicChecker)is_overload_stubis_property_deleteris_property_setter))Literalz^_node1nodes.Module | nodes.ClassDef | nodes.FunctionDefreturn str | Nonec |d}n#t$rYdSwxYwtj|}|sdSt|tjsdSt |jS)N__doc__)KeyErrorr safe_infer isinstancerConststrvalue)r docstrings x/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pylint/checkers/base/docstring_checker.py_infer_dunder_doc_attributer!s|O tt ++I t i - -t y  s  c>eZdZdddddgifddddd gifd d d dd gifd dddd gifdZdeddddfddddddffZd/dZejddd0d Z ejd dd1d"Z ejddd2d$Z e Z d%e jfd3d-Zd.S)4DocStringCheckerzEmpty %s docstringempty-docstringz^Used when a module, function, class or method has an empty docstring (it would be too easy ;). old_names)W0132zold-empty-docstringzMissing module docstringmissing-module-docstringzNUsed when a module has no docstring. Empty modules do not require a docstring.)C0111zmissing-docstringzMissing class docstringmissing-class-docstringzNUsed when a class has no docstring. Even an empty class must have a docstring.z$Missing function or method docstringmissing-function-docstringzoUsed when a function or method has no docstring. Some special methods like __init__ do not require a docstring.)C0112C0114C0115C0116zno-docstring-rgxregexpzzcRegular expression which should only match function or class names that do not require a docstring.)defaulttypemetavarhelpzdocstring-min-lengthintzz[Minimum line length for functions/classes that require docstrings, shorter ones are exempt.rNonecB|jjdS)N)linterstatsreset_undocumented)selfs ropenzDocStringChecker.openls ,,.....r nodes.Modulec2|d|dS)Nmodule)_check_docstringr6rs r visit_modulezDocStringChecker.visit_moduleos h-----r8nodes.ClassDefc|jjj|j|d|dSdS)Nclass)r3configno_docstring_rgxmatchnamer<r=s rvisit_classdefzDocStringChecker.visit_classdefssE ;  . 4 4TY ? ? G  ! !'4 0 0 0 0 0 H Gr8nodes.FunctionDefc|jjj|j|rdnd}t |st|st|rdSt|j dtj rd}tj|j dr t jn t j}|j dD]M}|dkr|j|vr)t||jtjrd}nN|||| |dSt|j dtjr|||dSdSdS)NmethodfunctionT)futureFzbuiltins.object)report_missing confidence)r3rBrCrDrE is_methodr r rrparentframerClassDefrhas_known_basesr INFERENCEINFERENCE_FAILURE ancestorsqname FunctionDefr<Module)r6rftype overriddenrMancestors rvisit_functiondefz"DocStringChecker.visit_functiondefxs ;  . 4 4TY ? ? G $ 0 0@HHjE"4(( &t,, $D))  $+++4+88%.II " ,T[->->d->-K-KLL6J((#5 !% 1 1 1 > > H H J JH~~''+<<< yH,, +U->22,&* %%4J:&DK--T-::ELII %%eT22222? H Gr8T node_type0Literal['class', 'function', 'method', 'module']rrLboolrMinterfaces.ConfidencecV|jr |jjnd}|t|}||sdStj||jz }|dkr|sdS|jjj}|dkr|dkr||krdS|dkr |jj j dxxdz cc<n|jj j |xxdz cc<|j rt|j dtjrt|j djtjrrtj|j djj}t|t$jr/t|jt$jr|jjdvrdS|dkrd } n |dkrd } nd } || || dS|sa|dkr |jj j dxxdz cc<n|jj j |xxdz cc<|d ||f|dSdS)z,Check if the node has a non-empty docstring.Nr;r/rAklassr>rbytesunicoder"r$r%)rrMr)rargsrM)doc_noderrrget_node_last_linenolinenor3rBdocstring_min_lengthr4 undocumentedbodyrrExprCallrfuncastroid BoundMethodboundInstancerE add_messagestrip) r6r]rrLrMrlines max_linesromessages rr<z!DocStringChecker._check_docstrings,0=BDM''d  3D99I  ! .t44t{BEH$$U$ *?IH$$REI999  ty|UZ88 ty|15:>>  ' ! (:(?@@dG$788ZJ 0>>z*EEEH$$4g%%36   W4J  G G G G G"" G## !.w7771<7777 !.y999Q>999   !IrFr\visit_asyncfunctiondefrHIGHr<r8rrr2s !  2 ;< =   ' & 8 9: ;   & % 9 9: ;   3 ( 9: ;  -  DB . %     #"D    G4////&U%&@BSTT...UT.&U%&?ARSS111TS1&U%&BDUVV   WV D/ $,6O 8888888r8r)rrrr)r __future__rresysrprpylintrpylint.checkersr"pylint.checkers.base.basic_checkerrpylint.checkers.utilsrr r version_infotypingr typing_extensionscompiler}rrrr8rrsQ 0/"""""" !!!!!!<<<<<< v))))))!bj&&    "ccccc}cccccr8