https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/templateutil.cpython-310.pyc
o

�]Lb���@s�ddlmZddlZddlZddlmZddlmZddlm	Z	mZm
Z
mZddlm
Z
mZGdd	�d	e	j�ZGd
d�de	j�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�dee�ZGdd�de�ZGdd�dee�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#ee�ZGd$d%�d%e�ZGd&d'�d'e�Z dzd*d+�Z!d{d,d-�Z"	(	)			.d|d/d0�Z#				.d}d1d2�Z$d3d4�Z%d5d6�Z&	.d~d7d8�Z'd9d:�Z(d;d<�Z)d=d>�Z*d?d@�Z+dAdB�Z,dCdD�Z-dEdF�Z.dGdH�Z/dIdJ�Z0dKdL�Z1dMdN�Z2ddOdP�Z3ddQdR�Z4ddSdT�Z5ddUdV�Z6dWdX�Z7dYdZ�Z8de1e9e)ee4e:e6iZ;d[d\�Z<d]d^�Z=d_d`�Z>dadb�Z?d�ddde�Z@dfdg�ZAdhdi�ZBdjdk�ZCdldm�ZDdndo�ZEdpdq�ZFdrds�ZGdtdu�ZHdvdw�ZIdxdy�ZJdS)��)�absolute_importN�)�_)�getattr)�error�pycompat�smartset�util)�dateutil�
stringutilc@�eZdZdS)�ResourceUnavailableN��__name__�
__module__�__qualname__�rr�8/usr/lib/python3/dist-packages/mercurial/templateutil.pyr
�r
c@r)�TemplateNotFoundNrrrrrrrrc@s�eZdZdZejZejdd��Zejdd��Z	ejdd��Z
ejdd	��Zejd
d��Zejdd
��Z
ejdd��Zejdd��Zejdd��Zejdd��ZdS)�wrappedz�Object requiring extra conversion prior to displaying or processing
    as value

    Use unwrapvalue() or unwrapastype() to obtain the inner object.
    cC�dS)zbTest if the specified item is in self

        The item argument may be a wrapped object.
        Nr��self�context�mapping�itemrrr�contains,�zwrapped.containscCr)z�Return a member item for the specified key

        The key argument may be a wrapped object.
        A returned object may be either a wrapped object or a pure value
        depending on the self type.
        Nr�rrr�keyrrr�	getmember3rzwrapped.getmembercCr)zjReturn the smallest item, which may be either a wrapped or a pure
        value depending on the self typeNr�rrrrrr�getmin<rzwrapped.getmincCr)ziReturn the largest item, which may be either a wrapped or a pure
        value depending on the self typeNrr"rrr�getmaxArzwrapped.getmaxcCr)z�Return new container of the same type which includes only the
        selected elements

        select() takes each item as a wrapped object and returns True/False.
        Nr�rrr�selectrrr�filterFrzwrapped.filtercCr)zYield each template mappingNr�rrrrr�itermapsNrzwrapped.itermapscCr)z�Join items with the separator; Returns a bytes or (possibly nested)
        generator of bytes

        A pre-configured template may be rendered per item if this container
        holds unprintable items.
        Nr�rrr�seprrr�joinRrzwrapped.joincCr)z�Return a bytes or (possibly nested) generator of bytes representing
        the underlying object

        A pre-configured template may be rendered if the underlying object is
        not printable.
        Nrr"rrr�show[rzwrapped.showcCr)z2Return a boolean representation of the inner valueNrr"rrr�tobooldrzwrapped.toboolcCr)z�Move the inner value object out or create a value representation

        A returned value must be serializable by templaterfilters.json().
        Nrr"rrr�tovaluehrzwrapped.tovalueN)rrr�__doc__�abc�ABCMeta�
__metaclass__�abstractmethodrr!r#r$r'r)r,r-r.r/rrrrr#s.








