Your IP : 18.220.13.15


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/threading.cpython-39.opt-2.pyc

a

R�f���@sddlZddlZddlZddlZddlmZddl	m
Z
ddlmZ
mZzddlmZWneyvddlmZYn0gd�ZejZejZejZejZzejZdZe�d�Wney�d	ZYn0ej Z!z
ej"Z#Wney�dZ#Yn0ej$Z$[da%da&d
d�Z'dd
�Z(eZ)dd�Z"Gdd�d�Z*e*Z+Gdd�d�Z,Gdd�d�Z-Gdd�de-�Z.Gdd�d�Z/Gdd�d�Z0Gdd�de1�Z2e�j3Z4e4�dJdd �Z5e"�a6iZ7iZ8e
�Z9e�a:e;�a<d!d"�Z=Gd#d$�d$�Z>zdd%lm?a@mAZBWnFe�y.dd&lCmDZEdd'lmFZFeFd(d)�ZAd*d(�ZBd+d,�a@Yn0d-d.�ZGGd/d0�d0e>�ZHGd1d2�d2e>�ZIGd3d4�d4e>�ZJd5d6�ZKeKZLd7d8�ZMeMZNd9d:�ZOd;d<�ZPgZQd	aRd=d>�ZSdd?lmTZTeI�aUd@dA�ZVdBdC�ZWzddDlmXZYWn e�y�ddElZmYZYYn0dFdG�Z[e\edH��rej]e[dI�dS)K�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�ExceptHookArgsT�
get_native_idFcCs|adS�N)�
_profile_hook��func�r#�./opt/alt/python39/lib64/python3.9/threading.pyr:srcCs|adSr)�_trace_hookr!r#r#r$rDsrcOs$tdurt|i|��St|i|��Sr)�_CRLock�_PyRLock)�args�kwargsr#r#r$rRs	rc@sZeZdZdd�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__isz_RLock.__init__c	Cs\|j}zt|j}Wnty&Yn0d|j��r8dnd|jj|jj||j	t
t|��fS)Nz)<%s %s.%s object owner=%r count=%d at %s>�lockedZunlocked)r.�_active�name�KeyErrorr-r3�	__class__�
__module__�__qualname__r/�hex�id)r1�ownerr#r#r$�__repr__ns
�z_RLock.__repr__cCs|j��d|_d|_dSr+)r-�_at_fork_reinitr.r/r0r#r#r$r>}s
z_RLock._at_fork_reinitT���cCsDt�}|j|kr"|jd7_dS|j�||�}|r@||_d|_|S�N�)rr.r/r-�acquire)r1�blocking�timeout�me�rcr#r#r$rB�s
z_RLock.acquirecCs<|jt�krtd��|jd|_}|s8d|_|j��dS)N�cannot release un-acquired lockrA)r.r�RuntimeErrorr/r-�release)r1rr#r#r$rI�sz_RLock.releasecCs|��dSr�rI�r1�t�v�tbr#r#r$�__exit__�sz_RLock.__exit__cCs|j��|\|_|_dSr)r-rBr/r.)r1�stater#r#r$�_acquire_restore�s
z_RLock._acquire_restorecCs<|jdkrtd��|j}d|_|j}d|_|j��||fS)NrrG)r/rHr.r-rI)r1rr<r#r#r$�
_release_save�s

z_RLock._release_savecCs|jt�kSr)r.rr0r#r#r$�	_is_owned�sz_RLock._is_ownedN)Tr?)
�__name__r8r9r2r=r>rB�	__enter__rIrOrQrRrSr#r#r#r$r*_s

