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__/grep.cpython-310.pyc
o

�]Lb�@sxddlmZddlZddlZddlmZddlmZmZ	m
Z
mZmZdd�Z
Gdd	�d	e�Zd
d�ZGdd
�d
e�ZdS)�)�absolute_importN�)�_)�error�match�pycompat�scmutil�utilc	cs��d}d}|t|�krZ|�||�}|sdS|��\}}||�d||�d7}|�d||�dp0|}|�d|�dp>t|�d}|d}||||||||�fV|t|�ksdSdS)Nr�
r)�len�search�span�count�rfind�find)	�body�regexp�begin�linenumr�mstart�mend�lstart�lend�r�0/usr/lib/python3/dist-packages/mercurial/grep.py�
matchliness��rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�	linestatecCs||_||_||_||_dS�N)�liner�colstart�colend)�selfrrrr rrr�__init__(s
zlinestate.__init__cCs
t|j�Sr)�hashr)r!rrr�__hash__.s
zlinestate.__hash__cCs|j|jkSr)r)r!�otherrrr�__eq__1szlinestate.__eq__ccsx�|j|jfV|j}|t|j�kr:|�|j|�}|sdS|��|kr(|d7}n	|��V|��}|t|j�ksdSdS)z+Iterate all (start, end) indices of matchesrN)rr rrr�endr
)r!r�p�mrrr�findpos4s�

�zlinestate.findposN)�__name__�
__module__�__qualname__r"r$r&r*rrrrr's
rc	cs��t�d||�}|��D]U\}}}}}|dkr(t�||�D]	}d||fVqq|dkr=t�||�D]	}d||fVq2q|dkrat�||�D]	}d||fVqGt�||�D]	}d||fVqWqdS)N�insert�+�delete�-�replace)�difflib�SequenceMatcher�get_opcodesr�xrange)	�a�b�sm�tag�alo�ahi�blo�bhi�irrr�difflinestatesCs$�����r@c@sDeZdZdZ	ddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�grepsearcheraSearch files and revisions for lines matching the given pattern

    Options:
    - all_files to search unchanged files at that revision.
    - diff to search files in the parent revision so diffs can be generated.
    - follow to skip files across copies and renames.
    FcCs\||_||_||_||_||_||_t�|j�|_	t
�|�|_i|_
i|_t�|_i|_dSr)�_ui�_repo�_regexp�
_all_files�_diff�_followr	�lrucachefunc�file�_getfiler�getrenamedfn�_getrenamed�_matches�_copies�set�_skip�	_revfiles)r!�ui�repor�	all_files�diff�followrrrr"\s
zgrepsearcher.__init__cCs8|j�|i��|�}|j�|�|r|j�|�dSdS)zZExclude the given file (and the copy at the specified revision)
        from future searchN)rN�getrP�add)r!�fn�rev�copyrrr�skipfilens
�zgrepsearcher.skipfilec
cs��t�|j|||j�D][}|��}|����}t|j�|g��D]9}|j	||}|j
�|i��|�}||jvrA|r@|j�|�q |j	�|i��|pK|g�}	|	sR|rY|||	|fVq |j|=|jsf|j	�
�qdS)z�Walk files and revisions to yield (fn, ctx, pstates, states)
        matches

        states is a list of linestate objects. pstates may be empty unless
        diff is True.
        N)r�walkchangerevsrC�_preprZ�p1�sortedrQrWrMrNrPrX�clear)
r!�revs�makefilematcher�ctxrZ�parentrY�statesr[�pstatesrrr�searchfilesvs,��
�
��zgrepsearcher.searchfilesc
Csb|j|�|g�|j||}|durdSt||j�D]\}}}}t||||�}	|�|	�qdSr)rM�
setdefaultrrDr�append)
r!rYrZrr)�lnum�cstart�cendr�srrr�	_grepbody�s�zgrepsearcher._grepbodyc
Cs�|��}|dur,||}z|��WSty+}z|jtjkr �WYd}~dSd}~ww|�|�}|�|�}z|�|�WStj	yW|j
�td�|t
�|�d��YdSw)Ns8cannot search in censored file: %(filename)s:%(revnum)s
)sfilenamesrevnum)rZ�data�IOError�errno�ENOENTrJ�filenode�readr�CensoredNodeErrorrB�warnrr�bytestr)r!rdrYrZ�fctx�e�flog�fnoderrr�	_readfile�s0
���

��
��zgrepsearcher._readfilec
s�|��}|��}|j�|i�|jr|��}|j�|i�|j�|g�}|dur/|jjjj	}nt
j}|���|jrGt
��dd���|���}n�fdd�|��D�}|D]f}	|dur_|	|vr_qTd}
|jr�|�|	|�}
|
r�|
|j�|i�|	<|	|jvr�|j�|
�|	|jvr�qT|�|	�|	|j|vr�|�|	||�||	��|jr�|
p�|	}||j|vr�||vr�|�|||�||��qTWd�dS1s�wYdS)NcSsdSrr)�f�msgrrr�<lambda>�sz$grepsearcher._prep.<locals>.<lambda>c3s�|]	}�|�r|VqdSrr)�.0r~��fmatchrr�	<genexpr>�s�z%grepsearcher._prep.<locals>.<genexpr>)rZr_rMrirFrQrC�wvfs�audit�cachedr	�nullcontextmanagerrE�matchmod�badmatch�matches�filesrGrLrNrPrXrjror})r!rdr�rZ�pctxrer��contextmanager�	filenamesrYr[�pfnrr�rr^�sJ


��"�zgrepsearcher._prepN)FFF)
r+r,r-�__doc__r"r\rhror}r^rrrrrASs	
�
rA)�
__future__rr3rr�i18nr�rrr�rrr	r�objectrr@rArrrr�<module>s	

https://t.me/RX1948 - 2025