rc@s,eZdZdZejZdd�Zejdd��Z	dS)�mappablez:Object which can be converted to a single template mappingccs�|�|�VdS�N)�tomapr(rrrr)us�zmappable.itermapscCr)z2Create a single template mapping representing thisNrr(rrrr7xrzmappable.tomapN)
rrrr0r1r2r3r)r4r7rrrrr5psr5c@speZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�wrappedbyteszWrapper for byte stringcC�
||_dSr6��_value�r�valuerrr�__init__��
zwrappedbytes.__init__cCst|||�}||jvSr6)�	stringifyr;rrrrr��
zwrappedbytes.containscC�t�td�t�|j����Ns%r is not a dictionary�r�
ParseErrorrr�bytestrr;rrrrr!���zwrappedbytes.getmembercC�|�||t�Sr6��_getby�minr"rrrr#��zwrappedbytes.getmincCrHr6�rJ�maxr"rrrr$�rLzwrappedbytes.getmaxcCs$|js
t�td���|t�|j��S)Nsempty string)r;rrErr�iterbytestr)rrr�funcrrrrJ�szwrappedbytes._getbycCrB)Ns%r is not filterablerDr%rrrr'�rGzwrappedbytes.filtercCrB�Ns%r is not iterable of mappingsrDr(rrrr)�rGzwrappedbytes.itermapscCstt�|j�|�Sr6)�	joinitemsrrOr;r*rrrr,��zwrappedbytes.joincC�|jSr6r:r"rrrr-��zwrappedbytes.showcC�
t|j�Sr6)�boolr;r"rrrr.�r?zwrappedbytes.toboolcCrTr6r:r"rrrr/�rUzwrappedbytes.tovalueN)rrrr0r>rr!r#r$rJr'r)r,r-r.r/rrrrr8}sr8c@�heZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�wrappedvaluez2Generic wrapper for pure non-list/dict/bytes valuecCr9r6r:r<rrrr>�r?zwrappedvalue.__init__cC�t�td�|j���Ns%r is not iterable�rrErr;rrrrr��zwrappedvalue.containscCrZrCr\rrrrr!�r]zwrappedvalue.getmembercCrZr[r\r"rrrr#�r]zwrappedvalue.getmincCrZr[r\r"rrrr$�r]zwrappedvalue.getmaxcCrZr[r\r%rrrr'�r]zwrappedvalue.filtercCrZrQr\r(rrrr)�s�zwrappedvalue.itermapscCrZr[r\r*rrrr,�r]zwrappedvalue.joincCs|jdurdSt�|j�S�N�)r;rrFr"rrrr-�s
zwrappedvalue.showcCs0|jdurdSt|jt�r|jStt�|j��S)NF)r;�
isinstancerWrrFr"rrrr.�s

zwrappedvalue.toboolcCrTr6r:r"rrrr/�rUzwrappedvalue.tovalueN)rrrr0r>rr!r#r$r'r)r,r-r.r/rrrrrY�srYc@sjeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�datezWrapper for date tuple�%d %dcCstt|�\|_|_||_dSr6)�map�int�	_unixtime�	_tzoffset�_showfmt)rr=�showfmtrrrr>�s
z
date.__init__cC�t�td����Nsdate is not iterable�rrErrrrrr�rLz
date.containscCri)Nsdate is not a dictionaryrkrrrrr!�rLzdate.getmembercCrirjrkr"rrrr#�rLzdate.getmincCrirjrkr"rrrr$�rLzdate.getmaxcCrirjrkr%rrrr'�rLzdate.filtercCrirjrkr*rrrr,�rLz	date.joincCs|j|j|jfSr6)rgrerfr"rrrr-�rSz	date.showcCs|j|jd�S)N)sunixtimestzoffset�rerfr(rrrr7�rLz
date.tomapcCr�NTrr"rrrr.��zdate.toboolcCs|j|jfSr6rlr"rrrr/�zdate.tovalueN)rb)rrrr0r>rr!r#r$r'r,r-r7r.r/rrrrra�s
rac@�zeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�hybrida�Wrapper for list or dict to support legacy template

    This class allows us to handle both:
    - "{files}" (legacy command-line-specific list hack) and
    - "{files % '{file}
