Your IP : 18.119.253.198


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

o

7]�f���@s4	ddlZddlZddlZddlZddlmZddl	m
Z
ddlmZ
mZzddlmZWney<ddlmZYnwgd�ZejZejZejZejZzejZdZe�d�Wneydd	ZYnwej Z!zej"Z#WneyxdZ#Ynwej$Z$[da%da&d
d�Z'dd
�Z(dd�Z)dd�Z*eZ+dd�Z"Gdd�d�Z,e,Z-Gdd�d�Z.Gdd�d�Z/Gdd�de/�Z0Gdd�d�Z1Gdd�d�Z2Gd d!�d!e3�Z4ed"�j5Z6d#d$�Z7e"�a8iZ9iZ:e
�Z;e�a<e=�a>d%d&�Z?Gd'd(�d(�Z@z
dd)lmAaBmCZDWn#e�ydd*lEmFZGdd+lmHZHeHd,d-�ZCd.d,�ZDd/d0�aBYnwtBZId1d2�ZJGd3d4�d4e@�ZKGd5d6�d6e@�ZLGd7d8�d8e@�ZMd9d:�ZNd;d<�ZOd=d>�ZPd?d@�ZQdAdB�ZRdCdD�ZSgZTd	aUdEdF�ZVddGlmWZWeL�aXdHdI�ZYdJdK�ZZzddLlm[Z\Wne�y�ddMl]m\Z\YnwdNdO�Z^e_edP��r�ej`e^dQ�dSdS)R�N)�	monotonic)�WeakSet)�islice�count)�deque)�	get_ident�active_count�	Condition�current_thread�	enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock�	Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_size�
excepthook�ExceptHookArgs�gettrace�
getprofileT�
get_native_idFcC�
	|adS�N��
