o
    ­—Žj0  ã                   @   sh   d 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Z
dZd	Zd
ZG dd„ deƒZdd„ ZdS )a  
    pygments.sphinxext
    ~~~~~~~~~~~~~~~~~~

    Sphinx extension to generate automatic documentation of lexers,
    formatters and filters.

    :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)Únodes)ÚViewList)Ú	Directive)Únested_parse_with_titlesz
.. module:: %s

%s
%s
z`
.. class:: %s

    :Short names: %s
    :Filenames:   %s
    :MIME types:  %s

    %s

    %s

zA
.. class:: %s

    :Short names: %s
    :Filenames: %s

    %s

z'
.. class:: %s

    :Name: %s

    %s

c                   @   sL   e Zd ZdZdZdZdZdZi Zdd„ Z	dd„ Z
d	d
„ Zdd„ Zdd„ ZdS )ÚPygmentsDoczn
    A directive to collect all lexers/formatters/filters and generate
    autoclass directives for them.
    Fé   r   c                 C   s¼   t ƒ | _| jd dkr|  ¡ }n(| jd dkr|  ¡ }n| jd dkr(|  ¡ }n| jd dkr4|  ¡ }ntdƒ‚t 	¡ }t
| d¡dd	�}t| j||ƒ | jD ]}| jjjj |¡ qO|jS )
Nr   ÚlexersÚ
formattersÚfiltersÚlexers_overviewz,invalid argument for "pygmentsdoc" directiveÚ
Ú )Úsource)ÚsetÚ	filenamesÚ	argumentsÚdocument_lexersÚdocument_formattersÚdocument_filtersÚdocument_lexers_overviewÚ	Exceptionr   Úcompoundr   Úsplitr   ÚstateÚdocumentÚsettingsÚrecord_dependenciesÚaddÚchildren)ÚselfÚoutÚnodeÚvlÚfn© r$   ú[/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pip/_vendor/pygments/sphinxext.pyÚrunG   s    




zPygmentsDoc.runc              
      s\  ddl m} ddlm} g }g ‰dd„ }t| ¡ dd„ d�D ]9\}}||d	 ƒ}|j|j }ˆ ||d	 |j	ƒd
 
|¡ dd¡ dd¡pEdd
 
|d ¡|d › d|› �dœ¡ qg d¢}	‡fdd„|	D ƒ‰ ‡ fdd„‰‡ ‡fdd„}
| |
ƒ ¡ | ˆddddƒ¡ | |
ƒ ¡ ˆD ]}| ˆ|d |d |d d |d! › d"�ƒ¡ qŠ| |
ƒ ¡ d# 
|¡S )$z¸Generate a tabular overview of all lexers.

        The columns are the lexer name, the extensions handled by this lexer
        (or "None"), the aliases and a link to the lexer class.r   ©ÚLEXERS)Úfind_lexer_classc                 S   s   |rd| › d|› d�S | S )Nú`z <z>`_r$   )ÚnameÚurlr$   r$   r%   Úformat_linke   s   z9PygmentsDoc.document_lexers_overview.<locals>.format_linkc                 S   s   | d d   ¡ S )Nr   )Úlower©Úxr$   r$   r%   Ú<lambda>j   s    z6PygmentsDoc.document_lexers_overview.<locals>.<lambda>©Úkeyr   ú, Ú*ú\*Ú_ú\ÚNoneé   Ú.)r+   Ú
extensionsÚaliasesÚclassc                    s"   g | ]‰ t ‡ fd d„ˆD ƒƒ‘qS )c                    s    g | ]}|ˆ  rt |ˆ  ƒ‘qS r$   )Úlen)Ú.0Úrow©Úcolumnr$   r%   Ú
<listcomp>v   s     zCPygmentsDoc.document_lexers_overview.<locals>.<listcomp>.<listcomp>)Úmax)r@   )ÚtablerB   r%   rD   v   s    ÿz8PygmentsDoc.document_lexers_overview.<locals>.<listcomp>c                     sF   g }t ˆ | ƒD ]\}}|r| | |¡¡ q| d| ¡ qd |¡S )zFormat a table rowú )ÚzipÚappendÚljustÚjoin)Úcolumnsr    ÚlengthÚcol)Úcolumn_lengthsr$   r%   Ú	write_rowy   s   
z7PygmentsDoc.document_lexers_overview.<locals>.write_rowc                     s   dd„ ˆ D ƒ} ˆ| Ž S )zWrite a table separator rowc                 S   s   g | ]}d | ‘qS )ú=r$   )r@   Úcr$   r$   r%   rD   †   s    zQPygmentsDoc.document_lexers_overview.<locals>.write_seperator.<locals>.<listcomp>r$   )Úsep)rO   rP   r$   r%   Úwrite_seperator„   s   z=PygmentsDoc.document_lexers_overview.<locals>.write_seperatorÚNamezExtension(s)zShort name(s)zLexer classr+   r<   r=   z	:class:`~r>   r*   r   )Ú$pip._vendor.pygments.lexers._mappingr(   Úpip._vendor.pygments.lexersr)   ÚsortedÚitemsr   Úalias_filenamesrI   r,   rK   Úreplace)r   r(   r)   r    r-   Ú	classnameÚdataÚ	lexer_clsr<   Úcolumn_namesrT   rA   r$   )rO   rF   rP   r%   r   Z   s@   
ü
ÿü
z$PygmentsDoc.document_lexers_overviewc              
   C   s~  ddl m} ddlm} dd l}dd l}g }i }i }t| ¡ dd„ d�D ]Ð\}}	|	d }
