
    eN                        d Z ddlmZ ddlZddlmZmZmZ ddlm	Z	 ddl
mZmZ erddlmZ ddZdd	ZdddZej$                  d
f	 	 	 	 	 	 	 ddZy)z?Various helper functions to create the docs of a linter object.    )annotationsN)TYPE_CHECKINGAnyTextIO)MAIN_CHECKER_NAME)get_rst_sectionget_rst_title)PyLinterc                   i }| j                         D ]z  }|j                  }|t        k7  s	 |||   d<   ||   dxx   |j                         z  cc<   ||   d   j	                  |j
                         ||   dxx   |j                  z  cc<   | |S # t        $ rJ |t        |j                               t        |j
                        t        |j                        d||<   Y w xY w)z,Get info from a checker and handle KeyError.checkeroptionsmsgsreports)r   r   r   r   )
get_checkersnamer   _options_and_valuesupdater   r   KeyErrorlistdict)linter
by_checkerr   r   s       3/usr/lib/python3/dist-packages/pylint/utils/docs.py_get_checkers_infosr      s    ,.J&&( ||$$.5
4 +4 +w/J/J/LL+4 (//=4 +w>+   &#G$?$?$AB .#GOO4	$
4 s   A!BAC%$C%c                Z   t        dd      }|dz  }| j                         D ]  }|j                  t        k(  s|j                  s$|j                         D ]P  \  }}|d}n|j                          d}|t        |d      z  }t        |t              sJ |t        d|       dz  }R  |S )	z'Get documentation for the main checker.z"Pylint global options and switches-z/
Pylint provides global options and switches.

NzGeneral optionsz options~
)
r	   r   r   r   r   _options_by_section
capitalize
isinstancer   r   )r   resultr   sectionr   titles         r   !_get_global_options_documentationr%   (   s    ?EF
  F &&( 	@<<,,$+$?$?$A @ ?-E&1134H=E-s33!'4000_T7;<B??@	@ M    Tc                    |rt        |       }nd}|t        dd      z  }|dz  }t        |       }t        |      D ](  }||   }|d   }|d= | |j                  di |d|iz  }* |S )z*Get documentation for individual checkers. z%Pylint checkers' options and switchesr   z
Pylint checkers can provide three set of features:

* options that control their execution,
* messages that they can raise,
* reports that they can generate.

Below is a list of all checkers and their features.

r   show_options )r%   r	   r   sortedget_full_documentation)r   r)   r"   r   checker_nameinformationr   s          r   _get_checkers_documentationr/   <   s    26:
mCSIIF
 
 
F %V,Jz* 
 .i(	"0'00 

(4
 	
	
 Mr&   c                :    t        t        | |      dd |       y)z+Output a full documentation in ReST format.)r)   N)file)printr/   )r   streamr)   s      r   print_full_documentationr5   Z   s      
#FFsKRXr&   )r   r
   returnzdict[str, dict[str, Any]])r   r
   r6   str)T)r   r
   r)   boolr6   r7   )r   r
   r4   r   r)   r8   r6   None)__doc__
__future__r   systypingr   r   r   pylint.constantsr   pylint.utils.utilsr   r	   pylint.lint.pylinterr
   r   r%   r/   stdoutr5   r*   r&   r   <module>rB      sb   
 F " 
 - - . =-*(> (+zz$AE	r&   