ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/threading.cpython-38.opt-2.pyc

U

.��c���@s.ddlZddlZddlZddlmZddlm	Z	ddl
mZm
ZzddlmZWn ek
rpddlmZYnXdddd	d
ddd
dddddddddddddddgZejZejZejZejZzejZdZe�d�Wnek
r�dZYnXejZ z
ej!Z"Wnek
�rdZ"YnXej#Z#[da$da%d d�Z&d!d�Z'eZ(d"d�Z!Gd#d$�d$�Z)e)Z*Gd%d�d�Z+Gd&d�d�Z,Gd'd�de,�Z-Gd(d
�d
�Z.Gd)d�d�Z/Gd*d�de0�Z1e�j2Z3e3�dKd,d-�Z4e�a5iZ6iZ7e	�Z8e�a9e:�a;Gd.d�d�Z<zdd/lm=a>m?Z@WnHek
�rRdd0lAmBZCdd1lmDZDeDdd2�Z?d3d�Z@d4d�a>YnXd5d6�ZEGd7d�de<�ZFGd8d9�d9e<�ZGGd:d;�d;e<�ZHd<d	�ZIeIZJd=d�ZKeKZLd>d?�ZMd@d
�ZNddAlmOZOeG�aPdBdC�ZQdDd�ZRzddElmSZTWn"ek
�rddFlUmTZTYnXdGdH�ZVeWedI��r*ejXeVdJ�dS)L�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/python38/lib64/python3.8/threading.pyr9scCs|adSr)�_trace_hookr!r#r#r$rCscOstdkrt||�St||�Sr)�_CRLock�_PyRLock)�args�kwargsr#r#r$rQs	
c@sReZdZdd�Zdd�Zddd�ZeZd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�_RLockcCst�|_d|_d|_dS�Nr)�_allocate_lock�_block�_owner�_count��selfr#r#r$�__init__hsz_RLock.__init__c	Cs^|j}zt|j}Wntk
r(YnXd|j��r:dnd|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__ms
�z_RLock.__repr__T���cCsDt�}|j|kr"|jd7_dS|j�||�}|r@||_d|_|S�N�)rr.r/r-�acquire)r1�blocking�timeout�me�rcr#r#r$rA|s
z_RLock.acquirecCs<|jt�krtd��|jd|_}|s8d|_|j��dS)N�cannot release un-acquired lockr@)r.r�RuntimeErrorr/r-�release)r1rr#r#r$rH�sz_RLock.releasecCs|��dSr�rH�r1�t�v�tbr#r#r$�__exit__�sz_RLock.__exit__cCs|j��|\|_|_dSr)r-rAr/r.)r1�stater#r#r$�_acquire_restore�s
z_RLock._acquire_restorecCs<|jdkrtd��|j}d|_|j}d|_|j��||fS)NrrF)r/rGr.r-rH)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=rA�	__enter__rHrNrPrQrRr#r#r#r$r*^s

$
r*c@speZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
ddd�Zddd�Zdd�Z
e
ZdS)r	NcCs�|dkrt�}||_|j|_|j|_z|j|_Wntk
rDYnXz|j|_Wntk
rfYnXz|j|_Wntk
r�YnXt�|_	dSr)
r�_lockrArHrQ�AttributeErrorrPrR�_deque�_waiters�r1�lockr#r#r$r2�s$zCondition.__init__cCs
|j��Sr)rUrTr0r#r#r$rT�szCondition.__enter__cGs|jj|�Sr)rUrN)r1r(r#r#r$rN�szCondition.__exit__cCsd|jt|j�fS)Nz<Condition(%s, %d)>)rU�lenrXr0r#r#r$r=�szCondition.__repr__cCs|j��dSr)rUrHr0r#r#r$rQ�szCondition._release_savecCs|j��dSr)rUrA)r1�xr#r#r$rPszCondition._acquire_restorecCs"|j�d�r|j��dSdSdS)NrFT)rUrArHr0r#r#r$rRs
zCondition._is_ownedcCs�|��std��t�}|��|j�|�|��}d}z>|dkrN|��d}n |dkrd|�d|�}n
|�d�}|W�S|�|�|s�z|j�|�Wnt	k
r�YnXXdS)Nzcannot wait on un-acquired lockFTr)
rRrGr,rArX�appendrQrP�remove�
ValueError)r1rC�waiterZsaved_stateZgotitr#r#r$�waits*

zCondition.waitcCsXd}|}|�}|sT|dk	rB|dkr.t�|}n|t�}|dkrBqT|�|�|�}q|Sr+)�_timera)r1Z	predicaterC�endtimeZwaittime�resultr#r#r$�wait_for>s