$
r*c@sxeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
ddd�Zddd�Zddd�Z
dd�ZeZdS)r	NcCs�|durt�}||_|j|_|j|_z|j|_WntyBYn0z|j|_WntybYn0z|j|_Wnty�Yn0t�|_	dSr)
r�_lockrBrIrR�AttributeErrorrQrS�_deque�_waiters�r1�lockr#r#r$r2�s$zCondition.__init__cCs|j��|j��dSr)rVr>rY�clearr0r#r#r$r>�s
zCondition._at_fork_reinitcCs
|j��Sr)rVrUr0r#r#r$rUszCondition.__enter__cGs|jj|�Sr)rVrO)r1r(r#r#r$rOszCondition.__exit__cCsd|jt|j�fS)Nz<Condition(%s, %d)>)rV�lenrYr0r#r#r$r=szCondition.__repr__cCs|j��dSr)rVrIr0r#r#r$rR	szCondition._release_savecCs|j��dSr)rVrB)r1�xr#r#r$rQszCondition._acquire_restorecCs"|j�d�r|j��dSdSdS�NFT)rVrBrIr0r#r#r$rSs
zCondition._is_ownedcCs|��std��t�}|��|j�|�|��}d}z�|durN|��d}n |dkrd|�d|�}n
|�d�}|W|�|�|s�z|j�|�WSt	y�YS0Sz|j�|�Wnt	y�Yn0n8|�|�|�sz|j�|�Wnt	�yYn00dS)Nzcannot wait on un-acquired lockFTr)
rSrHr,rBrY�appendrRrQ�remove�
ValueError)r1rD�waiterZsaved_stateZgotitr#r#r$�waitsD

��
zCondition.waitcCsXd}|}|�}|sT|durB|dur.t�|}n|t�}|dkrBqT|�|�|�}q|Sr+)�_timerd)r1Z	predicaterD�endtimeZwaittime�resultr#r#r$�wait_forHs

zCondition.wait_forrAcCsz|��std��|j}|rv|dkrv|d}z|��WntyHYn
0|d8}z|�|�WqtyrYq0qdS)Nz!cannot notify on un-acquired lockrrA)rSrHrYrIrarb)r1�n�waitersrcr#r#r$�notify_s
zCondition.notifycCs|�t|j��dSr)rkr]rYr0r#r#r$�
notify_all}szCondition.notify_all)N)N)N)rA)rTr8r9r2r>rUrOr=rRrQrSrdrhrkrlZ	notifyAllr#r#r#r$r	�s
	
0

	r	c@s6eZdZddd�Zd
dd�ZeZddd	�Zd
d�ZdS)rrAcCs&|dkrtd��tt��|_||_dS)Nrz$semaphore initial value must be >= 0)rbr	r�_cond�_value�r1�valuer#r#r$r2�szSemaphore.__init__TNcCs�|s|durtd��d}d}|j�p|jdkrr|s4q�|durd|durPt�|}n|t�}|dkrdq�|j�|�q$|jd8_d}Wd�n1s�0Y|S)Nz.can't specify timeout for non-blocking acquireFrrAT)rbrmrnrerd)r1rCrDrFrfr#r#r$rB�s$

"zSemaphore.acquirecCs`|dkrtd��|j�6|j|7_t|�D]}|j��q.Wd�n1sR0YdS)NrA�n must be one or more)rbrmrn�rangerk�r1ri�ir#r#r$rI�szSemaphore.releasecCs|��dSrrJrKr#r#r$rO�szSemaphore.__exit__)rA)TN)rA)rTr8r9r2rBrUrIrOr#r#r#r$r�s


-
rc@s eZdZddd�Zddd�ZdS)	rrAcCst�||�||_dSr)rr2�_initial_valueror#r#r$r2�szBoundedSemaphore.__init__cCsx|dkrtd��|j�N|j||jkr0td��|j|7_t|�D]}|j��qFWd�n1sj0YdS)NrArqz!Semaphore released too many times)rbrmrnrurrrkrsr#r#r$rI�s
zBoundedSemaphore.releaseN)rA)rA)rTr8r9r2rIr#r#r#r$r�s
rc@sBeZdZdd�Zdd�Zdd�ZeZdd�Zd	d
�Zddd
�Z	dS)rcCstt��|_d|_dS�NF)r	rrm�_flagr0r#r#r$r2szEvent.__init__cCs|j��dSr)rmr>r0r#r#r$r>szEvent._at_fork_reinitcCs|jSr)rwr0r#r#r$�is_setszEvent.is_setcCs:|j� d|_|j��Wd�n1s,0YdS�NT)rmrwrlr0r#r#r$�setsz	Event.setcCs0|j�d|_Wd�n1s"0YdSrv)rmrwr0r#r#r$r\)szEvent.clearNcCsD|j�*|j}|s|j�|�}|Wd�S1s60YdSr)rmrwrd)r1rDZsignaledr#r#r$rd3s
z
Event.wait)N)
rTr8r9r2r>rxZisSetrzr\rdr#r#r#r$rs
rc@s|eZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zedd��Z
edd��Zedd��ZdS)rNcCs.tt��|_||_||_||_d|_d|_dSr+)r	rrm�_action�_timeout�_parties�_stater/)r1�parties�actionrDr#r#r$r2]s	zBarrier.__init__c
Cs�|dur|j}|j��|��|j}|jd7_zL|d|jkrL|��n
|�|�|W|jd8_|��Wd�S|jd8_|��0Wd�n1s�0YdSr@)r|rm�_enterr/r}�_release�_wait�_exit)r1rD�indexr#r#r$rdms$	

