
    yIfj                        d Z ddlmZ ddlZddlm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mZmZ  ej        d
          ZddZ G d de          ZdS )z)Docstring checker from the basic checker.    )annotationsN)Literal)nodes)
interfaces)utils)_BasicChecker)is_overload_stubis_property_deleteris_property_setterz^_node1nodes.Module | nodes.ClassDef | nodes.FunctionDefreturn
str | Nonec                    	 | d         }n# t           $ r Y d S w xY wt          j        |          }|sd S t          |t          j                  sd S t          |j                  S )N__doc__)KeyErrorr   
safe_infer
isinstancer   Conststrvalue)r   	docstrings     Z/var/www/piapp/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                  >   e Zd Zdddddgifddddd	gifd
dddd	gifddddd	gifdZdeddddfddddddffZd/dZ ej        dd          d0d             Z	 ej        dd          d1d"            Z
 ej        dd          d2d$            ZeZd%ej        fd3d-Zd.S )4DocStringCheckerzEmpty %s docstringempty-docstringz^Used when a module, function, class or method has an empty docstring (it would be too easy ;).	old_names)W0132zold-empty-docstringzMissing module docstringmissing-module-docstringzNUsed when a module has no docstring. Empty modules do not require a docstring.)C0111zmissing-docstringzMissing class docstringmissing-class-docstringzNUsed when a class has no docstring. Even an empty class must have a docstring.z$Missing function or method docstringmissing-function-docstringzoUsed when a function or method has no docstring. Some special methods like __init__ do not require a docstring.)C0112C0114C0115C0116zno-docstring-rgxregexpz<regexp>zcRegular expression which should only match function or class names that do not require a docstring.)defaulttypemetavarhelpzdocstring-min-lengthintz<int>z[Minimum line length for functions/classes that require docstrings, shorter ones are exempt.r   Nonec                B    | j         j                                         d S )N)linterstatsreset_undocumented)selfs    r   openzDocStringChecker.openg   s    ,,.....    r   nodes.Modulec                2    |                      d|           d S )Nmodule)_check_docstringr4   r   s     r   visit_modulezDocStringChecker.visit_modulej   s    h-----r6   nodes.ClassDefc                    | j         j        j                            |j                  |                     d|           d S d S )Nclass)r1   configno_docstring_rgxmatchnamer:   r;   s     r   visit_classdefzDocStringChecker.visit_classdefn   sE    ;.44TY??G!!'400000 HGr6   nodes.FunctionDefc                   | j         j        j                            |j                  |                                rdnd}t          |          st          |          st          |          rd S t          |j
                                        t          j                  rd}t          j        |j
                                                  rt           j        nt           j        }|j
                                                                        D ]M}|                                dk    r|j        |v r)t          ||j                 t          j                  rd} nN|                     ||| |           d S t          |j
                                        t          j                  r|                     ||           d S d S d S )NmethodfunctionFzbuiltins.objectT)report_missing
confidence)r1   r@   rA   rB   rC   	is_methodr   r
   r	   r   parentframer   ClassDefr   has_known_basesr   	INFERENCEINFERENCE_FAILURE	ancestorsqnameFunctionDefr:   Module)r4   r   ftype
overriddenrJ   ancestors         r   visit_functiondefz"DocStringChecker.visit_functiondefs   s   ;.44TY??G $ 0 0@HHjE"4((&t,, $D))
 $+++--u~>> "
 ,T[->->-@-@AA6J((#5  !% 1 1 3 3 = = ? ?  H~~''+<<< yH,, +U->2 2, &*
%%4J: &      DK--//>> %%eT22222? HGr6   T	node_type0Literal['class', 'function', 'method', 'module']r   rI   boolrJ   interfaces.Confidencec                V   |j         r|j         j        nd}|t          |          }||sdS t          j        |          |j        z
  }|dk    r|sdS | j        j        j        }|dk    r|dk    r||k     rdS |dk    r | j        j	        j
        dxx         dz  cc<   n| j        j	        j
        |xx         dz  cc<   |j        rt          |j        d         t          j                  rt          |j        d         j        t          j                  rrt          j        |j        d         j        j                  }t          |t$          j                  r/t          |j        t$          j                  r|j        j        dv rdS |dk    rd	}	n|dk    rd
}	nd}	|                     |	||           dS |                                sa|dk    r | j        j	        j
        dxx         dz  cc<   n| j        j	        j
        |xx         dz  cc<   |                     d||f|           dS dS )z,Check if the node has a non-empty docstring.Nr9   r-   r?   klass   r   >   r   bytesunicoder    r"   r#   )r   rJ   r   )r   argsrJ   )doc_noder   r   r   get_node_last_linenolinenor1   r@   docstring_min_lengthr2   undocumentedbodyr   r   ExprCallr   funcastroidBoundMethodboundInstancerC   add_messagestrip)
r4   rZ   r   rI   rJ   r   lines	max_linesrl   messages
             r   r:   z!DocStringChecker._check_docstring   s    ,0=BDM''d	3D99I! .t44t{BEH$$U$ *?IH$$REI<M<MG##!.w7771<7777!.y999Q>999	ty|UZ88 ty|15:>> '	!(:(?@@dG$788 ZJ 0> >  z*EEEH$$4g%%36W4JGGGGG"" 	G##!.w7771<7777!.y999Q>999!I<J      	 	r6   N)r   r/   )r   r7   r   r/   )r   r=   r   r/   )r   rE   r   r/   )
rZ   r[   r   r   rI   r\   rJ   r]   r   r/   )__name__
__module____qualname__msgsNO_REQUIRED_DOC_RGXoptionsr5   r   only_required_for_messagesr<   rD   rY   visit_asyncfunctiondefr   HIGHr:    r6   r   r   r   -   s        !2;<=
 '&89:;
 &%99:;
 3( 9:;
- DB . %	 
	
 #"D 	
G4/ / / / &U%&@BSTT. . . UT. &U%&?ARSS1 1 1 TS1 &U%&BDUVV      WV D /  $,6O8 8 8 8 8 8 8r6   r   )r   r   r   r   )r   
__future__r   retypingr   rm   r   pylintr   pylint.checkersr   "pylint.checkers.base.basic_checkerr   pylint.checkers.utilsr	   r
   r   compilerz   r   r   r   r6   r   <module>r      s#  
 0 / " " " " " " 				                    ! ! ! ! ! ! < < < < < <          !bj&&        "c c c c c} c c c c cr6   