AlkantarClanX12

Your IP : 18.188.63.71


Current Path : /opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/multiprocessing/__pycache__/connection.cpython-310.opt-2.pyc

o

6��f�{�@s�gd�ZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddl
mZm
Z
ddlmZejZzddlZddlmZmZmZmZWneybejdkr^�dZYnwd	Zd
Ze��ZdZdgZeed�r|dZedg7Zejdkr�d
Zed
g7Zefdd�Z dd�Z!dd�Z"dd�Z#dd�Z$Gdd�d�Z%er�Gdd�de%�Z&Gdd�de%�Z'Gdd�de(�Z)dPd d!�Z*ejdkr�dQd#d$�Z+ndQd%d$�Z+Gd&d'�d'e(�Z,d(d)�Z-ejdkr�Gd*d+�d+e(�Z.d,d-�Z/d.Z0d/Z1d0Z2d1Z3d2d3�Z4d4d5�Z5Gd6d7�d7e(�Z6d8d9�Z7d:d;�Z8Gd<d=�d=e)�Z9d>d?�Z:ejdk�r3d@dA�Z;ej<ej=hZ>dRdBdC�Z?nddl@Z@ee@dD��rAe@jAZBne@jCZBdRdEdC�Z?ejdk�rmdFdG�ZDdHdI�ZEe�Fe'eD�dJdK�ZGdLdM�ZHe�Fe&eG�dSdNdG�ZDdOdI�ZEe�Fe'eD�dS)S)�Client�Listener�Pipe�wait�N�)�util)�AuthenticationError�BufferTooShort)�	reduction)�
WAIT_OBJECT_0�WAIT_ABANDONED_0�WAIT_TIMEOUT�INFINITE�win32i g4@�AF_INET�AF_UNIX�AF_PIPEcCst��|S�N��time�	monotonic)�timeout�r�A/opt/alt/python310/lib64/python3.10/multiprocessing/connection.py�
_init_timeout;�rcCst��|kSrr)�trrr�_check_timeout>rrcCsV	|dkrdS|dkrtjdt��d�S|dkr'tjdt��tt�fdd�Std	��)
Nr)Z	localhostrrz	listener-)�prefix�dirrz\\.\pipe\pyc-%d-%d-�zunrecognized family)	�tempfileZmktemprZget_temp_dir�os�getpid�next�
_mmap_counter�
ValueError��familyrrr�arbitrary_addressEs��r)cCsT	tjdkr|dkrtd|��tjdkr$|dkr&tt|�s(td|��dSdSdS)NrrzFamily %s is not recognized.r)�sys�platformr&�hasattr�socketr'rrr�_validate_familySs
�r.cCsR	t|�tkr	dSt|�tur|�d�rdSt|�tus!t�|�r#dStd|��)Nrz\\rrzaddress type of %r unrecognized)�type�tuple�str�
startswithr�is_abstract_socket_namespacer&)�addressrrr�address_type_sr5c@s�eZdZdZd+dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	e
dd��Ze
dd��Ze
dd��Z
dd�Zdd�Zd,dd�Zdd�Zd-dd�Zd.d d!�Zd"d#�Zd/d%d&�Zd'd(�Zd)d*�ZdS)0�_ConnectionBaseNTcCs>|��}|dkrtd��|s|std��||_||_||_dS)Nrzinvalid handlez6at least one of `readable` and `writable` must be True)�	__index__r&�_handle�	_readable�	_writable)�self�handle�readable�writablerrr�__init__us�
z_ConnectionBase.__init__cCs|jdur|��dSdSr�r8�_close�r;rrr�__del__�s
�z_ConnectionBase.__del__cCs|jdur	td��dS)Nzhandle is closed)r8�OSErrorrBrrr�
_check_closed�s
�z_ConnectionBase._check_closedcC�|jstd��dS)Nzconnection is write-only)r9rDrBrrr�_check_readable���z_ConnectionBase._check_readablecCrF)Nzconnection is read-only)r:rDrBrrr�_check_writable�rHz_ConnectionBase._check_writablecCs$|jr
d|_td��|��td��)NFzbad message length)r:r9�closerDrBrrr�_bad_message_length�s
�z#_ConnectionBase._bad_message_lengthcCs	|jduSr�r8rBrrr�closed�s
z_ConnectionBase.closedcC�	|jSr)r9rBrrrr=��z_ConnectionBase.readablecCrNr)r:rBrrrr>�rOz_ConnectionBase.writablecCs	|��|jSr)rEr8rBrrr�fileno�sz_ConnectionBase.filenocCs.	|jdurz
|��Wd|_dSd|_wdSrr@rBrrrrJ�s