��zBarrier.waitcCs(|jdvr|j��q|jdkr$t�dS)N�r?rAr)r~rmrdrr0r#r#r$r��s


zBarrier._entercCs>z"|jr|��d|_|j��Wn|���Yn0dSr@)r{r~rmrl�_breakr0r#r#r$r��szBarrier._releasecs4�j��fdd�|�s"���t��jdkr0t�dS)Ncs
�jdkSr+�r~r#r0r#r$�<lambda>��zBarrier._wait.<locals>.<lambda>r)rmrhr�rr~�r1rDr#r0r$r��s
z
Barrier._waitcCs(|jdkr$|jdvr$d|_|j��dS)Nrr�)r/r~rmrlr0r#r#r$r��s

z
Barrier._exitcCsh|j�N|jdkr6|jdkr$d|_q<|jdkr<d|_nd|_|j��Wd�n1sZ0YdS)Nrr?���)rmr/r~rlr0r#r#r$�reset�s


z
Barrier.resetcCs2|j�|��Wd�n1s$0YdSr)rmr�r0r#r#r$�abort�sz
Barrier.abortcCsd|_|j��dS�Nr�)r~rmrlr0r#r#r$r��szBarrier._breakcCs|jSr)r}r0r#r#r$r�szBarrier.partiescCs|jdkr|jSdSr+)r~r/r0r#r#r$�	n_waiting�s
zBarrier.n_waitingcCs
|jdkSr�r�r0r#r#r$�broken�szBarrier.broken)NN)N)rTr8r9r2rdr�r�r�r�r�r�r��propertyrr�r�r#r#r#r$rTs	




rc@seZdZdS)rN)rTr8r9r#r#r#r$r�sr�	Thread-%dcCs
|t�Sr)�_counter)�templater#r#r$�_newname�sr�cCsdd�tD�}t�|�dS)NcSsg|]}|��s|�qSr#)r3)�.0r[r#r#r$�
<listcomp>r�z,_maintain_shutdown_locks.<locals>.<listcomp>)�_shutdown_locks�difference_update)Z	to_remover#r#r$�_maintain_shutdown_lockss
r�c@seZdZdZd7dd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
erXdd�Zdd�Z
dd�Zdd�Zdd�Zd8dd�Zd9d!d"�Zed#d$��Zejd%d$��Zed&d'��Zer�ed(d)��Zd*d+�Zed,d-��Zejd.d-��Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZdS):rFNr#��daemoncCs�|duri}||_t|pt��|_||_||_|dur>||_n
t�j|_d|_	t
rXd|_d|_t
�|_d|_d|_tj|_t�|_t�|�dSr_)�_target�strr��_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)r1�group�targetr5r(r)r�r#r#r$r2"s&
zThread.__init__cCs>|j��|r.|jdur:|j��|j��nd|_d|_dSry)r�r>r�rBr�)r1�is_aliver#r#r$�_reset_internal_locksQs


zThread._reset_internal_lockscCs^d}|j��rd}|��|jr$d}|jr2|d7}|jdurJ|d|j7}d|jj|j|fS)N�initialZstartedZstoppedz daemonz %sz<%s(%s, %s)>)	r�rxr�r�r�r�r7rTr�)r1Zstatusr#r#r$r=bs

zThread.__repr__cCs�|jstd��|j��r td��t�|t|<Wd�n1sB0Yzt|jd�Wn>ty�t�t|=Wd�n1s�0Y�Yn0|j�	�dS)Nzthread.__init__() not calledz threads can only be started oncer#)
r�rHr�rx�_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionrdr0r#r#r$�startps