zCondition.wait_forr@c	Csf|��std��|j}tt||��}|s,dS|D]0}|��z|�|�Wq0tk
r^Yq0Xq0dS)Nz!cannot notify on un-acquired lock)rRrGrXrW�_islicerHr^r_)r1�nZall_waitersZwaiters_to_notifyr`r#r#r$�notifyUs
zCondition.notifycCs|�t|j��dSr)rhr[rXr0r#r#r$�
notify_alllszCondition.notify_all)N)N)N)r@)rSr8r9r2rTrNr=rQrPrRrarerhriZ	notifyAllr#r#r#r$r	�s
	
0

	c@s4eZdZddd�Zd
dd�ZeZdd	�Zd
d�ZdS)rr@cCs&|dkrtd��tt��|_||_dS)Nrz$semaphore initial value must be >= 0)r_r	r�_cond�_value�r1�valuer#r#r$r2�szSemaphore.__init__TNc	Cs�|s|dk	rtd��d}d}|j�f|jdkrr|s4q�|dk	rd|dkrPt�|}n|t�}|dkrdq�|j�|�q$|jd8_d}W5QRX|S)Nz.can't specify timeout for non-blocking acquireFrr@T)r_rjrkrbra)r1rBrCrErcr#r#r$rA�s$

zSemaphore.acquirec	Cs.|j�|jd7_|j��W5QRXdSr?)rjrkrhr0r#r#r$rH�szSemaphore.releasecCs|��dSrrIrJr#r#r$rN�szSemaphore.__exit__)r@)TN)rSr8r9r2rArTrHrNr#r#r#r$rxs


-c@seZdZddd�Zdd�ZdS)rr@cCst�||�||_dSr)rr2�_initial_valuerlr#r#r$r2�szBoundedSemaphore.__init__c	CsB|j�2|j|jkrtd��|jd7_|j��W5QRXdS)Nz!Semaphore released too many timesr@)rjrkrnr_rhr0r#r#r$rH�s

zBoundedSemaphore.releaseN)r@)rSr8r9r2rHr#r#r#r$r�s
c@sBeZdZdd�Zdd�Zdd�ZeZdd�Zd	d
�Zddd
�Z	dS)rcCstt��|_d|_dS�NF)r	rrj�_flagr0r#r#r$r2�szEvent.__init__cCs|j�t��dSr)rjr2rr0r#r#r$�_reset_internal_locks�szEvent._reset_internal_lockscCs|jSr)rpr0r#r#r$�is_setszEvent.is_setc	Cs&|j�d|_|j��W5QRXdS�NT)rjrprir0r#r#r$�setsz	Event.setc	Cs|j�d|_W5QRXdSro)rjrpr0r#r#r$�clearszEvent.clearNc
Cs8|j�(|j}|s|j�|�}|W5QR�SQRXdSr)rjrpra)r1rCZsignaledr#r#r$ras
z
Event.wait)N)
rSr8r9r2rqrrZisSetrtrurar#r#r#r$r�s
c@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	rrj�_action�_timeout�_parties�_stater/)r1�parties�actionrCr#r#r$r2Fs	zBarrier.__init__c
Cs�|dkr|j}|j�r|��|j}|jd7_z6|d|jkrL|��n
|�|�|W�W5QR�S|jd8_|��XW5QRXdSr?)rwrj�_enterr/�_exitrx�_release�_wait)r1rC�indexr#r#r$raVs	

zBarrier.waitcCs(|jdkr|j��q|jdkr$t�dS)N�r>r@r)ryrjrarr0r#r#r$r|ts


zBarrier._entercCs>z"|jr|��d|_|j��Wn|���YnXdSr?)rvryrjri�_breakr0r#r#r$r~szBarrier._releasecs4�j��fdd�|�s"���t��jdkr0t�dS)Ncs
�jdkSr+�ryr#r0r#r$�<lambda>��zBarrier._wait.<locals>.<lambda>r)rjrer�rry�r1rCr#r0r$r�s
z
Barrier._waitcCs(|jdkr$|jdkr$d|_|j��dS)Nrr�)r/ryrjrir0r#r#r$r}�s

z
Barrier._exitc	CsT|j�D|jdkr6|jdkr$d|_q<|jdkr<d|_nd|_|j��W5QRXdS)Nrr>���)rjr/ryrir0r#r#r$�reset�s


z
Barrier.resetc	Cs|j�|��W5QRXdSr)rjr�r0r#r#r$�abort�sz
Barrier.abortcCsd|_|j��dS�Nr�)ryrjrir0r#r#r$r��szBarrier._breakcCs|jSr)rxr0r#r#r$rz�szBarrier.partiescCs|jdkr|jSdSr+)ryr/r0r#r#r$�	n_waiting�s
zBarrier.n_waitingcCs
|jdkSr�r�r0r#r#r$�broken�szBarrier.broken)NN)N)rSr8r9r2rar|r~rr}r�r�r��propertyrzr�r�r#r#r#r$r=s	




c@seZdZdS)rN)rSr8r9r#r#r#r$r�s�	Thread-%dcCs
|t�Sr)�_counter)�templater#r#r$�_newname�sr�c@seZdZdZd9dd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
erXdd�Zdd�Z
dd�Zdd�Zdd�Zd:dd�Zd;d!d"�Zed#d$��Zejd%d$��Zed&d'��Zer�ed(d)��Zd*d+�Zd,d-�Zed.d/��Zejd0d/��Zd1d2�Zd3d4�Zd5d6�Zd7d8�ZdS)<rFNr#��daemoncCs�|dkri}||_t|pt��|_||_||_|dk	r>||_n
t�j|_d|_	t
rXd|_d|_t
�|_d|_d|_tj|_t�|_t�|�dS)NFT)�_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|��nd|_d|_dSrs)r�rq�_set_tstate_lockr�r�)r1�is_aliver#r#r$rq(s


zThread._reset_internal_lockscCs^d}|j��rd}|��|jr$d}|jr2|d7}|jdk	rJ|d|j7}d|jj|j|fS)N�initialZstartedZstoppedz daemonz %sz<%s(%s, %s)>)	r�rrr�r�r�r�r7rSr�)r1Zstatusr#r#r$r=4s

zThread.__repr__cCs�|jstd��|j��r td��t�|t|<W5QRXzt|jd�Wn,tk
rtt�t|=W5QRX�YnX|j�	�dS)Nzthread.__init__() not calledz threads can only be started oncer#)
r�rGr�rr�_active_limbo_lock�_limbo�_start_new_thread�
_bootstrap�	Exceptionrar0r#r#r$�startBs

zThread.startcCs.z|jr|j|j|j�W5|`|`|`XdSr)r�r�r�r0r#r#r$�run[s	z
Thread.runcCs4z|��Wn"|jr(tdkr(YdS�YnXdSr)�_bootstrap_innerr�r�r0r#r#r$r�ls
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_idc	Cs8t�|_|j��|js4t�t�|j�W5QRXdSr)�
_set_sentinelr�rAr��_shutdown_locks_lock�_shutdown_locksr�r0r#r#r$r��s