�z_ConnectionBase.closercCs�	|��|��t|�}|jdkrtt|��}t|�}|dkr$td��||kr,td��|dur5||}n|dkr=td��|||krGtd��|�||||��dS)Nrrzoffset is negativezbuffer length < offsetzsize is negativezbuffer length < offset + size)rErI�
memoryview�itemsize�bytes�lenr&�_send_bytes)r;�buf�offset�size�m�nrrr�
send_bytes�s$

z_ConnectionBase.send_bytescCs&	|��|��|�t�|��dSr)rErIrU�_ForkingPickler�dumps�r;�objrrr�send�sz_ConnectionBase.sendcCsL	|��|��|dur|dkrtd��|�|�}|dur"|��|��S)Nrznegative maxlength)rErGr&�_recv_bytesrK�getvalue)r;Z	maxlengthrVrrr�
recv_bytes�s
z_ConnectionBase.recv_bytescCs�	|��|��t|��K}|j}|t|�}|dkrtd��||kr'td��|��}|��}|||kr;t|�	���|�
d�|�||||||��|Wd�S1s[wYdS)Nrznegative offsetzoffset too large)rErGrQrRrTr&ra�tellr	rb�seek�readinto)r;rVrWrYrRZbytesize�resultrXrrr�recv_bytes_into�s(


�$�z_ConnectionBase.recv_bytes_intocCs(	|��|��|��}t�|���Sr)rErGrar\�loads�	getbuffer)r;rVrrr�recv�s
z_ConnectionBase.recv�cCs	|��|��|�|�Sr)rErG�_poll�r;rrrr�poll�s
z_ConnectionBase.pollcC�|SrrrBrrr�	__enter__�z_ConnectionBase.__enter__cC�|��dSr�rJ�r;�exc_type�	exc_valueZexc_tbrrr�__exit__rz_ConnectionBase.__exit__)TT)rNr)r)rl)�__name__�
__module__�__qualname__r8r?rCrErGrIrK�propertyrMr=r>rPrJr[r`rcrhrkrorqrxrrrrr6rs0









r6c@sBeZdZ	dZejfdd�Zdd�Zd
dd�Zd	d
�Z	dd�Z
dS)�PipeConnectionFcC�||j�dSrrL)r;Z_CloseHandlerrrrA�zPipeConnection._closec	Csntj|j|dd�\}}z#z|tjkrt�|jgdt�}Wn|���W|�d�\}}dS|�d�\}}w)NT��
overlappedF)	�_winapiZ	WriteFiler8�ERROR_IO_PENDING�WaitForMultipleObjects�eventr�cancel�GetOverlappedResult)r;rV�ov�err�waitresZnwrittenrrrrUs

���"zPipeConnection._send_bytesNc	
Cs\|jr
d|_t��S|durdnt|d�}z�tj|j|dd�\}}z@z|tjkr1t�|j	gdt
�}Wn|���W|�d�\}}|dkrUt��}|�
|���|WS|tjkra|�||�WSn2|�d�\}}|dkr�t��}|�
|���|YWS|tjkr�|�||�YWSwWtd��ty�}z	|jtjkr�t��d}~ww)NF�Tr�rz.shouldn't get here; expected KeyboardInterrupt)�_got_empty_message�io�BytesIO�minr��ReadFiler8r�r�r�rr�r��writerjZERROR_MORE_DATA�_get_more_datarD�winerror�ERROR_BROKEN_PIPE�EOFError�RuntimeError)	r;�maxsizeZbsizer�r�r�Znread�f�errrra&sR

�

���
��
����zPipeConnection._recv_bytescCs.|js
t�|j�ddkrdStt|g|��S)NrT)r�r��
PeekNamedPiper8�boolrrnrrrrmFszPipeConnection._pollcCs�|��}t��}|�|�t�|j�d}|dur%t|�||kr%|��tj	|j|dd�\}}|�
d�\}}|�|���|S)NrTr�)rjr�r�r�r�r�r8rTrKr�r�)r;r�r�rVr��leftr�Zrbytesrrrr�Ls
zPipeConnection._get_more_datar)ryrzr{r�r��CloseHandlerArUrarmr�rrrrr}s
 r}c@szeZdZ	erejfdd�ZejZej	Z
n
ejfdd�Zej
ZejZ
efdd�Ze
fdd�Zdd	�Zddd�Zd
d�Zd
S)�
ConnectioncCr~rrL�r;rArrrrAcrzConnection._closecCr~rrLr�rrrrAhrcCs8t|�}	||j|�}||8}|dkrdS||d�}q)NTr)rTr8)r;rVr��	remainingrZrrr�_sendms�zConnection._sendcCsft��}|j}|}|dkr1|||�}t|�}|dkr$||kr t�td��|�|�||8}|dks
|S)Nrzgot end of file during message)r�r�r8rTr�rDr�)r;rX�readrVr<r��chunkrZrrr�_recvvs

�
zConnection._recvcCs�t|�}|dkr%t�dd�}t�d|�}|�|�|�|�|�|�dSt�d|�}|dkr;|�|�|�|�dS|�||�dS)Ni����!i����!Qi@)rT�structZpackr�)r;rVrZZ
pre_header�headerrrrrU�s


zConnection._send_bytesNcCs^|�d�}t�d|���\}|dkr |�d�}t�d|���\}|dur*||kr*dS|�|�S)N�r�r��r�)r�r�Zunpackrb)r;r�rVrXrrrra�s


zConnection._recv_bytescCst|g|�}t|�Sr)rr�)r;r�rrrrrm�szConnection._pollr)ryrzr{r��_multiprocessingZclosesocketrAr`Z_writerkZ_readr"rJr�r�r�r�rUrarmrrrrr�\s	

r�c@sPeZdZ	ddd�Zdd�Zdd�Zed	d
��Zedd��Zd
d�Z	dd�Z
dS)rNrcCsp|p	|rt|�p	t}|pt|�}t|�|dkrt||�|_nt|||�|_|dur3t|t�s3t	d��||_
dS�Nrzauthkey should be a byte string)r5�default_familyr)r.�PipeListener�	_listener�SocketListener�
isinstancerS�	TypeError�_authkey)r;r4r(�backlog�authkeyrrrr?�s�
zListener.__init__cCs@	|jdur
td��|j��}|jrt||j�t||j�|S)Nzlistener is closed)r�rD�acceptr��deliver_challenge�answer_challenge)r;�crrrr��s

