HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //lib64/python2.7/site-packages/mercurial/minirst.pyc
�
1�3\c@@sidZddlmZddlZddlmZddlmZmZm	Z	ddl
mZd�Zd	�Z
d
�Zd�Zd�Zejd
�Zd�Zd�Zejd�Zejd�Zejd�Zejd�Zejd�Zd�ZdZd�Zd�Zd�Zejd�Zd�Z d�Z!d�Z"d�Z#d�Z$d �Z%dd!�Z'i	ed"�d#6ed$�d%6ed&�d'6ed(�d)6ed*�d+6ed,�d-6ed.�d/6ed0�d16ed2�d36Z(d4�Z)d5�Z*d6�Z+dddd7�Z,d8�Z-d9�Z.d:ddd;dd<�Z/d=�Z0d>�Z1de2d?�Z3dS(@s�simplified reStructuredText parser.

This parser knows just enough about reStructuredText to parse the
Mercurial docstrings.

It cheats in a major way: nested blocks are not really nested. They
are just indented blocks that look like they are nested. This relies
on the user to keep the right indentation for the blocks.

Remember to update https://mercurial-scm.org/wiki/HelpStyleGuide
when adding support for new constructs.
i(tabsolute_importNi(t_(tencodingtpycompatturl(t
stringutilcC@sd|dtj|�fS(Ns%s
%s

s"(Rtcolwidth(ts((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytsection#scC@sd|dtj|�fS(Ns%s
%s

t=(RR(R((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyt
subsection&scC@sd|dtj|�fS(Ns%s
%s

t-(RR(R((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyt
subsubsection)scC@sd|dtj|�fS(Ns%s
%s

t.(RR(R((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytsubsubsubsection,scC@so|jtjtj��}x8|D]0\}}|j|jd�|jd��}q"W|jtjtj��S(sB
    Apply a list of (find, replace) pairs to a text.

    >>> replace(b"foo bar", [(b'f', b'F'), (b'b', b'B')])
    'Foo Bar'
    >>> encoding.encoding = b'latin1'
    >>> replace(b'\x81\\', [(b'\\', b'/')])
    '\x81/'
    >>> encoding.encoding = b'shiftjis'
    >>> replace(b'\x81\\', [(b'\\', b'/')])
    '\x81\\'
    tascii(tdecodeRtsysstrRtreplacetencode(ttexttsubststutexttftt((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyR/s(s\n(?:\s*\n)+cC@s�g}x�tj|jd�j��D]i}|j�}|r%td�|D��}g|D]}||^qZ}|ji|d6|d6�q%q%W|S(s�Find continuous blocks of lines in text.

    Returns a list of dictionaries representing the blocks. Each block
    has an 'indent' field and a 'lines' field.
    s
cs@s+|]!}t|�t|j��VqdS(N(tlentlstrip(t.0tl((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pys	<genexpr>Rstindenttlines(t_blockretsplitRtrstript
splitlinestmintappend(RtblockstbRRR((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyt
findblocksHs%"cC@s?d}x2|t|�kr:d||d<||ddjd�r-|dt|�kr-||d}||dd|}||ddgkr�||=|d8}n�||ddjd	�r�||ddd
 ||dd<n�t||d�dkr[||ddjd�jd�r[||ddjdd
�dkr[|d7}q	n"||ddd ||dd<tj||dd�}|r�||j�7}||j�8}nxi|dt|�kr)||dd|kr)d||dd<||ddc|8<|d7}q�Wn|d7}q	W|S(s�Finds literal blocks and adds a 'type' field to the blocks.

    Literal blocks are given the type 'literal', all other blocks are
    given type the 'paragraph'.
    it	paragraphttypeRi����s::iRs ::i����t s.. itliteral(RtendswithRt
startswithtfindt	_bulletretmatchtend(R%tiRt
adjustmenttm((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytfindliteralblocksWs6
1
%$$
"1s+(\*|-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) s0^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)((.*)  +)(.*)$s:(?![: ])([^:]*)(?<! ):[ ]+(.*)s[^ ]s
(=+\s+)*=+cC@sOdttfdttfdttfdttfg}d�}d}x|t|�krJ||ddkr=||d	}x�|D]�\}}}||d||�r�g}xqt|�D]c\}	}
|||	||�r|ji|d6gd	6||d
d
6�n|dd	j|
�q�W||||d+Pq�q�Wn|d7}qHW|S(
sSplit paragraphs into lists.tbullettoptiontfieldt
definitioncS@s�||}|dt|�kr.||dp1d}|j|�sGtS|ry|dkpx|dd!dkpx|j|�S|jd�SdS(s�Does itemre match an item at line i?

        A list item can be followed by an indented line or another list
        item (but only if singleline is True).
        itiR*N(RR0tFalseR-(RR2titemret
singlelinetline1tline2((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyR0�s
*,iR)R(RRi����i(	R/tTruet	_optionret_fieldret
_definitionreR;Rt	enumerateR$(R%t	listtypesR0R2RR)R<R=titemstjtline((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytsplitparagraphs�s*	icC@s�d}x�|t|�kr�||ddkr?|d7}q	n|}x�|t|�kr�||ddkr�tj||dd�}|j�\}}|||dd<|||d<|d7}qHW|d}q	W|S(sFind key for field lists.iR)R8iRtkey(RRBR0tgroups(R%R2RGR4RJtrest((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytupdatefieldlists�s
)c
C@s�d}x�|t|�kr�||ddkr?|d7}q	nd}|}x-|t|�krz||ddkrztj||dd�}|jd�}|jd�}|dj�}|jd�j�}|jd	�j�}	|||dd<d
}
|sd}
nd|r!d
|p$d
d|
||	ff}|j�}|||d<t|tj|��}|d7}qNWx|||!D]}||d<q�W|d}q	W|S(NiR)R7iRiiiiR:s   s%s%ss-%s s	%s--%s %stoptstrtoptstrwidth(	RRAR0tgrouptstripR!tmaxRR(
R%R2RORGR4tshortoptiontgroup3t
longoptiontdesct
longoptionargt	noshortoptopttblock((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytupdateoptionlists�s:
)		c
C@sfg}d}xM|dt|�kr[||ddkrN||ddjd�rN||d}||dd|}||ddd}t}x,|D]$}||jd	�kr�t}q�q�W|r�|j|�n||=|}	|d8}x[|	t|�krJ||	d|krJ|r)||	=q�||	dc|8<|	d7}	q�Wn|d7}qW||fS(
s�Prune unwanted containers.

    The blocks must have a 'type' field, i.e., they should have been
    run through findliteralblocks first.
    iiR)R(Rs.. container::RiR
(RR-R@R R;R$(
R%tkeeptprunedR2RR3t
containertypetprunetcRG((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytprunecontainers�s0


)
s^([-=`:.'"~^_*+#])\1+$c
C@s�x�|D]�}|ddkrt|d�dkrtj|dd�r|dd|ddkrd|d<t|d<|dd}gtjt|��D]F}|||d	!d
kr�|dks�||d	|!dkr�|^q�}g}x�|dd	d!D]�}||kr$t|d<qng}|d}x�t|�D]�\}	}
|	d	t|�kr�||	d	|
}tj	|||�}|t|�7}|j
|j��qA|j
||j��qAW|j
|�qW||d<qqW|S(sQFind simple tables

       Only simple one-line table elements are supported
    R)R(Riii����ttabletheaderiR	R*(Rt_tablereR0R;RtxrangeR@RDRtgetcolsR$RQ(
R%RZtdivtxtcolumnstrowsRtrowtpostntstarttwidthtv((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyt
findtables&s8
	

##

cC@s�x�|D]�}|ddkrt|d�dkrtj|dd�t|dd�krtj|dd�r|dddd!|d<d|d<|dd=qqW|S(	s�Finds sections.

    The blocks must have a 'type' field, i.e., they should have been
    run through findliteralblocks first.
    R)R(Riiit	underlineR(RRRt
_sectionreR0(R%RZ((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytfindsectionsYs
+
cC@s[dg}xK|D]C}|ddkrg|dD]}t||�^q1|d<qqW|S(	Ns``t"R)R(RR(s``Ru(R(R(R(R%RR&R((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytinlineliteralsos
	
1cC@s^d	d
g}xK|D]C}|ddkrg|dD]}t||�^q4|d<qqW|S(Ns:hg:`s'hg t`t'R)R(RR(s:hg:`s'hg (RwRx(R(R(R(R%RR&R((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pythgrolevs

1cC@s�d}x�|t|�kr�||d||ddkr\||ddkr\|d7}q	||dds{|d7}q	|j|idgd6dd	6d
d6�|d7}q	W|S(
s�Adds empty blocks for vertical spacing.

    This groups bullets, options, and definitions together with no vertical
    space between them, and adds an empty block between all other blocks.
    iR)R6R7R8RR:iRtmargini(R6R7R8(Rtinsert(R%R2((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyt
addmargins�s 

(cC@s�d}x�|t|�kr�||}|ddkr�|ddjd�s_|ddgkr�||=|t|�kr�||ddkr�||=q�q	|d7}q	W|S(	sRemove comments.iR)R(Rs.. s..Rzi(RR-(R%R2R&((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyt
prunecomments�s
'&
cC@s'|ptj�}tjddjt|��dtj�}d}x�|t|�kr"|j||dd�}|rd||d<||ddd|j	�d	!j
�}||dd|j	�d
}|r�||djd
d|�n|||d<||dd=n|d
}qFW|S(
sj
    Makes the type of the block an admonition block if
    the first line is an admonition directive
    s\.\. (%s)::t|tflagsiRt
admonitionR)iiis   tadmonitiontitle(t_admonitiontitlestkeystretcompiletjointsortedt
IGNORECASERR0R1tlowerR{(R%tadmonitionstadmonitionreR2R4R�t	firstline((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytfindadmonitions�s ) s
Attention:t	attentionsCaution:tcautions!Danger!tdangersError:terrorsHint:thints
Important:t	importantsNote:tnotesTip:ttipsWarning!twarningcC@s�djttj|d��}tj|d�}|d}|d}d|dd||f}dtj|�d}dtj||d|d	|�S(
NR*RRNiROs%s%s  s %s
t
initindentt
hangindent(R�tmaptbytesRQRRRtwrap(RZRoRVRtusablewidththangingR�R�((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytformatoption�s

c
C@s�|dkrd}nd|d}|ddkr�t|d}|dsW||d	St|dd
�t|dd
j��}||d}djttj|d��}d||tj|d|d
|d|�fS|ddkr�d	S|ddkr(|d7}|d	|j|d�d	S|ddkrst	j
|dd�|d}d||dd||fS|ddkr�|d}gt|�D].}	tg|	D]}
t	j
|
�^q��^q�}d}t
|�t|�d}d|d}dt|�||d
}x�|D]�}
g}xEt||
�D]4\}}d|t	j
|�}|j||�q;Wdj|�}tj|d|d
|d|�}|r�|dr�|d	|dt||�d	}q||d	7}qW|S|ddkr�||dd}t|dd
�t|dd
j��}||d}djttj|dd��}d|tj|d|d
|d|�fS|}|ddkr|ddjd�r�|ddd|dd<q�tj|dd�}||j�d}n�|ddkr�|d}|td}t|�dtkr`|j|�}n|jt�}||dd|dd<n|dd kr�t||�Sdjttj|d��}tj|d|d
|d|�d	S(!s"Format a block according to width.iiNR*RR)R�R�Rs
i����s%s
%s
RoR�R�RzR+s  RRrs
%s%s
%s%s
RbR:iRcRR9R6s| iR8RJR7(R�RRR�R�R�RQRR�RRtzipRRtsumR$R#R-R/R0R1t_fieldwidthtljustR�(RZRoRR�thangt	defindentRRrRbR`tetwidthstspanRkRtwRptpadttermt	subindentR4RJ((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytformatblock�s�	
,


A
	&,#

c@s�g�d}g�d�}��fd�}g|D]}|ddkr4|^q4}xvt|�D]h\}}|d}|d}|d}|dkr�|t|d	�}	|d
jttj|���}
�jd|	|
f�n8|dkr�jd
|dj|���n	|dkr&n�|dkrU�jd|dj|���n�|dkr�|d}||kr�||7}n|j|�d}�jd|||d�|f�nb|dkrq|d}�jd�x}|D]u}
�jd�xH|
D]@}�jd��j||���jd��jd�qW�j��jd�q�W�jd�n�|dkr�|d|�||d�}|d
jttj|d���}
�jd||
f�nG|d krX|dj	d
d�\}}|d-kr|d#|�n
|d$|��jd%|d
j|g|d���n�|d&kr�|d|�||d'�}|d
jttj|���}
�jd||
f�nd|d(kr |d|�||d)�}|d
jttj|���}�jd||f�n�rc�d*\}}|t
|�dkrj�jd+|��j�q�||d}|d}||ks�||kr�|dd,kr��jd+|��j�q�qcqcWdj��S(.sFormat RST blocks as HTMLR:cS@stj|t�S(N(RtescapeR@(R((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyR�.sc@sF�s�dd|krB�j||f��jd|�ndS(Ni����is<%s>
(R$(Rntlevel(tlistnesttout(s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytopenlist1sR)RzRRR�R�R*s<p>
<b>%s</b> %s
</p>
R(s<p>
%s
</p>
s
R+s<pre>
%s
</pre>
RRris<h%d>%s</h%d>
iRbs<table>
s<tr>s<td>s</td>s</tr>
s	</table>
R9tdls <dt>%s
 <dd>%s
R6t*Rtultols	 <li> %s
R8RJR7RNi����s</%s>
sdefinition bullet field option(R�R(RDR�R�R�R�RQR$tindextpopR R(R%t
headernestR�R�R&RltbtypeR�RR�RR2RbRkRpR�R6theadRJRYRVRntnbtni((R�R�s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyt
formathtml's�	)


!##

'








%
.
!
!

cC@s�g}t|�}x|D]}|dc|7<qWt|�}t|�}t||pZg�\}}t|�}t|�}t|�}t|�}t|�}t	|�}t
|d|�}t|�}t|�}||fS(s Parse text into a list of blocksRR�(
R'R5RqRaRtRvRyRIRMR[R�R|R}(RRR\R�R]R%R&((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytparse�s"
c@s#dj�fd�|D��}|S(NR:c3@s|]}t|��VqdS(N(R�(RR&(Ro(s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pys	<genexpr>�s(R�(R%RoR((Ros7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytformatblocks�sc@sdj�fd�|D��S(s"Format parsed blocks as plain textR:c3@s|]}t|��VqdS(N(R�(RR&(Ro(s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pys	<genexpr>�s(R�(R%Ro((Ros7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytformatplain�siPtplaincC@s`t|||pg�\}}|r6t||�}n|dkrLt|�St|d|�SdS(s-Parse and format the text according to width.thtmlRoN(R�tfiltersectionsR�R�(RRoRR\tstyleRR%R]((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytformat�s
cC@s�g}t|�}g}d}g}g}t}x�|t|�kr�||\}}	}
||	3|j|�||ks�|jd|�r�||krvt|�}t|�}|r�||kr�t}ng}
x�tjd|d�D]r}||}||ks|||kr�|
jt|��||d}|j|d�|j|d�q�q�W|
rv|j|
�qvn|}|j|
�xT|dt|�kr�||dd|	kr�|d7}|j||d�q�Wn|d7}q3W|r�|j	�x�|D]�}
g|
D]}||dd^q}|
dd}||d}ddj
||dg�jd	d
�|d<||
d|5qWn|S(s�Select parsed blocks under the specified section

    The section name is separated by a dot, and matches the suffix of the
    full section path.
    iR
iiii����Rs"%s"RuR:(t_getsectionsR@RR$R,R;RRetextendtreverseR�R(R%RtparentstsectionsR2tlastparentst	synthetictcollapsetpathtnestR&tllentplenRRGtparenttsectsyntrealtrealline((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyR��sX
	

1


%+cC@sfd}d}d}g}d�}x>|D]6}|ddkr�|d}||kra||7}n|j|�d}|| }|| ||�f}|jdj|�||gf�q(|ddkrd}||kr�||7}n|j|�d}|| }x�tdt|�d�D]�}||}|d|krEPng|dD]}	|	dd	krP|	^qP}
|
r |
d
d}|d}||kr�|d7}Pq�||kr�|d}Pq�q q W|| ||�f}|jdj|�||gf�q(|s"ddgfg}n|ddkrId}
|d}x�|
t|�kr�||
dd}|ddkr�|d}t|d�dkr�|t|dd�t|ddjd��7}n||kr�Pq�n|
d7}
qEW|
dkrI||
d}|d|dkr-|d7}n|jd|gf�qIn|d
dj|�q(W|S(s=return a list of (section path, nesting level, blocks) tuplesR:icS@si|ddkr|d}n|dd}tj|�jd�}d|kre|jd�d}n|S(NR)R8RJRiRut((RR�RQR (R&Rh((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pytgetname�s
R)RRriR
R9R8R*ii����RRzR((R9R8(R�R$R�trangeRR(R%R�tnamesR�tsecsR�R&R2R�tatsiblingst
siblingindentRtpointertbindentRtsindenttblevel((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyR��st	




%

 -


%

"
cC@sMgt|�D]}td�|D��^q
}d|}|djd�|D��d}|g}x�|D]�}g}xvt||�D]e\}	}
d|
kr�djd�|
jd�D��}
nd|	tj|
�}|j|
|�q�W|j|dj|�d�qjW|r<t|�dkr<|jd|�n|j|�|S(sAGenerate an RST table for the given table data as a list of linescs@s|]}tj|�VqdS(N(RR(RR�((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pys	<genexpr>+sR*cs@s|]}d|VqdS(R	N((RR�((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pys	<genexpr>-ss
cs@s|]}|j�VqdS(N(R(RR�((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pys	<genexpr>6sii(	R�RRR�R RRR$RR{(tdataRRcR`R�RgR�RkRR�RpR�((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyt	maketable(s /
!	
%"
(4t__doc__t
__future__RR�ti18nRR:RRRtutilsRRR
RRRR�RR'R5R/RARBRCRdRIR�RMR[RaRsRqRtRvRyR|R}tNoneR�R�R�R�R�R�R�R�R�R�R�R;R�(((s7/usr/lib64/python2.7/site-packages/mercurial/minirst.pyt<module>sf							9	*		$	)	3					







		S	[		
	7	I