'}" (hgweb-style with inlining and function support)
    and to access raw values:
    - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}"
    - "{get(extras, key)}"
    - "{files|json}"
    NcCs"||_||_||_||_||_dSr6)�_gen�_values�_makemap�_joinfmt�_keytype)r�gen�values�makemap�joinfmt�keytyperrrr>s

zhybrid.__init__cCst||||j�}||jvSr6)�unwrapastypervrsrrrrrs
zhybrid.containscCs@t�|jd�st�td���t||||j�}|�||j�	|��S)N�get�not a dictionary)
r	�safehasattrrsrrErr|rv�
_wrapvalue�getrrrrr!szhybrid.getmembercCrHr6rIr"rrrr#"rLz
hybrid.getmincCrHr6rMr"rrrr$%rLz
hybrid.getmaxcCs*|js
t�td���||j�}|�||�S�Nsempty sequence)rsrrErr�)rrrrP�valrrrrJ(s
z
hybrid._getbycCs,|durdSt�|d�r|Std|||j�S)Ns_makemap)r	r�
hybriditemrt)rr r�rrrr�.s
zhybrid._wrapvaluecsXt��jd�r��fdd�t��j�D�}n��fdd��jD�}td|�j�j�j�S)Nr}cs&i|]\}}���||��r||�qSr�r���.0�k�v�r&rrr�
<dictcomp>8s��z!hybrid.filter.<locals>.<dictcomp>cs g|]}���||��r|�qSrr�)r�r�r�rr�
<listcomp>>s z!hybrid.filter.<locals>.<listcomp>)	r	rrsr�	iteritemsrqrtrurv)rrrr&rxrr�rr'6s
�z
hybrid.filterccs"�|j}|jD]}||�VqdSr6)rtrs)rrry�xrrrr)As
�
�zhybrid.itermapscst�fdd��jD�|�S)Nc3s�|]}��|�VqdSr6)ru�r�r��rrr�	<genexpr>Hs�zhybrid.join.<locals>.<genexpr>)rRrsr*rr�rr,Fszhybrid.joincCs.|j}|dur|�||d�St|�r|�S|S�N� )rrr,�callable�rrrrwrrrr-Jszhybrid.showcCrVr6)rWrsr"rrrr.Sr?z
hybrid.toboolcs@|j}t�|d�r��fdd�t�|�D�S��fdd�|D�S)Nr}csi|]\}}|t��|��qSr��unwrapvaluer��rrrrr�Zs��z"hybrid.tovalue.<locals>.<dictcomp>c�g|]}t��|��qSrr�r�r�rrr�^�z"hybrid.tovalue.<locals>.<listcomp>)rsr	rrr�)rrr�xsrr�rr/Vs�zhybrid.tovaluer6)rrrr0r>rr!r#r$rJr�r'r)r,r-r.r/rrrrrqs
	rqc@rX)r�z�Wrapper for non-list/dict object to support map operation

    This class allows us to handle both:
    - "{manifest}"
    - "{manifest % '{rev}:{node}'}"
    - "{manifest.rev}"
    cCs||_||_||_||_dSr6)rr�_keyr;rt)rrwr r=ryrrrr>js
