o
    c                     @   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-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)nodes)ViewList)	Directive)nested_parse_with_titlesz
.. module:: %s

%s
%s
zX
.. class:: %s

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

    %s

zA
.. class:: %s

    :Short names: %s
    :Filenames: %s

    %s

z'
.. class:: %s

    :Name: %s

    %s

c                   @   sD   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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tdt }t	|
ddd}t| j|| | jD ]}| jjjj| qC|jS )	Nr   lexers
formattersfiltersz,invalid argument for "pygmentsdoc" directive
 )source)set	filenames	argumentsdocument_lexersdocument_formattersdocument_filters	Exceptionr   compoundr   splitr   statedocumentsettingsrecord_dependenciesaddchildren)selfoutnodevlfn r"   K/opt/certbot/lib/python3.10/site-packages/pip/_vendor/pygments/sphinxext.pyrunE   s   



zPygmentsDoc.runc              
   C   s  ddl m} g }i }i }t| dd dD ]r\}}|d }t|d d |g}| j|j t||}	|	j	s;t
d|  |	j	}
t|
trH|
d}
||g |d|d	 pWd
d|d ddddpgd
d|d pod
|
f ||vr|j	}t|tr|d}|||< qt| dd dD ]8\}}|| d u rtd|f ||  d  d}|t||dt| f  |D ]	}|t|  qqd|S )Nr   )LEXERSc                 S      | d S Nr   r"   xr"   r"   r#   <lambda>[       z-PygmentsDoc.document_lexers.<locals>.<lambda>keyz&Warning: %s does not have a docstring.utf8,    None   *\*_\   c                 S   r&   r'   r"   r(   r"   r"   r#   r*   q   r+   zMissing docstring for %s.-r   )$pip._vendor.pygments.lexers._mappingr%   sorteditems
__import__r   r   __file__getattr__doc__print
isinstancebytesdecode
setdefaultappendjoinreplacer   
splitlinesstriprstrip	MODULEDOClenLEXERDOC)r   r%   r   modulesmoduledocstrings	classnamedatamodulemodcls	docstringmoddocr   headingr"   r"   r#   r   V   sH   


 


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   r&   r'   r"   r(   r"   r"   r#   r*      r+   z1PygmentsDoc.document_formatters.<locals>.<lambda>r,   r.   r/   r0   r1   r2   r3   r4   r   )pip._vendor.pygments.formattersrY   r;   r<   r=   r   r   r>   r?   r@   rB   rC   rD   __name__rF   FMTERDOCrG   rH   )
r   rY   r   rQ   rR   rS   rT   rU   rV   rX   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   )FILTERSr.   r   )pip._vendor.pygments.filtersr]   r<   r   r   sysrO   
__module__r>   r@   rB   rC   rD   rF   	FILTERDOCr[   rG   )r   r]   r   namerU   rV   r"   r"   r#   r      s   


zPygmentsDoc.document_filtersN)r[   r`   __qualname__r@   has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespaceoption_specr$   r   r   r   r"   r"   r"   r#   r   :   s    %r   c                 C   s   |  dt d S )Npygmentsdoc)add_directiver   )appr"   r"   r#   setup   s   rl   )r@   r_   docutilsr   docutils.statemachiner   docutils.parsers.rstr   sphinx.util.nodesr   rL   rN   r\   ra   r   rl   r"   r"   r"   r#   <module>   s    

`