_profile_hook��func�r'�0/opt/alt/python310/lib64/python3.10/threading.pyr:�rcC�	tSr"r#r'r'r'r(rD�rcCr!r"��_trace_hookr%r'r'r(rHr)rcCr*r"r,r'r'r'r(rRr+rcOs&	tdurt|i|��St|i|��Sr")�_CRLock�_PyRLock)�args�kwargsr'r'r(rZsrc@s\eZdZ	dd�Zdd�Zdd�Zdd	d
�ZeZdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�_RLockcCst�|_d|_d|_dS�Nr)�_allocate_lock�_block�_owner�_count��selfr'r'r(�__init__qs
z_RLock.__init__c	Cs\|j}zt|j}Wn	tyYnwd|j��rdnd|jj|jj||j	t
t|��fS)Nz)<%s %s.%s object owner=%r count=%d at %s>�lockedZunlocked)r6�_active�name�KeyErrorr5r;�	__class__�
__module__�__qualname__r7�hex�id)r9�ownerr'r'r(�__repr__vs�
�z_RLock.__repr__cCs|j��d|_d|_dSr3)r5�_at_fork_reinitr6r7r8r'r'r(rF�s

z_RLock._at_fork_reinitT���cCsF	t�}|j|kr|jd7_dS|j�||�}|r!||_d|_|S�N�)rr6r7r5�acquire)r9�blocking�timeout�me�rcr'r'r(rJ�s
z_RLock.acquirecCsB	|jt�krtd��|jd|_}|sd|_|j��dSdS)N�cannot release un-acquired lockrI)r6r�RuntimeErrorr7r5�release)r9rr'r'r(rQ�s�z_RLock.releasecC�|��dSr"�rQ�r9�t�v�tbr'r'r(�__exit__��z_RLock.__exit__cCs|j��|\|_|_dSr")r5rJr7r6)r9�stater'r'r(�_acquire_restore�s
z_RLock._acquire_restorecCs<|jdkr	td��|j}d|_|j}d|_|j��||fS)NrrO)r7rPr6r5rQ)r9rrDr'r'r(�
_release_save�s

z_RLock._release_savecCs|jt�kSr")r6rr8r'r'r(�	_is_owned�rYz_RLock._is_ownedN�TrG)
�__name__r@rAr:rErFrJ�	__enter__rQrXr[r\r]r'r'r'r(r2gs	
$
r2c@s~eZdZ	ddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
ddd�Zddd�Zddd�Z
dd�Zdd�ZdS)r	NcCs�|durt�}||_|j|_|j|_z|j|_Wn	ty!Ynwz|j|_Wn	ty1Ynwz|j|_Wn	tyAYnwt�|_	dSr")
r�_lockrJrQr\�AttributeErrorr[r]�_deque�_waiters�r9�lockr'r'r(r:�s*���zCondition.__init__cCs|j��|j��dSr")rarFrd�clearr8r'r'r(rFs
zCondition._at_fork_reinitcCs
|j��Sr")rar`r8r'r'r(r`�
zCondition.__enter__cGs|jj|�Sr")rarX)r9r0r'r'r(rXrYzCondition.__exit__cCsd|jt|j�fS)Nz<Condition(%s, %d)>)ra�lenrdr8r'r'r(rEszCondition.__repr__cC�|j��dSr")rarQr8r'r'r(r\�zCondition._release_savecCrjr")rarJ)r9�xr'r'r(r[rkzCondition._acquire_restorecCs|j�d�r
|j��dSdS)NFT)rarJrQr8r'r'r(r]s
zCondition._is_ownedcCs�	|��s	td��t�}|��|j�|�|��}d}z7|dur(|��d}n|dkr3|�d|�}n|�d�}|W|�|�|sSz|j�|�WSt	yRYSwS|�|�|smz|j�|�Wwt	ylYwww)Nzcannot wait on un-acquired lockFTr)
r]rPr4rJrd�appendr\r[�remove�
ValueError)r9rL�waiterZsaved_stateZgotitr'r'r(�wait s@

��
���zCondition.waitcCs`	d}|}|�}|s.|dur$|durt�|}n|t�}|dkr$	|S|�|�|�}|r
|Sr3)�_timerq)r9Z	predicaterL�endtimeZwaittime�resultr'r'r(�wait_forPs 

��
zCondition.wait_forrIcCs�	|��s	td��|j}|rC|dkrE|d}z|��Wn	ty%Ynw|d8}z|�|�Wn	ty:Ynw|rG|dksdSdSdSdS)Nz!cannot notify on un-acquired lockrrI)r]rPrdrQrnro)r9�n�waitersrpr'r'r(�notifygs$	���zCondition.notifycCs	|�t|j��dSr")rxrirdr8r'r'r(�
notify_all�szCondition.notify_allcCs&	ddl}|jdtdd�|��dS)Nrz3notifyAll() is deprecated, use notify_all() instead���
stacklevel)�warnings�warn�DeprecationWarningry�r9r}r'r'r(�	notifyAll�s�zCondition.notifyAllr"�rI)r_r@rAr:rFr`rXrEr\r[r]rqrurxryr�r'r'r'r(r	�s

	
0
	r	c@s8eZdZ	ddd�Zd
dd�ZeZddd	�Zd
d�ZdS)rrIcCs&|dkrtd��tt��|_||_dS)Nrz$semaphore initial value must be >= 0)ror	r�_cond�_value�r9�valuer'r'r(r:�s
zSemaphore.__init__TNcCs�	|s|durtd��d}d}|j�M|jdkr>|sn4|dur3|dur)t�|}n
|t�}|dkr3n$|j�|�|jdks|jd8_d}Wd�|SWd�|SWd�|S1sbwY|S)Nz.can't specify timeout for non-blocking acquireFrrIT)ror�r�rrrq)r9rKrLrNrsr'r'r(rJ�s:


�
��
��
��zSemaphore.acquirecCsd	|dkr	td��|j�|j|7_t|�D]}|j��qWd�dS1s+wYdS)NrI�n must be one or more)ror�r��rangerx�r9rv�ir'r'r(rQ�s�"�zSemaphore.releasecCrRr"rSrTr'r'r(rX�rYzSemaphore.__exit__r�)TN)r_r@rAr:rJr`rQrXr'r'r'r(r�s

-
rc@s"eZdZ	ddd�Zddd�ZdS)rrIcCst�||�||_dSr")rr:�_initial_valuer�r'r'r(r:��
zBoundedSemaphore.__init__cCs|	|dkr	td��|j�(|j||jkrtd��|j|7_t|�D]}|j��q$Wd�dS1s7wYdS)NrIr�z!Semaphore released too many times)ror�r�r�r�rxr�r'r'r(rQs	�"�zBoundedSemaphore.releaseNr�)r_r@rAr:rQr'r'r'r(r�s
rc@sHeZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Z	d
S)rcCstt��|_d|_dS�NF)r	rr��_flagr8r'r'r(r:!r�zEvent.__init__cCrjr")r�rFr8r'r'r(rF%szEvent._at_fork_reinitcC�	|jSr")r�r8r'r'r(�is_set)szEvent.is_setcCs"	ddl}|jdtdd�|��S)Nrz+isSet() is deprecated, use is_set() insteadrzr{)r}r~rr�r�r'r'r(�isSet-s�zEvent.isSetcCs>	|j�d|_|j��Wd�dS1swYdS�NT)r�r�ryr8r'r'r(�set8s
"�z	Event.setcCs4	|j�d|_Wd�dS1swYdSr�)r�r�r8r'r'r(rgCs"�zEvent.clearNcCsF	|j�|j}|s|j�|�}|Wd�S1swYdSr")r�r�rq)r9rLZsignaledr'r'r(rqMs$�z
Event.waitr")
r_r@rAr:rFr�r�r�rgrqr'r'r'r(rs

rc@s~eZdZ	ddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zedd��Z
edd��Zedd��ZdS)rNcCs0	tt��|_||_||_||_d|_d|_dSr3)r	rr��_action�_timeout�_parties�_stater7)r9�parties�actionrLr'r'r(r:ws
zBarrier.__init__c
Cs�	|dur|j}|j�B|��|j}|jd7_z&|d|jkr'|��n|�|�|W|jd8_|��Wd�S|jd8_|��w1sPwYdSrH)r�r��_enterr7r��_release�_wait�_exit)r9rL�indexr'r'r(rq�s$

�
�zBarrier.waitcCs0|jdvr|j��|jdvs|jdkrt�dS)N�rGrIr)r�r�rqrr8r'r'r(r��s


�
�zBarrier._entercCs6z|jr|��d|_|j��WdS|���rH)r�r�r�ry�_breakr8r'r'r(r��szBarrier._releasecs4�j��fdd�|�s���t��jdkrt�dS)Ncs
�jdkSr3�r�r'r8r'r(�<lambda>�s
zBarrier._wait.<locals>.<lambda>r)r�rur�rr��r9rLr'r8r(r��s
�z
Barrier._waitcCs0|jdkr|jdvrd|_|j��dSdSdS)Nrr�)r7r�r�ryr8r'r'r(r��s

�z
Barrier._exitcCsl	|j�(|jdkr|jdkrd|_n|jdkrd|_nd|_|j��Wd�dS1s/wYdS)NrrG���)r�r7r�ryr8r'r'r(�reset�s


�"�z
Barrier.resetcCs6	|j�
|��Wd�dS1swYdSr")r�r�r8r'r'r(�abort�s
"�z
Barrier.abortcCsd|_|j��dS�Nr�)r�r�ryr8r'r'r(r��szBarrier._breakcCr�r")r�r8r'r'r(r��szBarrier.partiescCs	|jdkr	|jSdSr3)r�r7r8r'r'r(�	n_waiting�s
zBarrier.n_waitingcCs	|jdkSr�r�r8r'r'r(�brokens
zBarrier.broken�NNr")r_r@rAr:rqr�r�r�r�r�r�r��propertyr�r�r�r'r'r'r(rns"




rc@seZdZdS)rN)r_r@rAr'r'r'r(rsrrIcCs
|t�Sr")�_counter)Z
name_templater'r'r(�_newnamerhr�cCs	dd�tD�}t�|�dS)NcSsg|]}|��s|�qSr')r;)�.0rfr'r'r(�
<listcomp>*sz,_maintain_shutdown_locks.<locals>.<listcomp>)�_shutdown_locks�difference_update)Z	to_remover'r'r(�_maintain_shutdown_locks s	r�c@seZdZ	dZ		d7dd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
er/dd�Zdd�Z
dd�Zdd�Zdd�Zd8dd�Zd9d!d"�Zed#d$��Zejd%d$��Zed&d'��Zerded(d)��Zd*d+�Zed,d-��Zejd.d-��Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZdS):rFNr')�daemoncCs�	|duri}|rt|�}ntd�}|dur-z
|j}|d|�d�7}Wn	ty,Ynw||_||_||_||_|durA||_nt	�j
|_d|_trNd|_
d|_t�|_d|_d|_tj|_t�|_t�|�dS)Nz	Thread-%dz (�)FT)�strr�r_rb�_target�_name�_args�_kwargs�	_daemonicr
r��_ident�_HAVE_THREAD_NATIVE_ID�
_native_id�_tstate_lockr�_started�_is_stopped�_initialized�_sys�stderr�_stderr�_make_invoke_excepthook�_invoke_excepthook�	_dangling�add)r9�group�targetr=r0r1r�Ztarget_namer'r'r(r:;s<
�
zThread.__init__cCsD|j��|r|jdur|j��|j��dSdSd|_d|_dSr�)r�rFr�rJr�)r9�is_aliver'r'r(�_reset_internal_locksus


�
zThread._reset_internal_lockscCs^d}|j��r	d}|��|jrd}|jr|d7}|jdur%|d|j7}d|jj|j|fS)N�initialZstartedZstoppedz daemonz %sz<%s(%s, %s)>)	r�r�r�r�r�r�r?r_r�)r9Zstatusr'r'r(rE�s

zThread.__repr__cCs�	|jstd��|j��rtd��t�|t|<Wd�n1s"wYzt|jd�WntyLt�t|=Wd��1sFwY�w|j�	�dS)Nzthread.__init__() not calledz threads can only be started oncer')
r�rPr�r��_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionrqr8r'r'r(�start�s&	

�
���zThread.startcCsT	z!|jdur|j|ji|j��W|`|`|`dSW|`|`|`dS|`|`|`wr")r�r�r�r8r'r'r(�run�s
�z
Thread.runcCs,z|��WdS|jrtdurYdS�r")�_bootstrap_innerr�r�r8r'r'r(r��s
zThread._bootstrapcC�t�|_dSr")rr�r8r'r'r(�
_set_ident�rYzThread._set_identcCr�r")r r�r8r'r'r(�_set_native_id�rYzThread._set_native_idcCsZ	t�|_|j��|js+t�t�t�|j�Wd�dS1s$wYdSdSr")�
_set_sentinelr�rJr��_shutdown_locks_lockr�r�r�r8r'r'r(�_set_tstate_lock�s
"��zThread._set_tstate_lockcCs4zt|��|��tr|��|j��t�|t|j<t	|=Wd�n1s)wYt
r5t�t
�t
r<t�t
�z|��Wn	|�|�YWt�ztt�=WnYWd�dSWd�dS1snwYdSt�ztt�=WnYWd�wWd�w1s�wYwr")r�r�r�r�r�r�r�r<r�r�r-r�rr$rr�r�rr8r'r'r(r��sD

�

��(���zThread._bootstrap_innercCsT|j}|durd|_d|_|js(t�t�Wd�dS1s!wYdSdSr�)r�r�r�r�r�rer'r'r(�_stops"��zThread._stopcCs4	t�
tt�=Wd�dS1swYdSr")r�r<rr8r'r'r(�_deletes
"�zThread._deletecCs^	|jstd��|j��std��|t�urtd��|dur$|��dS|jt|d�d�dS)N�Thread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadr)rL)r�rPr�r�r
�_wait_for_tstate_lock�maxr�r'r'r(�join(s

zThread.joinTrGcCs\|j}|dur	dSz|�||�r|��|��WdSWdS|��r-|��|���r")r�rJrQr�r;)r9�blockrLrfr'r'r(r�Ns�zThread._wait_for_tstate_lockcCr�r")r�r8r'r'r(r=i�zThread.namecCst|�|_dSr")r�r�)r9r=r'r'r(r=tscCr�r")r�r8r'r'r(�identyszThread.identcCr�r")r�r8r'r'r(�	native_id�r�zThread.native_idcCs(	|js	|j��sdS|�d�|jSr�)r�r�r�r�r8r'r'r(r��s

zThread.is_alivecCr�r")r�r8r'r'r(r��sz
Thread.daemoncCs*|jstd��|j��rtd��||_dS)Nr�z)cannot set daemon status of active thread)r�rPr�r�r�)r9�daemonicr'r'r(r��s


cC� 	ddl}|jdtdd�|jS)Nrz:isDaemon() is deprecated, get the daemon attribute insteadrzr{�r}r~rr�r�r'r'r(�isDaemon���zThread.isDaemoncC�$	ddl}|jdtdd�||_dS)Nrz;setDaemon() is deprecated, set the daemon attribute insteadrzr{r�)r9r�r}r'r'r(�	setDaemon���
zThread.setDaemoncCr�)Nrz7getName() is deprecated, get the name attribute insteadrzr{�r}r~rr=r�r'r'r(�getName�r�zThread.getNamecCr�)Nrz7setName() is deprecated, set the name attribute insteadrzr{r�)r9r=r}r'r'r(�setName�r�zThread.setName)NNNr'Nr"r^)r_r@rAr�r:r�rEr�r�r�r�r�r�r�r�r�r�r�r�r�r=�setterr�r�r�r�r�r�r�r�r'r'r'r(r0sP��:

	
&







r)�_excepthook�_ExceptHookArgs)�print_exception)�
namedtuplerz'exc_type exc_value exc_traceback threadcCst|�Sr")r�)r0r'r'r(r�scCs�	|jtkrdStdurtjdurtj}n|jdur%|jj}|dur$dSndS|jdur1|jj}nt�}td|�d�|dd�t	|j|j
|j|d�|��dS)NzException in thread �:T��file�flush)r�)
�exc_type�
SystemExitr�r��threadr�r=r�print�_print_exception�	exc_value�
exc_tracebackr�)r0r�r=r'r'r(r�s*

�

��rcsPt�tj��dur
td���durtd��tj�t�t������fdd�}|S)Nzthreading.excepthook is Nonezsys.excepthook is Nonec
s�zczt}|dur
�}tg���|��}||�WnAtyY}z5d|_~�dur1�jdur1�j}n|j}�d|dd��durH�jdurH�j}n�}|���WYd}~n
d}~wwWd}dSWd}dSd}w)NTz"Exception in threading.excepthook:r�)rrr��__suppress_context__r�r�)r��hookr0�excr�Zsys_excepthook�Zlocal_printZ	local_sysZold_excepthookZold_sys_excepthookZsys_exc_infor'r(�invoke_excepthook%s2�����z2_make_invoke_excepthook.<locals>.invoke_excepthook)rr�rP�exc_infor�)rr'rr(r�s r�c@s(eZdZ	ddd�Zdd�Zdd�ZdS)	rNcCsFt�|�||_||_|dur|ng|_|dur|ni|_t�|_dSr")rr:�interval�functionr0r1r�finished)r9rrr0r1r'r'r(r:Ss
zTimer.__init__cCs	|j��dSr")r	r�r8r'r'r(�cancel[szTimer.cancelcCs:|j�|j�|j��s|j|ji|j��|j��dSr")r	rqrr�rr0r1r�r8r'r'r(r�_s
z	Timer.runr�)r_r@rAr:r
r�r'r'r'r(rJs

