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.opt-1.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	rcsRtj�g}|D]8\}}d��fdd�t�|�D��}|�d||f�qd�|�S)z;Return a ``cmds`` argument value for the ``batch`` command.�,c3s&|]\}}d�|��|�fVqdS)s%s=%sNr)�.0�k�v�Z	escapeargrr�	<genexpr>Rs�z"encodebatchcmds.<locals>.<genexpr>s%s %s�;)rZescapebatcharg�joinr
�	iteritems�append)�req�cmds�opZargsdictrrr$r�encodebatchcmdsGs�r-c@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��|�|�S�N)�doner
�futures�Future�result�
_peerexecutor�sendcommands)r�timeoutrrrr3ds
zunsentfuture.result)N)r�
__module__�__qualname__�__doc__r3rrrrr.[sr.c@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
r1r2rA�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
Zsysstrr.�	__class__r4r>r5)rrNrrPrrrMr�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>rA�
isinstancer.r
r1r2rRr4�lenZset_running_or_notify_cancel�	strkwargs�	Exception�future_set_exception_info�sys�exc_info�
set_resultr�__self__r)r;�_submitbatchZThreadPoolExecutorrBZsubmit�_readbatchresponserC)rrZcallsrNrrOr3Zrequests�statesrr�wireresultsrrrr5�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)r5r=rCr3rBZshutdownrAr0�
set_exceptionr�
ResponseErrorr)rrrrrrH
s<
���
��zpeerexecutor.closec	
Cs�|D]�\}}}}zt|�}Wn(tyD|�t�td�d��Yq0z||�}Wn*ty|t�|t	�
�dd��Yq0|�|�qdS)Nrbr)�next�
StopIterationrcrrdrrWr
rXrYrZr[)	rr_r`rNrrrZremoteresultr3rrrr^*s��
zpeerexecutor._readbatchresponseN)
rr7r8rErGrKrSr5rHr^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:rFrrr�commandexecutorPszwirepeer.commandexecutorcCs|�dtd��|�d�S)Nsclonebundless
clone bundles)�
requirecapr�_callrFrrr�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�datarFrrr]szwirepeer.lookup.<locals>.decode�key)rirr
�	fromlocal)r�keyrrrFr�lookupYszwirepeer.lookupcs�fdd�}i|fS)Nc	sBzt�|dd��WSty<��t�td�|��Yn0dS)Nrl�unexpected response:)r�
decodelist�
ValueErrorrprrdr�rqrFrrrhszwirepeer.heads.<locals>.decoder�rrrrFr�headsfszwirepeer.headscs�fdd�}dt�|�i|fS)Nc	sDzdd�t�|�D�WSty>��t�td�|��Yn0dS)NcSsg|]}tt|���qSr)�boolro�r!�brrr�
<listcomp>t�z2wirepeer.known.<locals>.decode.<locals>.<listcomp>rx)r
Ziterbytestrrzrprrdrr{rFrrrrszwirepeer.known.<locals>.decode�nodes�r�
encodelist)r�nodesrrrFr�knownpszwirepeer.knowncs�fdd�}i|fS)Nc	sxzJi}|��D]6}|�dd�\}}t�t�|��}t�|�}|||<q|WStyr��	t
�td�|��Yn0dS)Nrmrrx)
�
splitlinesrnr
Ztolocal�urlreq�unquoterry�	TypeErrorrprrdr)rq�	branchmapZ
branchpartZ
branchnameZbranchheadsrFrrr|s

z"wirepeer.branchmap.<locals>.decoderr|rrFrr�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�debugrU�
pushkeymodZ
decodekeysr{��	namespacerrrr�s�z!wirepeer.listkeys.<locals>.decode�	namespace��capabler�r�r
ru)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: )
rnr~rorzrrdrr�r��status)rq�output�lrFrrr�s�
z wirepeer.pushkey.<locals>.decode)r�rtsoldsnewr�)rr�rv�old�newrrrFrr�s

��zwirepeer.pushkeycCs
|�d�S)Ns
stream_out)�_callstreamrFrrr�
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
Zbyteskwargsrir�get�setr(rZGETBUNDLE_ARGUMENTSrrQr�r'�sortedr~�KeyError�_callcompressablerV�anyr�getunbundlerr��changegroupmod�cg1unpacker)	r�source�kwargsrZ
bundlecapsrv�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)r}spush failed:r�Tr�)r�rr�rZsha1r'r��digestrZsafehasattr�	_callpushrrdrrorzr�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)�tuplerryrrrrr�r�z%wirepeer.branches.<locals>.<listcomp>rx)	rr�rjr�rzrprrdr)rr��nrq�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�rrmcSsg|]}t�|d��qS)�-r�)r!�prrrr�
s�z$wirepeer.between.<locals>.<listcomp>sbetween)�pairscss |]}|rt�|�pgVqdSr/)rry)r!r�rrrr%s�z#wirepeer.between.<locals>.<genexpr>rx)r
ZxrangerUr'rj�extendr�rzrprrdr)rr�Zbatch�r�ir�rqrrr�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�)�basesr}r�)rirrr�r�r�r�)rr�r}r�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�rUrZunescapebatchargr�r-�readr)r'rn)rr*r�r,r�msgZunescapeargZrsp�chunkZworkZmerged�onerrrr],s*





zwirepeer._submitbatchcCs|j|fit�|���Sr/)rjr
rV)rr,rrrrrIszwirepeer._submitoneNcCs:i}|dur||d<|dur$||d<|jd||d�|��S)N�three�four�
debugwireargs)r��two)r�)rj)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�rrrrrrrjUszwirepeer._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�	exceptionrrrrp�szwirepeer._abort)NNN)rr7r8r9rhrkrrwr}r�r�r�rr�r�r�r�r�r	r�r]rr�rjr�r�r�r�rprrrrrgDs>

	
	



-	
	
rg)(Z
__future__rrYr?Zi18nrZnoderr
rr�rr	r�r
rrr�rrZ
interfacesrZ
interfaceutilZutilsrr�rr-r1r2r.ZimplementerZipeercommandexecutor�objectr:Z
ipeercommandsZipeerlegacycommandsrDrgrrrr�<module>s&(
!
T�

Youez - 2016 - github.com/yon3zu
LinuXploit