zhybriditem.__init__cCs|�|j�Sr6)rtr�r(rrrr7prozhybriditem.tomapcC�t|||j�}|�|||�Sr6)�makewrappedr;r)rrrr�wrrrrs�zhybriditem.containscCr�r6)r�r;r!)rrrr r�rrrr!wr�zhybriditem.getmembercC�t|||j�}|�||�Sr6)r�r;r#�rrrr�rrrr#{�zhybriditem.getmincCr�r6)r�r;r$r�rrrr$r�zhybriditem.getmaxcCr�r6)r�r;r')rrrr&r�rrrr'�r�zhybriditem.filtercCr�r6)r�r;r,)rrrr+r�rrrr,�r�zhybriditem.joincCs,|j}|dur
t�|j�St|�r|�S|Sr6)rrrrFr;r�r�rrrr-�szhybriditem.showcCr�r6)r�r;r.r�rrrr.�r�zhybriditem.toboolcCst|||j�Sr6)�_unthunkr;r"rrrr/�rLzhybriditem.tovalueN)rrrr0r>r7rr!r#r$r'r,r-r.r/rrrrr�as	r�c@rp)�revslistaZWrapper for a smartset (a list/set of revision numbers)

    If name specified, the revs will be rendered with the old-style list
    template of the given name by default.

    The cachekey provides a hint to cache further computation on this
    smartset. If the underlying smartset is dynamically created, the cachekey
    should be None.
    NcCs,t|tj�sJ�||_||_||_||_dSr6)r`r�abstractsmartset�_repo�_revs�_name�cachekey)r�repo�revs�namer�rrrr>�s

zrevslist.__init__cCst|||�}||jvSr6)�
unwrapintegerr�)rrrr�revrrrr�rAzrevslist.containscCri�Nr~rkrrrrr!�rLzrevslist.getmembercC�|��}||j���Sr6)�_makehybriditemfuncr�rK�rrr�makehybriditemrrrr#��zrevslist.getmincCr�r6)r�r�rNr�rrrr$�r�zrevslist.getmaxcs.|���|j���fdd��}t|j|dd�S)Ncs��|��Sr6r��r�r�r&rr�<lambda>��z!revslist.filter.<locals>.<lambda>�r�)r�r�r'r�r�)rrrr&�frevsrr�rr'�szrevslist.filterccs$�|��}|jD]}||�VqdSr6)�_makemapfuncr�)rrryr�rrrr)�s
�
�zrevslist.itermapscs|����fdd�S)Ncstd||��Sr6)r�r��ryrrr��sz.revslist._makehybriditemfunc.<locals>.<lambda>)r�r�rr�rr��szrevslist._makehybriditemfunccs*|j�|j��r��fdd�S�fdd�S)Ncs�|d�|iS�Nsctxrr��r�r�rrr���z'revslist._makemapfunc.<locals>.<lambda>csd�|iSr�rr�)r�rrr��r�)r�r�r�rr�rr��s
zrevslist._makemapfunccCst|j|�Sr6)rRr�r*rrrr,�roz
revslist.joincCs4|jrdd�|jD�}t|||j|�S|�||d�S)NcSsg|]}d|�qS)s%dr)r�r�rrrr��sz!revslist.show.<locals>.<listcomp>r�)r�r��_showcompatlistr,)rrr�srevsrrrr-�sz
revslist.showcCrVr6)rWr�r"rrrr.�r?zrevslist.toboolcCrTr6)r�r"rrrr/�rUzrevslist.tovalue�NN)rrrr0r>rr!r#r$r'r)r�r�r,r-r.r/rrrrr��s

r�c@sZeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�ZdS)�_mappingsequencez�Wrapper for sequence of template mappings

    This represents an inner template structure (i.e. a list of dicts),
    which can also be rendered by the specified named/literal template.

    Template mappings may be nested.
    Nr_cCs0|dur
|dur
t�d��||_||_||_dS)Ns$name and tmpl are mutually exclusive)r�ProgrammingErrorr��_tmpl�_defaultsep)rr��tmplr+rrrr>�s�
z_mappingsequence.__init__cCri�Nsnot comparablerkrrrrr�rLz_mappingsequence.containscCrir�rkrrrrr!�rLz_mappingsequence.getmembercCrir�rkr"rrrr#�rLz_mappingsequence.getmincCrir�rkr"rrrr$rLz_mappingsequence.getmaxcCri)Nsnot filterable without templaterkr%rrrr'sz_mappingsequence.filtercsbt�|�����}�jr��fdd�|D�}n�jr%��fdd�|D�}nt�td���t||�S)Nc3��|]
}���j|�VqdSr6)�processr��r��m�rrrrr�
��z(_mappingsequence.join.<locals>.<genexpr>c3r�r6)�expandr�r�r�rrr�r�s not displayable without template)�_iteroverlaymapsr)r�r�rrErrR)rrrr+�mapsiter�itemiterrr�rr,s
z_mappingsequence.joincCs|�|||j�Sr6)r,r�r"rrrr-�z_mappingsequence.showcsN����g}|���D]}��||��|����fdd�t�|�D��q|S)Ncs&i|]\}}|�vr|t��|��qSrr�r��r�knownres�lmrrr�s
�z,_mappingsequence.tovalue.<locals>.<dictcomp>)�knownresourcekeysr)�
overlaymap�appendrr�)rrr�items�nmrr�rr/s��z_mappingsequence.tovalue�NNr_)
rrrr0r>rr!r#r$r'r,r-r/rrrrr��s
	
r�cs2eZdZdZd�fdd�	Zdd�Zd	d
�Z�ZS)�mappinggeneratorz�Wrapper for generator of template mappings

    The function ``make(context, *args)`` should return a generator of
    mapping dicts.
    rNr_cs$tt|��|||�||_||_dSr6)�superr�r>�_make�_args)r�make�argsr�r�r+��	__class__rrr>+s
zmappinggenerator.__init__cC�|j|g|j�R�Sr6�r�r�r(rrrr)0r]zmappinggenerator.itermapscC�t|�|��Sr6)�	_nonemptyr)r"rrrr.3rLzmappinggenerator.tobool)rNNr_�rrrr0r>r)r.�
__classcell__rrr�rr�$s
r�cs2eZdZdZd
�fdd�	Zdd�Zdd	�Z�ZS)�mappinglistz%Wrapper for list of template mappingsNr_cstt|��|||�||_dSr6)r�r�r>�	_mappings)r�mappingsr�r�r+r�rrr>:s
zmappinglist.__init__cCrVr6)�iterr�r(rrrr)>r?zmappinglist.itermapscCrVr6)rWr�r"rrrr.Ar?zmappinglist.toboolr�r�rrr�rr�7s
r�cs>eZdZdZd�fdd�	Zdd�Zdd�Z�fd	d
�Z�ZS)�mappingdictz�Wrapper for a single template mapping

    This isn't a sequence in a way that the underlying dict won't be iterated
    as a dict, but shares most of the _mappingsequence functions.
    Ncstt|��||�||_dSr6)r�r�r>�_mapping)rrr�r�r�rrr>Ls
zmappingdict.__init__cCrTr6)r�r(rrrr7PrUzmappingdict.tomapcCrrmrr"rrrr.Sszmappingdict.toboolcstt|��||�dS)Nr)r�r�r/r"r�rrr/Yszmappingdict.tovaluer�)	rrrr0r>r7r.r/r�rrr�rr�Esr�cs(eZdZdZ�fdd�Zdd�Z�ZS)�mappingnonez�Wrapper for None, but supports map operation

    This represents None of Optional[mappable]. It's similar to
    mapplinglist([]), but the underlying value is not [], but None.
    cstt|��d�dSr6)r�r�r>r�r�rrr>dr]zmappingnone.__init__cCstg�Sr6)r�r(rrrr)g�zmappingnone.itermaps)rrrr0r>r)r�rrr�rr�]sr�c@s�eZdZdZd dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
edd��Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)!�mappedgeneratoraWrapper for generator of strings which acts as a list

    The function ``make(context, *args)`` should return a generator of
    byte strings, or a generator of (possibly nested) generators of byte
    strings (i.e. a generator for a list of byte strings.)
    rcCs||_||_dSr6r�)rr�r�rrrr>ss
zmappedgenerator.__init__cCst|||�}||�||�vSr6)r@r/rrrrrwszmappedgenerator.containscCr�r6r�r(rrrrr{r]zmappedgenerator._gencCrir�rkrrrrr!~rLzmappedgenerator.getmembercCrHr6rIr"rrrr#�rLzmappedgenerator.getmincCrHr6rMr"rrrr$�rLzmappedgenerator.getmaxcCs&|�||�}|st�td���||�Sr�)r/rrEr)rrrrPr�rrrrJ�szmappedgenerator._getbyccs:�||g|�R�D]}t|||�}|t|��r|Vq	dSr6)r@r8)rrr�r�r&r��srrr�_filteredgen�s���zmappedgenerator._filteredgencCs||j|j|f}t|j|�Sr6)r�r�r�r�)rrrr&r�rrrr'�szmappedgenerator.filtercCri)Nslist of strings is not mappablerkr(rrrr)�rLzmappedgenerator.itermapscCst|�|�|�Sr6)rRrrr*rrrr,�r�zmappedgenerator.joincCs|�||d�Sr^)r,r"rrrr-�rLzmappedgenerator.showcCr�r6)r�rrr"rrrr.�rLzmappedgenerator.toboolcs��fdd�|���D�S)Ncr�r)r@r�r�rrr��r�z+mappedgenerator.tovalue.<locals>.<listcomp>)rrr"rr�rr/�szmappedgenerator.tovalueN)r)rrrr0r>rrrr!r#r$rJ�staticmethodr�r'r)r,r-r.r/rrrrr�ks"

r��key�valuecs>tj��durd�tj�t|����fdd����fdd��S)z>Wrap data to support both dict-like and string-like operationsNs%s=%scs�|��|iSr6r�r�)�datar r=rrr��r�zhybriddict.<locals>.<lambda>cs��|���|�fSr6rr�)r��fmt�prefmtrrr��r��r�identityrFrq)r�r r=r�rwr)r�r�r r�r=r�
hybriddict�s�rcs8tj��durd�tj�t||�fdd���fdd��S)z>Wrap data to support both list-like and string-like operationsNs%scs�|iSr6r�r�r�rrr��szhybridlist.<locals>.<lambda>cs��|�Sr6rr)r�r�rrr��r�r�)r�r�r�rwr)r�r�r�r�
hybridlist�s
 rr�c	s>��fdd�t�|�D�}	t||||	||�}
t|��||
d�S)z�Wrap data like hybriddict(), but also supports old-style list template

    This exists for backward compatibility with the old-style template. Use
    hybriddict() for new template keywords.
    csg|]
\}}�|�|i�qSrrr��r r=rrr��szcompatdict.<locals>.<listcomp>)r r=r�rw)rr�r�r)rrr�r�r r=r��plural�	separator�c�frrr�
compatdict�sr	c	Cs&t||||||�}t||p|||d�S)z�Wrap data like hybridlist(), but also supports old-style list template

    This exists for backward compatibility with the old-style template. Use
    hybridlist() for new template keywords.
    )r�r�rw)r�r)	rrr�r��elementr�rrrrrr�
compatlist�srcsHdd��D�}t||||dd�}t����t|��fdd��fdd��S)z�Wrap list of (dest, source) file names to support old-style list
    template and field names

    This exists for backward compatibility. Use hybriddict for new template
    keywords.
    cSsg|]	\}}||d��qS))�name�sourcerr�rrrr��sz(compatfilecopiesdict.<locals>.<listcomp>sfile_copies)rcs||�|d�S)N)r�pathr
rr���copiesrrr��r�z&compatfilecopiesdict.<locals>.<lambda>csd|�|fS)Ns%s (%s)rr�rrrr��r�)r�r	�sortdictrq)rrr�rrrrrr�compatfilecopiesdict�s


�rcCs"t||||�}t||dd�tj�S)z�Wrap list of file names to support old-style list template and field
    names

    This exists for backward compatibility. Use hybridlist for new template
    keywords.
    cSs
||d�S)N)sfilerrrrrrr�s
z!compatfileslist.<locals>.<lambda>)r�rqrr)rrr��filesrrrr�compatfileslist�s�rc#s*�|s�d}|sd|}��|�r��|��VdS����sBt|dt�r/|�|�VdS|D]}t|�}|���|Vq1dSd|}	��|	�rR��|	��V�f���fdd�	}
d�}��|�rj|��}nd}|D]}|
|�Vqn|dur�|
||d	�Vd
|}
��|
�r���|
��VdSdS)aNReturn a generator that renders old-style list template

    name is name of key in template map.
    values is list of strings or dicts.
    plural is plural of name, if not simply name + 's'.
    separator is used to join values as a string

    expansion works like this, given name 'foo'.

    if values is empty, expand 'no_foos'.

    if 'foo' not in template map, return values as a string,
    joined by 'separator'.

    expand 'start_foos'.

    for each value, expand 'foo'. if 'last_foo' in template
    map, expand it instead of 'foo' for last key.

    expand 'end_foos'.
    �ssno_Nrsstart_cs~i}z|�|�Wn)tttfy2z
|D]\}}|||<qWnttfy/||�<YnwYnw���|�}��||�Sr6)�update�AttributeError�	TypeError�
ValueErrorr�r�)r��tag�vmapping�a�b�rrr�rr�one3s
����z_showcompatlist.<locals>.oneslast_)rsend_)�preloadr�r`�bytesr,�dictr�pop)rrr�rxrr�nonamer�r��	startnamer�lastname�last�endnamerrrr�sB�

�




�r�ccs��t|t�r|�||�}t|t�r|VdSt|t�r"t�d|��|dur(dSt�|d�s6t	�
|�VdS|D]4}t|t�rE|�||�}t|t�rN|Vq8|durSq8t�|d�s`t	�
|�Vq8t|||�D]}|Vqfq8dS)z=Yield a single stream from a possibly nested set of iteratorssHMercurial IO including templates is done with bytes, not strings, got %rNs__iter__)r`rr-r!�strrr�r	rrrF�flatten)rr�thing�i�jrrrr*Rs8�



��

��r*cCs t|t�r|Sd�t|||��S)zETurn values into bytes by converting into text and concatenating themr_)r`r!r,r*�rrr+rrrr@rs
r@cCs.	|\}}|tur|S|tur|d}ndSq)z`Find symbolic name for the given compiled expression; returns None
    if nothing found reliablyTrN)�	runsymbol�	runfilter)�argrPr�rrr�findsymbolicnameys
�r2cCs$zt|�WdStyYdSw)NTF)�next�
StopIteration)�xiterrrrr��s�r�cCst|tj�s|St|||�S)z&Evaluate a lazy byte string into value)r`�types�
GeneratorTyper@r.rrrr��sr�cCs|\}}||||�S)z�Evaluate given argument as a bare template object which may require
    further processing (such as folding generator of strings)r)rrr1rPr�rrr�
evalrawexp�sr8cCst|||�}t|||�S)z)Evaluate given argument to wrapped object)r8r�)rrr1r+rrr�evalwrapped�sr9cCs4t|t�r|St|||�}t|t�rt|�St|�S)zLift object to a wrapped type)r`rr�r!r8rYr.rrrr��s

