HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/docutils/transforms/__pycache__/peps.cpython-38.pyc
U

�w#[0+�@s�dZdZddlZddlZddlZddlZddlmZmZm	Z	ddlm
Z
mZddlm
Z
mZddlmZmZmZGdd	�d	e
�ZGd
d�de
�ZGdd
�d
e
�ZGdd�de
�ZGdd�dej�ZdZddd�ZdS)z�
Transforms for PEP processing.

- `Headers`: Used to transform a PEP's initial RFC-2822 header.  It remains a
  field list, but some entries get processed.
- `Contents`: Auto-inserts a table of contents.
- `PEPZero`: Special processing for PEP 0.
ZreStructuredText�N)�nodes�utils�	languages)�ApplicationError�	DataError)�	Transform�TransformError)�parts�
references�miscc@sDeZdZdZdZdZdZe�dej	�dfe�d�dffZ
dd	�Zd
S)�Headersz<
    Process fields in a PEP's initial RFC-2822 header.
    ihzpep-%04dz3http://hg.python.org/peps/file/default/pep-%04d.txtz\$RCSfile: (.+),v \$$z\1z\$[a-zA-Z]+: (.+) \$$cCst|j�std��|jd}t|tj�r4d|dkr<td��d}|D]�}|d����dkrD|d��}zt|�}|j	|}Wn�t
k
�r(|}d}|jjjd||d	�}|j�
|�}tj||p�d
|d�}|j�
|�}	|�|	�t|d��r
|g|dddd�<n|dt�dd|�7<YnX�q2qD|dk�rDtd
��|dk�rrt�t�}
|j�d|
�|j�|
�t|�dk�s�|dd����dk�r�td��|D�]h}|d����}|d}t|�dk�r�td|jdd���n�t|�dk�rt|dtj��sttd|jdd���nV|dk�r�t�dt�t�|jd�d��}
|�rt|t�ddtjd|
|d��7}n�q�|d}|dk�r�|D]"}t|tj��r�|�t|���q��q�|dk�r�|D]$}t|tj��r�|�t||���q��q�|dk�rhg}t�d�}t� d|���D]>}t|�}|�!tj|||jj"j#|j$|d��|�!|��q|dd�|dd�<n�|dk�r�t%�&||j'�|�r|��}
tjd|
|d�g|dd�<nd|dk�r�|��}|jj"j#|j$d }tjd||d�g|dd�<n"|d!k�r�t|��r�t%�&||j'��q�dS)"NzDocument tree is empty.r�rfc2822�classeszADocument does not begin with an RFC-2822 header; it is not a PEP.�pep�z?"PEP" header must contain an integer; "%s" is an invalid value.)Z	base_nodez(none))Zrefid�z3Document does not contain an RFC-2822 "PEP" header.��titlez	No title!z4PEP header field body contains multiple elements:
%s)�levelz=PEP header field body may only contain a single paragraph:
%sz
last-modifiedz%d-%b-%Y�source���refuriZauthorzdiscussions-to)Zreplaceszreplaced-byZrequires� z,?\s+���zcontent-type��version)(�len�documentr�
isinstancerZ
field_list�astext�lower�int�pep_cvs_url�
ValueError�reporterZwarning�set_idZproblematicZadd_backref�	paragraph�pending�PEPZero�insert�note_pendingZpformat�time�strftime�	localtime�os�stat�	reference�replace_self�
mask_emailZText�re�split�append�settings�pep_base_url�pep_urlrZclean_rcs_keywords�rcs_keyword_substitutions)�self�headerrZfield�valueZcvs_url�msgZmsgidZprbZprbidr(�nameZbody�dateZpara�nodeZnewbodyZspaceZrefpep�pepnoZpep_typeZuri�rC�:/usr/lib/python3/dist-packages/docutils/transforms/peps.py�apply)s�


����
 


(

�
�
��



��

z
Headers.applyN)�__name__�
__module__�__qualname__�__doc__�default_priorityr9r#r4�compile�
IGNORECASEr:rErCrCrCrDrs�rc@seZdZdZdZdd�ZdS)�Contentsz~
    Insert an empty table of contents topic and a transform placeholder into
    the document after the RFC 2822 header.
    i|cCs�t�|jjj|jj�}|jd}t�d|�}tj	d|dgd�}t�
|�}|j�|�sb|d�|�|j�
|�t�tj�}||7}|j�d|�|j�|�dS)N�contentsr)r�namesr)rZget_languagerr7Z
language_coder%�labelsrr�topicZfully_normalize_nameZhas_namer6Znote_implicit_targetr(r	rMr*r+)r;Zlanguager?rrQr(rCrCrDrE�s�

zContents.applyN�rFrGrHrIrJrErCrCrCrDrM�srMc@s$eZdZdZdZdd�Zdd�ZdS)�TargetNotesz�
    Locate the "References" section, insert a placeholder for an external
    target footnote insertion transform at the end, and schedule the
    transform to run immediately.
    icCs|j}t|�d}d}}|dkrtt||tj�rt||d������}d|kr^||}qtnd|krj|}|d8}q|s�t��}|t�dd�7}|�	|�|r�|�
||�n
|�|�t�t
j�}|�|�|j�|d�tjtjd|jid�}|�|�|j�|d�dS)	Nrrr
�	copyrightrZ
References�callback)Zdetails)rrrrZsectionr r!r5rr&r*r6r(r
rSr+rZCallBack�cleanup_callback)r;�doc�iZrefsectrTZtitle_wordsr(rCrCrDrE�s4



�
zTargetNotes.applycCs"t|j�dkr|jj�|j�dS)z�
        Remove an empty "References" section.

        Called after the `references.TargetNotes` transform is complete.
        rN)r�parent�remove)r;r(rCrCrDrV�szTargetNotes.cleanup_callbackN)rFrGrHrIrJrErVrCrCrCrDrS�srSc@seZdZdZdZdd�ZdS)r)z'
    Special processing for PEP 0.
    i�cCs*t|j�}|j�|�|jj�|j�dS�N)�PEPZeroSpecialr�walkZ	startnoderYrZ)r;ZvisitorrCrCrDrE�s
z
PEPZero.applyNrRrCrCrCrDr)�sr)c@sNeZdZdZejZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�ZdS)r\z�
    Perform the special processing needed by PEP 0:

    - Mask email addresses.

    - Link PEP numbers in the second column of 4-column tables to the PEPs
      themselves.
    cCsdSr[rC�r;rArCrCrD�
unknown_visit�szPEPZeroSpecial.unknown_visitcCs|�t|��dSr[)r2r3r^rCrCrD�visit_reference�szPEPZeroSpecial.visit_referencecCsd|dkrtj�dS)Nr
r)rZSkipNoder^rCrCrD�visit_field_list�szPEPZeroSpecial.visit_field_listcCs|ddk|_d|_dS)NZcols�r)�	pep_table�entryr^rCrCrD�visit_tgroup�szPEPZeroSpecial.visit_tgroupcCs0|jd7_|jr,|jdkr,|d�d�dS)Nrrr�num)rdrcr6r^rCrCrD�
visit_colspec�szPEPZeroSpecial.visit_colspeccCs
d|_dS)Nr)rdr^rCrCrD�	visit_rowszPEPZeroSpecial.visit_rowcCs�|jd7_|jr�|jdkr�t|�dkr�|d�d�|d}t|tj�r�t|�dkr�|��}z4t|�}|j	j
j|j|}tj
|||d�|d<Wntk
r�YnXdS)Nrrrrfrr)rdrcrr6rrr'r r"rr7r8r9r1r$)r;rA�p�textr�refrCrCrD�visit_entrys�zPEPZeroSpecial.visit_entryN)
rFrGrHrIrr9r_r`rarergrhrlrCrCrCrDr\�s	r\)zpeps@python.orgzpython-list@python.orgzpython-dev@python.orgcCs�|�d�r�|d�d�r�|ddd�tkr6|d}n |���dd�}tjd|d	d
�}|dkrb|S|dd|7<|g|dd�<|Sn|SdS)a�
    Mask the email address in `ref` and return a replacement node.

    `ref` is returned unchanged if it contains no email address.

    For email addresses such as "user@host", mask the address as "user at
    host" (text) to thwart simple email address harvesters (except for those
    listed in `non_masked_addresses`).  If a PEP number (`pepno`) is given,
    return a reference including a default email subject.
    rzmailto:rNr�@z&#32;&#97;t&#32;rZhtml)�formatz?subject=PEP%%20%s)�hasattr�
startswith�non_masked_addressesr �replacer�raw)rkrBZreplacementZreplacement_textrCrCrDr3s
r3)N)rIZ
__docformat__�sysr/r4r,ZdocutilsrrrrrZdocutils.transformsrrr	r
rrrMrSr)ZSparseNodeVisitorr\rqr3rCrCrCrD�<module>s 	o23