zThread._set_tstate_lockcCs�z�|��|��tr|��|j��t�|t|j	<t
|=W5QRXtrVt�
t�trdt�t�z|��Wn|�|�YnXW5t� ztt�=WnYnXW5QRXXdSr)r�r4rr�r�r�r�r�rtr�r�r%r�rr rr�r�r0r#r#r$r��s,



zThread._bootstrap_innerc	Cs>|j}|dk	rd|_d|_|js:t�t�|�W5QRXdSrs)r�r�r�r�r��discardrYr#r#r$�_stop�szThread._stopc	Cst�tt�=W5QRXdSr)r�r4rr0r#r#r$�_delete�szThread._deletecCsZ|jstd��|j��s td��|t�kr2td��|dkrD|��n|jt|d�d�dS)N�Thread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadr)rC)r�rGr�rrr
�_wait_for_tstate_lock�maxr�r#r#r$�join�s


zThread.joinTr>cCs0|j}|dkrn|�||�r,|��|��dSr)r�rArHr�)r1�blockrCrZr#r#r$r��szThread._wait_for_tstate_lockcCs|jSr)r�r0r#r#r$r5s	zThread.namecCst|�|_dSr)r�r��r1r5r#r#r$r5scCs|jSr)r�r0r#r#r$�idents
zThread.identcCs|jSr)r�r0r#r#r$�	native_id$s	zThread.native_idcCs&|js|j��sdS|�d�|jSro)r�r�rrr�r0r#r#r$r�/s	
zThread.is_alivecCs ddl}|jdtdd�|��S)Nrz/isAlive() is deprecated, use is_alive() instead�)�
stacklevel)�warnings�warn�DeprecationWarningr�)r1r�r#r#r$�isAlive=s�zThread.isAlivecCs|jSr)r�r0r#r#r$r�Gs
z
Thread.daemoncCs*|jstd��|j��r td��||_dS)Nr�z)cannot set daemon status of active thread)r�rGr�rrr��r1Zdaemonicr#r#r$r�Vs