r�cC�t||t|||��S)z%Evaluate given argument as value type)r�r8�rrr1rrr�evalfuncarg�sr<cCs"t|t�r|�||�St|||�S)z.Move the inner value object out of the wrapper)r`rr/r�r.rrrr��s
r�cCsT|\}}|tur||||dd�}|durt�|�}n||||�}t|||��||�S)zCEvaluate given argument as boolean, but also takes boolean literalsN��default)r/r�	parseboolr�r.�rrr1rPr�r+rrr�evalboolean�s
�rAcC�t|||�}t||||�S)z`Evaluate given argument as a date tuple or a date string; returns
    a (unixtime, offset) tuple)r8�
unwrapdate�rrr1�errr+rrr�evaldate�srFcCsnt|t�r|�||�St|||�}zt�|�WSty't�|p%t	d���tjy6|s1�t�|��w)Nsnot a date tuple nor a string)
r`rar/r�r
�	parsedaterrrEr�rrr+rErrrrC�s

�rCcCrBr6)r8r�rDrrr�evalinteger�srIc	Cs<t|||�}zt|�WSttfyt�|ptd���w)Nsnot an integer)r�rdrrrrErrHrrrr��s
�r�cCr:r6)r@r8r;rrr�
evalstring�r]rJcCs:|\}}|tur|||||d�}n||||�}t|||�S)zXEvaluate given argument as string template, but returns symbol name
    if it is unknownr=)r/r@r@rrr�evalstringliteral�s