zListener.acceptcCs&	|j}|durd|_|��dSdSr)r�rJ)r;ZlistenerrrrrJ�s�zListener.closecC�|jjSr)r��_addressrBrrrr4��zListener.addresscCr�r)r��_last_acceptedrBrrr�
last_accepted�r�zListener.last_acceptedcCrprrrBrrrrq�rrzListener.__enter__cCrsrrtrurrrrx�rzListener.__exit__)NNrN)ryrzr{r?r�rJr|r4r�rqrxrrrrr�s
	

rcCsj	|pt|�}t|�|dkrt|�}nt|�}|dur%t|t�s%td��|dur3t||�t||�|Sr�)	r5r.�
PipeClient�SocketClientr�rSr�r�r�)r4r(r�r�rrrr�s


rTcCsr	|r#t��\}}|�d�|�d�t|���}t|���}||fSt��\}}t|dd�}t|dd�}||fS)NTF�r>�r=)r-Z
socketpair�setblockingr��detachr"�pipe)�duplex�s1�s2�c1�c2Zfd1Zfd2rrrrs

�rc

Cs�	td�}|rtj}tjtjB}tt}}ntj}tj}dt}}t�||tjBtj	Btj
tjBtjBd||tj
tj�}t�||dtjtjtjtj�}t�|tjdd�tj|dd�}|�d�\}	}
t||d�}t||d�}||fS)NrrrTr�r�r�)r)r��PIPE_ACCESS_DUPLEX�GENERIC_READ�
GENERIC_WRITE�BUFSIZEZPIPE_ACCESS_INBOUND�CreateNamedPipe�FILE_FLAG_OVERLAPPED�FILE_FLAG_FIRST_PIPE_INSTANCE�PIPE_TYPE_MESSAGE�PIPE_READMODE_MESSAGE�	PIPE_WAIT�NMPWAIT_WAIT_FOREVER�NULL�
CreateFile�
OPEN_EXISTING�SetNamedPipeHandleState�ConnectNamedPiper�r})
r�r4Zopenmode�accessZobsizeZibsizeZh1Zh2r��_r�r�r�rrrrs>