&$zThread.startcCs>z*|jr|j|ji|j��W|`|`|`n|`|`|`0dSr)r�r�r�r0r#r#r$�run�s	z
Thread.runcCs4z|��Wn"|jr(tdur(YdS�Yn0dSr)�_bootstrap_innerr�r�r0r#r#r$r��s
zThread._bootstrapcCst�|_dSr)rr�r0r#r#r$�
_set_ident�szThread._set_identcCst�|_dSr)rr�r0r#r#r$�_set_native_id�szThread._set_native_idcCsRt�|_|j��|jsNt�"t�t�|j�Wd�n1sD0YdSr)�
_set_sentinelr�rBr��_shutdown_locks_lockr�r�r�r0r#r#r$�_set_tstate_lock�s
zThread._set_tstate_lockcCs$z�|��|��tr|��|j��t� |t|j<t	|=Wd�n1sR0Yt
rjt�t
�t
rxt�t
�z|��Wn|�|�Yn0Wt�*ztt�=WnYn0Wd�n1s�0YnBt�*ztt�=WnYn0Wd�n1�s0Y0dSr)r�r�r�r�r�rzr�r4r�r�r%r�rr rr�r�rr0r#r#r$r��s6

$

&�zThread._bootstrap_innercCsN|j}|durd|_d|_|jsJt�t�Wd�n1s@0YdSry)r�r�r�r�r�rZr#r#r$�_stop�szThread._stopcCs0t�tt�=Wd�n1s"0YdSr)r�r4rr0r#r#r$�_delete�szThread._deletecCsZ|jstd��|j��s td��|t�ur2td��|durD|��n|jt|d�d�dS)N�Thread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadr)rD)r�rHr�rxr
�_wait_for_tstate_lock�maxr�r#r#r$�joins


zThread.joinTr?cCs^|j}|durdSz |�||�r0|��|��Wn&|��rR|��|���Yn0dSr)r�rBrIr�r3)r1�blockrDr[r#r#r$r�*szThread._wait_for_tstate_lockcCs|jSr)r�r0r#r#r$r5Es	zThread.namecCst|�|_dSr)r�r��r1r5r#r#r$r5PscCs|jSr)r�r0r#r#r$�identUs
zThread.identcCs|jSr)r�r0r#r#r$�	native_idbs	zThread.native_idcCs&|js|j��sdS|�d�|jSrv)r�r�rxr�r0r#r#r$r�ms	
zThread.is_alivecCs|jSr)r�r0r#r#r$r�{s
z
Thread.daemoncCs*|jstd��|j��r td��||_dS)Nr�z)cannot set daemon status of active thread)r�rHr�rxr��r1Zdaemonicr#r#r$r��s

cCs|jSrr�r0r#r#r$�isDaemon�szThread.isDaemoncCs
||_dSrr�r�r#r#r$�	setDaemon�szThread.setDaemoncCs|jSr�r5r0r#r#r$�getName�szThread.getNamecCs
||_dSrr�r�r#r#r$�setName�szThread.setName)NNNr#N)N)Tr?)rTr8r9r�r2r�r=r�r�r�r�r�r�r�r�r�r�r�r�r�r5�setterr�r�r�r�r�r�r�r�r#r#r#r$rsL	��/
	
&