rc@seZdZdd�ZdS)�_MainThreadcCsjtj|ddd�|��|j��|��tr|��t�|t	|j
<Wd�dS1s.wYdS)NZ
MainThreadF�r=r�)rr:r�r�r�r�r�r�r�r<r�r8r'r'r(r:js
"�z_MainThread.__init__N)r_r@rAr:r'r'r'r(rhsrc@s.eZdZdd�Zdd�Zdd�Zd
dd	�ZdS)�_DummyThreadcCsftj|td�dd�|j��|��tr|��t�|t	|j
<Wd�dS1s,wYdS)NzDummy-%dTr)rr:r�r�r�r�r�r�r�r<r�r8r'r'r(r:s
"�z_DummyThread.__init__cC�dSr"r'r8r'r'r(r��sz_DummyThread._stopcCsdSr�r'r8r'r'r(r��sz_DummyThread.is_aliveNcCrr"r'r�r'r'r(r��sz_DummyThread.joinr")r_r@rAr:r�r�r�r'r'r'r(r
}s

r
cCs(	ztt�WStyt�YSwr")r<rr>r
r'r'r'r(r
�s
�r
cC� 	ddl}|jdtdd�t�S)Nrz;currentThread() is deprecated, use current_thread() insteadrzr{)r}r~rr
�r}r'r'r(�
currentThread�r�rcCs:	t�tt�tt�Wd�S1swYdSr")r�rir<r�r'r'r'r(r�s$�rcCr)Nrz7activeCount() is deprecated, use active_count() insteadrzr{)r}r~rrrr'r'r(�activeCount�r�rcCstt���tt���Sr")�listr<�valuesr�r'r'r'r(�
_enumerate�srcCsB	t�tt���tt���Wd�S1swYdSr")r�rr<rr�r'r'r'r(r�s$�rcOs4	trtd��tj|g|�Ri|��}t�|�dS)Nz$can't register atexit after shutdown)�_SHUTTING_DOWNrP�	functools�partial�_threading_atexitsrm)r&�argr1Zcallr'r'r(�_register_atexit�s
	r)rcCs�	tjrdSdatj}|��t��tt�D]}|�q	t�t	t