�
�
�	�
�c@s(eZdZ	d	dd�Zdd�Zdd�ZdS)
r�rcCs�t�tt|��|_z)tjdkr|j�tjtjd�|j�d�|j�	|�|j�
|�|j��|_Wn
t
y?|j���w||_d|_|dkr]t�|�s]tj|tj|fdd�|_dSd|_dS)N�posixrTrr��argsZexitpriority)r-�getattr�_socketr"�nameZ
setsockoptZ
SOL_SOCKETZSO_REUSEADDRr�ZbindZlistenZgetsocknamer�rDrJZ_familyr�rr3�Finalize�unlink�_unlink)r;r4r(r�rrrr?Gs*

�
��
zSocketListener.__init__cCs&|j��\}|_|�d�t|���S�NT)r�r�r�r�r�r��r;�srrrr�`s
zSocketListener.acceptcCsNz|j��W|j}|durd|_|�dSdS|j}|dur&d|_|�wwr)r�rJr�)r;r�rrrrJes
���zSocketListener.closeN)r)ryrzr{r?r�rJrrrrr�Cs

r�cCs^	t|�}t�tt|���}|�d�|�|�t|���Wd�S1s(wYdSr�)r5r-r�r�Zconnectr�r�)r4r(r�rrrr�os


$�r�c@s6eZdZ	ddd�Zddd�Zdd�Zed	d
��ZdS)
r�NcCsL||_|jdd�g|_d|_t�d|j�tj|tj|j|jfdd�|_	dS)NT)�firstz listener created with address=%rrr�)
r��_new_handle�
_handle_queuer�r�	sub_debugr�r��_finalize_pipe_listenerrJ)r;r4r�rrrr?�s�zPipeListener.__init__Fc
CsHtjtjB}|r
|tjO}t�|j|tjtjBtjBtj	t
t
tjtj�Sr)
r�r�r�r�r�r�r�r�r�ZPIPE_UNLIMITED_INSTANCESr�r�r�)r;r��flagsrrrr��s

��zPipeListener._new_handlec
Cs�|j�|���|j�d�}z	tj|dd�}Wnty3}z|jtjkr&�WYd}~t|�Sd}~wwz%zt�	|j
gdt�}Wn
|��t�
|��W|�d�\}}t|�S|�d�\}}w)NrTr�F)r��appendr��popr�r�rDr�Z
ERROR_NO_DATAr�r�rr�r�r�r})r;r<r�r��resr�r�rrrr��s0
���
�
��zPipeListener.acceptcCs$t�d|�|D]}t�|�qdS)Nz closing listener with address=%r)rr�r�r�)�queuer4r<rrrr��s�z$PipeListener._finalize_pipe_listenerr)F)ryrzr{r?r�r��staticmethodr�rrrrr�s

r�c
Cs�	t�}	zt�|d�t�|tjtjBdtjtjtjtj�}Wn t	y@}z|j
tjtjfvs5t
|�r6�WYd}~nd}~wwnqt�|tjdd�t|�S)Nr��r)rr�Z
WaitNamedPiper�r�r�r�r�r�rDr�ZERROR_SEM_TIMEOUTZERROR_PIPE_BUSYrr�r�r})r4r�hr�rrrr��s4
�������
�r��s#CHALLENGE#s	#WELCOME#s	#FAILURE#cCs�ddl}t|t�std�t|����t�t�}|�	t
|�|�||d���}|�
d�}||kr7|�	t�dS|�	t�td��)Nr� Authkey must be bytes, not {0!s}�md5�zdigest received was wrong)�hmacr�rSr&�formatr/r"�urandom�MESSAGE_LENGTHr[�	CHALLENGE�new�digestrc�WELCOME�FAILUREr�Z
connectionr�r��messagerZresponserrrr��s
�


r�cCsxddl}t|t�std�t|����|�d�}|tt�d�}|�	||d��
�}|�|�|�d�}|tkr:t
d��dS)Nrr�r�r�zdigest sent was rejected)r�r�rSr&r�r/rcrTrrrr[rrrrrrr��s
�


�r�c@s$eZdZdd�Zdd�Zdd�ZdS)�ConnectionWrappercCs6||_||_||_dD]
}t||�}t|||�qdS)N)rPrJrorcr[)�_conn�_dumps�_loadsr��setattr)r;�connr]ri�attrr_rrrr?�s
�zConnectionWrapper.__init__cCs|�|�}|j�|�dSr)r	rr[)r;r_r�rrrr`s
zConnectionWrapper.sendcCs|j��}|�|�Sr)rrcr
r�rrrrks