r)�_excepthook�_ExceptHookArgs)�print_exception)�
namedtuplerz'exc_type exc_value exc_traceback threadcCst|�Sr)r�)r(r#r#r$r�scCs�|jtkrdStdur(tjdur(tj}n$|jdurH|jj}|durLdSndS|jdur`|jj}nt�}td|�d�|dd�t	|j|j
|j|d�|��dS)NzException in thread �:T��file�flush)r�)
�exc_type�
SystemExitr�r��threadr�r5r�print�_print_exception�	exc_value�
exc_tracebackr�)r(r�r5r#r#r$r�s&



��rcsPt�tj��durtd���dur*td��tj�t�t������fdd�}|S)Nzthreading.excepthook is Nonezsys.excepthook is Nonec
s�z�z.t}|dur�}tg���|��}||�Wn�ty�}zjd|_~�durb�jdurb�j}n|j}�d|dd��dur��jdur��j}n�}|���WYd}~n
d}~00Wd}nd}0dS)NTz"Exception in threading.excepthook:r�)rrr��__suppress_context__r�r�)r��hookr(�excr�Zsys_excepthook�Zlocal_printZ	local_sysZold_excepthookZold_sys_excepthookZsys_exc_infor#r$�invoke_excepthook�s(�"z2_make_invoke_excepthook.<locals>.invoke_excepthook)rr�rH�exc_infor�)r�r#r�r$r��s r�c@s&eZdZddd�Zdd�Zdd�ZdS)	rNcCsFt�|�||_||_|dur"|ng|_|dur4|ni|_t�|_dSr)rr2�interval�functionr(r)r�finished)r1r�r�r(r)r#r#r$r2s
zTimer.__init__cCs|j��dSr)r�rzr0r#r#r$�cancelszTimer.cancelcCs:|j�|j�|j��s,|j|ji|j��|j��dSr)r�rdr�rxr�r(r)rzr0r#r#r$r�s
z	Timer.run)NN)rTr8r9r2r�r�r#r#r#r$rs	
rc@seZdZdd�ZdS)�_MainThreadcCshtj|ddd�|��|j��|��tr6|��t�|t	|j
<Wd�n1sZ0YdS)NZ
MainThreadF�r5r�)rr2r�r�rzr�r�r�r�r4r�r0r#r#r$r2"s
z_MainThread.__init__N)rTr8r9r2r#r#r#r$r� sr�c@s.eZdZdd�Zdd�Zdd�Zd
dd	�ZdS)�_DummyThreadcCsdtj|td�dd�|j��|��tr2|��t�|t	|j
<Wd�n1sV0YdS)NzDummy-%dTr�)rr2r�r�rzr�r�r�r�r4r�r0r#r#r$r27s
z_DummyThread.__init__cCsdSrr#r0r#r#r$r�Asz_DummyThread._stopcCsdSryr#r0r#r#r$r�Dsz_DummyThread.is_aliveNcCsdSrr#r�r#r#r$r�Hsz_DummyThread.join)N)rTr8r9r2r�r�r�r#r#r#r$r�5s
r�cCs*ztt�WSty$t�YS0dSr)r4rr6r�r#r#r#r$r
Nsr
cCs8t� tt�tt�Wd�S1s*0YdSr)r�r]r4r�r#r#r#r$r\srcCstt���tt���Sr)�listr4�valuesr�r#r#r#r$�
_enumeratehsr�cCs@t�(tt���tt���Wd�S1s20YdSr)r�r�r4r�r�r#r#r#r$rlsrcOs2trtd��tj|g|�Ri|��}t�|�dS)Nz$can't register atexit after shutdown)�_SHUTTING_DOWNrH�	functools�partial�_threading_atexitsr`)r"�argr)Zcallr#r#r$�_register_atexit{s
r�)rcCs�tjr
dSdatt�D]
}|�qtjt�krFtj}|��t�	�nt
� tt�}t�
�Wd�n1sp0Y|s�q�|D]}|��|��q�qFdSry)�_main_threadr�r��reversedr�r�rr�rIr�r�r�r�r\rB)Zatexit_callZtlockZlocksr[r#r#r$�	_shutdown�s"	
&r�cCstSr)r�r#r#r#r$r�sr)�_local)rcCs�t�ai}ztt�}Wnty0t�}Yn0|at�at	�a
t��t	t��}|�t
�|D]>}||ur�|�d�t�}||_|||<q`|�d�|��q`t��t��t�|�Wd�n1s�0YdS)NTF)rr�r4rr6r�r�r,r�rzr�r��updater�r�r�r�r�r\)Z
new_activeZcurrentZthreadsr�r�r#r#r$�_after_fork�s0






r��register_at_fork)Zafter_in_child)r�)^�os�_os�sysr��_threadr��timerreZ_weakrefsetr�	itertoolsrZ_islicerr/�_collectionsrrX�ImportError�collections�__all__�start_new_threadr��
allocate_lockr,r�rrr�r`rW�errorrrr&r
r r%rrrr*r'r	rrrrrHr�__next__r�r�r�r4r�r�r�rzr�r�rr�rr�r�	tracebackr�r�r�r�rr�r�r
Z
currentThreadrZactiveCountr�rr�r�r�rr�r�rr�rZ_threading_localr��hasattrrr#r#r#r$�<module>s�




v2S)O
�5
85

?>