rKcCs6zt|}Wntyt�d|��w||||�S)zBMove the inner value object out of the wrapper and coerce its typesinvalid type specified: %r)�_unwrapfuncbytype�KeyErrorrr�)rrr+�typrrrrr|s�r|cCst|�Sr6)rd�rrr�rrr�
runinteger
r�rPcCs|Sr6rrOrrr�	runstringrnrQcs�fdd�}|S)Ncst�td����)Ns$recursive reference '%s' in template)r�Abortrr��r rr�
showrecursionrSz._recursivesymbolblocker.<locals>.showrecursionr)r rTrrSr�_recursivesymbolblockersrUr_cCs~|�||�}|dur(|��}t|�||<z|�||�}Wnty'|}Ynwt|�r=z|||�WSty<YdSw|Sr6)�symbol�copyrUr�rr�r
)rrr r>r��safemappingrrrr/s ��r/ccs�|D]	}t|||�VqdSr6)r8)rr�templater1rrr�runtemplate.s��rZc
Csl|\}}t|||�}t|dd�}zt||||�}||�WStjy5}ztjt|�t||�d��d}~ww)N�_intype��hint)r8rr|rrEr!�_formatfiltererror)rrr�r1�filtr+�intype�errrr03s
��r0cCs4t�|j�}t|�}|std�|Std�||fS)Ns(incompatible use of template filter '%s's8template filter '%s' is not compatible with keyword '%s')r�sysbytesrr2r)r1r_�fn�symrrrr^>s�r^ccs2�t|�D]\}}|�||�}||d<|VqdS)zuGenerate combined mappings from the original mapping and an iterable
    of partial mappings to override the originalsindexN)�	enumerater�)r�origmapping�newmappingsr,r�r�rrrr�Is��r�c