zConnectionWrapper.recvN)ryrzr{r?r`rkrrrrr�srcCst�|fdddd��d�S)Nr�utf-8)�	xmlrpclibr]�encode)r_rrr�
_xml_dumpssrcCst�|�d��\\}}|S)Nr)rri�decode)r�r_�methodrrr�
_xml_loadssrc@seZdZdd�ZdS)�XmlListenercCs"ddlmat�|�}t|tt�S�Nr)�
xmlrpc.client�clientrrr�rrrr^rrrr�s
zXmlListener.acceptN)ryrzr{r�rrrrrsrcOs"ddlmatt|i|��tt�Sr)rrrrrrr)r��kwdsrrr�	XmlClientsrcCs�t|�}g}|rZt�|d|�}|tkr	|St|kr$tt|�kr+nn|t8}nt|kr9tt|�krCntd��|t8}ntd��|�||�||dd�}d}|s|S)NFzShould not get hererr)	�listr�r�r
rrTrr�r�)Zhandlesr�L�readyr�rrr�_exhaustive_wait%s$
 �

��
rc
s�	|durt}n|dkrd}nt|dd�}t|�}i�g}t��t�}z�|D]�}zt|d�}Wnty@|�|��<Yq(wzt�|�dd�\}}Wnt	yj}zd|j
}}|tvr`�WYd}~nd}~ww|tjkr{|�
|�|�|j<q(|r�t��dd�dkr�z	|�d�\}	}Wnt	y�}z	|j
}WYd}~nd}~ww|s�t|d	�r�d|_��|�d}q(t���|�}W|D]}|��q�|D]D}z	|�d�\}	}Wnt	y�}z|j
}|tvr�WYd}~nd}~ww|tjk�r�|j}��|�|dk�rt|d	��rd|_q�nU|D]}|���q|D]G}z	|�d�\}	}Wnt	�yD}z|j
}|tv�r:�WYd}~nd}~ww|tjk�rc�|j}��|�|dk�rct|d	��rcd|_�qw���fd
d�|D���fdd
�|D�S)Nrr�g�?rPT�)�rFr�c3s�|]}�|VqdSrr)�.0r�)�waithandle_to_objrr�	<genexpr>�s�zwait.<locals>.<genexpr>csg|]}|�vr|�qSrr)r!�o)�
ready_objectsrr�
<listcomp>�s�wait.<locals>.<listcomp>)r�intr�setr��AttributeErrorr7r�r�rDr��
_ready_errorsr�r�r�r*Zgetwindowsversionr�r,r��addr�keysr�ZERROR_OPERATION_ABORTED�update)
�object_listrZov_listZ
ready_handlesr$rPr�r�r�r�r)r%r"rr;s�����

��

���


���
���


��r�PollSelectorcCs�	t��E}|D]	}|�|tj�q|durt��|}	|�|�}|r1dd�|D�Wd�S|durH|t��}|dkrH|Wd�Sq1sLwYdS)NTcSsg|]\}}|j�qSr)Zfileobj)r!�keyZeventsrrrr&�sr'r)�
_WaitSelector�register�	selectorsZ
EVENT_READrrZselect)r/rZselectorr_Zdeadlinerrrrr�s$
���cCsf|��}t�|tjtj��}ddlm}|�|�}t||j	|j
ffWd�S1s,wYdS)Nr)�resource_sharer)rPr-ZfromfdrZSOCK_STREAMr r5Z	DupSocket�rebuild_connectionr=r>)rr<r�r5�dsrrr�reduce_connection�s
$�r8cCs|��}t|��||�Sr�r�r�)r7r=r>Zsockrrrr6�sr6cCsB|jrtjnd|jr
tjndB}t�|��|�}t||j|jffSr)	r=r�ZFILE_GENERIC_READr>ZFILE_GENERIC_WRITEr
Z	DupHandlerP�rebuild_pipe_connection)rr��dhrrr�reduce_pipe_connection�s
�r<cC�|��}t|||�Sr)r�r})r;r=r>r<rrrr:��r:cCs t�|���}t||j|jffSr)r
ZDupFdrPr6r=r>)r�dfrrrr8�scCr=rr9)r?r=r>�fdrrrr6�r>)NN)Tr)I�__all__r�r"r*r-r�rr!�	itertoolsr�r rrr	�contextr
ZForkingPicklerr\r�rrr
r�ImportErrorr+r�ZCONNECTION_TIMEOUT�countr%r�Zfamiliesr,rrr)r.r5r6r}r��objectrrrr�r�r�r�r�rrrr�r�rrrrrrr�ZERROR_NETNAME_DELETEDr+rr4r0r2ZSelectSelectorr8r6r3r<r:rrrr�<module>s�	
�	



PT
=

,,
8	P