t|
d d |gƒ}| j	 
|j¡ t||ƒ}|jsKtd|› d�ƒ |j}t|tƒrX| d	¡}t|d
d ƒ}|r§| | |¡¡jjd d | }|jdd�}|s‚td|› d|› �ƒ‚|	d r§|	d d }|d7 }|d|› d�7 }| ¡ D ]
}|d|› d�7 }qœ|jr±d|j› �}nd}| |
g ¡ |d |	d ¡pÂdd |	d ¡ dd¡ dd¡pÒdd |	d  ¡pÚd||f¡ |
|vrô|j}t|tƒrð| d	¡}|||
< q$t| ¡ d!d„ d�D ]:\}
}||
 d u �rtd"|
› �ƒ‚||
  ¡ d   ¡  d#¡}| t|
|d$t |ƒ f ¡ |D ]
}	| t!|	 ¡ �q.qÿd |¡S )%Nr   r'   )Úpygmentsc                 S   ó   | d S ©Nr   r$   r/   r$   r$   r%   r1   Ÿ   ó    z-PygmentsDoc.document_lexers.<locals>.<lambda>r2   z	Warning: z does not have a docstring.Úutf8Ú_exampleÚtestsÚexamplefileszutf-8)ÚencodingzEmpty example file 'z' for lexer r:   z

    .. admonition:: Example
z
      .. code-block:: z

z
          r   z.. versionadded:: r   r4   r9   é   r5   r6   r7   r8   é   c                 S   ra   rb   r$   r/   r$   r$   r%   r1   Í   rc   zMissing docstring for r;   ú-)"rV   r(   Úpip._vendorr`   ÚinspectÚpathlibrX   rY   Ú
__import__r   r   Ú__file__ÚgetattrÚ__doc__ÚprintÚ
isinstanceÚbytesÚdecodeÚPathÚ
getabsfileÚparentÚ	read_textr   Ú
splitlinesÚversion_addedÚ
setdefaultrI   rK   r[   ÚstripÚrstripÚ	MODULEDOCr?   ÚLEXERDOC)r   r(   r`   rm   rn   r    ÚmodulesÚmoduledocstringsr\   r]   ÚmoduleÚmodÚclsÚ	docstringÚexample_fileÚpÚcontentÚ
lexer_nameÚlineÚversion_lineÚmoddocr   Úheadingr$   r$   r%   r   –   s‚   


ÿÿÿÿÿ ú

€ÿ
zPygmentsDoc.document_lexersc           
   
   C   sÂ   ddl m} g }t| ¡ dd„ d�D ]I\}}|d }t|d d |gƒ}| j |j¡ t||ƒ}|j	}t
|tƒr;| d¡}|j}	| t|	d |d ¡pJd	d |d
 ¡ dd¡pVd	|f ¡ qd |¡S )Nr   )Ú
FORMATTERSc                 S   ra   rb   r$   r/   r$   r$   r%   r1   Û   rc   z1PygmentsDoc.document_formatters.<locals>.<lambda>r2   rd   r4   r:   r9   ri   r5   r6   r   )Úpip._vendor.pygments.formattersr�   rX   rY   ro   r   r   rp   rq   rr   rt   ru   rv   Ú__name__rI   ÚFMTERDOCrK   r[   )
r   r�   r    r\   r]   r„   r…   r†   r‡   r�   r$   r$   r%   r   ×   s    



þ
zPygmentsDoc.document_formattersc                 C   sr   ddl m} g }| ¡ D ]'\}}| j tj|j j¡ |j	}t
|tƒr(| d¡}| t|j||f ¡ qd |¡S )Nr   )ÚFILTERSrd   r   )Úpip._vendor.pygments.filtersr”   rY   r   r   Úsysr‚   Ú
__module__rp   rr   rt   ru   rv   rI   Ú	FILTERDOCr’   rK   )r   r”   r    r+   r†   r‡   r$   r$   r%   r   é   s   


zPygmentsDoc.document_filtersN)r’   r—   Ú__qualname__rr   Úhas_contentÚrequired_argumentsÚoptional_argumentsÚfinal_argument_whitespaceÚoption_specr&   r   r   r   r   r$   r$   r$   r%   r   <   s    <Ar   c                 C   s   |   dt¡ d S )NÚpygmentsdoc)Úadd_directiver   )Úappr$   r$   r%   Úsetupö   s   r¢   )rr   r–   Údocutilsr   Údocutils.statemachiner   Údocutils.parsers.rstr   Úsphinx.util.nodesr   r€   r�   r“   r˜   r   r¢   r$   r$   r$   r%   Ú<module>   s    

 ;