�}t
��Wd�n1s3wY|s<dS|D]
}|��|��q>qr�)
�_main_threadr�rr�rQr��reversedrr�rr�rgrJ)ZtlockZatexit_callZlocksrfr'r'r(�	_shutdown�s(
�
�rcCr*r")rr'r'r'r(rsr)�_local)rcCs�	t�ai}ztt�}Wntyt�}Ynw|at�at	�a
t�Bt	t��}|�t
�|D]}||urG|�d�t�}||_|||<q1|�d�|��q1t��t��t�|�Wd�dS1siwYdS)NTF)rr�r<rr>rrr4r�r�r�r�updater�r�r�r�r�rg)Z
new_activeZcurrentZthreadsr�r�r'r'r(�_after_fork.s4
�





"�r!�register_at_fork)Zafter_in_child)a�os�_os�sysr��_threadr�timerrrZ_weakrefsetr�	itertoolsrZ_islicerr7�_collectionsrrc�ImportError�collections�__all__�start_new_threadr��
allocate_lockr4r�rr r�rmrb�errorrrr.r
r$r-rrrrrr2r/r	rrrrrPr�__next__r�r�r�r<r�r�r�r�r�r�rr�rr�r�	tracebackr�r�r��__excepthook__r�rrr
r
rrrrrrrrrrrrrrZ_threading_localr!�hasattrr"r'r'r'r(�<module>s��
�
�


v;S)X
6��,5
/�5�

?>