cCs|jSrr�r0r#r#r$�isDaemon^szThread.isDaemoncCs
||_dSrr�r�r#r#r$�	setDaemonaszThread.setDaemoncCs|jSr�r5r0r#r#r$�getNamedszThread.getNamecCs
||_dSrr�r�r#r#r$�setNamegszThread.setName)NNNr#N)N)Tr>)rSr8r9r�r2rqr=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#r$r�sP	��/	
&









)�_excepthook�_ExceptHookArgs)�print_exception)�
namedtuplez'exc_type exc_value exc_traceback threadcCst|�Sr)r�)r(r#r#r$rwscCs�|jtkrdStdk	r(tjdk	r(tj}n$|jdk	rH|jj}|dkrLdSndS|jdk	r`|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$rzs(



��csPt�tj��dkrtd���dkr*td��tj�t�t������fdd�}|S)Nzthreading.excepthook is Nonezsys.excepthook is Nonec
s�z�z,t}|dkr�}t��|f��}||�Wn�tk
r�}zbd|_~�dk	rb�jdk	rb�j}n|j}�d|dd��dk	r��jdk	r��j}n�}|���W5d}~XYnXW5d}XdS)NTz"Exception in threading.excepthook:r�)rrr��__suppress_context__r�r�)r�r(�hook�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�rG�exc_infor�)r�r#r�r$r��s r�c@s&eZdZddd�Zdd�Zdd�ZdS)	rNcCsFt�|�||_||_|dk	r"|ng|_|dk	r4|ni|_t�|_dSr)rr2�interval�functionr(r)r�finished)r1r�r�r(r)r#r#r$r2�s
zTimer.__init__cCs|j��dSr)r�rtr0r#r#r$�cancel�szTimer.cancelcCs6|j�|j�|j��s(|j|j|j�|j��dSr)r�rar�rrr�r(r)rtr0r#r#r$r��s
z	Timer.run)NN)rSr8r9r2r�r�r#r#r#r$r�s	
c@seZdZdd�ZdS)�_MainThreadc	CsTtj|ddd�|��|j��|��tr6|��t�|t	|j
<W5QRXdS)NZ
MainThreadF�r5r�)rr2r�r�rtr�r�r�r�r4r�r0r#r#r$r2�s
z_MainThread.__init__N)rSr8r9r2r#r#r#r$r��sr�c@s.eZdZdd�Zdd�Zdd�Zd
dd	�ZdS)�_DummyThreadc	CsPtj|td�dd�|j��|��tr2|��t�|t	|j
<W5QRXdS)NzDummy-%dTr�)rr2r�r�rtr�r�r�r�r4r�r0r#r#r$r2s
z_DummyThread.__init__cCsdSrr#r0r#r#r$r�
sz_DummyThread._stopcCsdSrsr#r0r#r#r$r�sz_DummyThread.is_aliveNcCsdSrr#r�r#r#r$r�sz_DummyThread.join)N)rSr8r9r2r�r�r�r#r#r#r$r�s
r�cCs,ztt�WStk
r&t�YSXdSr)r4rr6r�r#r#r#r$r
sc
Cs,t�tt�tt�W5QR�SQRXdSr)r�r[r4r�r#r#r#r$r(scCstt���tt���Sr)�listr4�valuesr�r#r#r#r$�
_enumerate4sr�c
Cs4t�&tt���tt���W5QR�SQRXdSr)r�r�r4r�r�r#r#r#r$r8s)rc	Csftjr
dStj}|��t��t�tt�}t��W5QRX|sFqb|D]}|�	�|��qJq dSr)
�_main_threadr�r�rHr�r�r�r�rurA)ZtlockZlocksrZr#r#r$�	_shutdownKs	r�cCstSr)r�r#r#r#r$rss)�_local)rc	Cs�t�ai}ztt�}Wntk
r2t�}YnX|at�at�a	t�xtt
��}|�t�|D]>}||kr�|�
d�t�}||_|||<qb|�
d�|��qbt��t��t�|�W5QRXdS)NTF)r,r�r4rr6r�r�r�rtr�r��updater�rqr�r�r�ru)Z
new_activeZcurrentZthreadsr�r�r#r#r$�_after_fork�s0






r��register_at_fork)Zafter_in_child)r�)Y�os�_os�sysr��_thread�timerrbZ_weakrefsetr�	itertoolsrrfrr/�_collectionsrrW�ImportError�collections�__all__�start_new_threadr��
allocate_lockr,r�rrr�r]rV�errorrrr&r
r r%rrrr*r'r	rrrrrGr�__next__r�r�r�r4r�r�r�rtr�rr�rr�r�	tracebackr�r�r�r�rr�r�r
Z
currentThreadrZactiveCountr�rrr�r�rr�rZ_threading_localr��hasattrr�r#r#r#r$�<module>s��




q'P&O
�5
(5

Zerion Mini Shell 1.0