cs|�z|�|�}Wn#tjy+}zt|�}|s�td�|}tjt|�|d��d}~wwt|||�D]	}	t||	|�Vq2dS)Ns+keyword '%s' does not support map operationr\)r)rrEr2rr!r�r8)
rr�d�darg�targ�diterrErdr]r�rrr�	_applymapRs����rlcCs(|\}}t|||�}tt||||fd�S)N)r�)r9r�rl)rrr�rirjrhrrr�runmap_srmc

Cs�|\}}t|||�}t|t�r|�||�|��}t|||�Sz|�|||�WStjyI}zt	|�}|s6�t
d�|}	tjt|�|	d��d}~ww)Ns.keyword '%s' does not support member operationr\)r9r`r5r�r7r/r!rrEr2rr!)
rrr�ri�membrhr�rErdr]rrr�	runmemberes
��rocCst|||td��}|S)Ns"negation needs an integer argument)rIrrOrrr�	runnegateus�rpcCsX|\}}}t|||td��}t|||td��}z|||�WSty+t�td���w)Ns#arithmetic only defined on integerssdivision by zero is not defined)rIr�ZeroDivisionErrorrrR)rrr�rP�left�rightrrr�
runarithmetic|s
���rtccs.�d}|D]}|rd}n|r|V|VqdS)z9Join items with the separator; Returns generator of bytesTFNr)r�r+�firstr�rrrrR�s��rR)r�r�NNr�)r�r�NNr�)NNNr�r�r6)r_)K�
__future__rr1r6�i18nrrr�rrr	�utilsr
rrRr
r�objectrr5r8rYrarqr�r�r�r�r�r�r�r�rrr	rrrr�r*r@r2r�r�r8r9r�r<r�rArFrCrIr�rJrKr!rdrLr|rPrQrUr/rZr0r^r�rlrmrorprtrRrrrr�<module>s�M
1.(];I?
=

�
�
�K 

	



�	
	


https://t.me/RX1948 - 2025