• File: locks.cpython-37.opt-2.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/asyncio/__pycache__/locks.cpython-37.opt-2.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 9.08 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

YI~d)>@sdZddlZddlZddlmZddlmZddlmZGdddZGd	d
d
Z	Gddde	Z
Gd
ddZGddde	ZGddde	Z
Gddde
ZdS))LockEvent	Condition	SemaphoreBoundedSemaphoreN)events)futures)	coroutinec@s$eZdZddZddZddZdS)_ContextManagercCs
||_dS)N)_lock)selflockr2/opt/alt/python37/lib64/python3.7/asyncio/locks.py__init__ sz_ContextManager.__init__cCsdS)Nr)r
rrr	__enter__#sz_ContextManager.__enter__cGsz|jWdd|_XdS)N)rrelease)r
argsrrr__exit__(sz_ContextManager.__exit__N)__name__
__module____qualname__rrrrrrrr
src@sHeZdZddZddZeddZddZd	d
ZddZ	d
dZ
dS)_ContextManagerMixincCstddS)Nz9"yield from" should be used as context manager expression)RuntimeError)r
rrrr0sz_ContextManagerMixin.__enter__cGsdS)Nr)r
rrrrr4sz_ContextManagerMixin.__exit__ccs&tjdtdd|EdHt|S)NzD'with (yield from lock)' is deprecated use 'async with lock' instead)
stacklevel)warningswarnDeprecationWarningacquirer)r
rrr__iter__9s
z_ContextManagerMixin.__iter__cs|IdHt|S)N)r r)r
rrrZ
__acquire_ctxPsz"_ContextManagerMixin.__acquire_ctxcCstjdtdd|S)Nz='with await lock' is deprecated use 'async with lock' insteadr)r)rrr!_ContextManagerMixin__acquire_ctx	__await__)r
rrrr#Ts
z_ContextManagerMixin.__await__cs|IdHdS)N)r )r
rrr
__aenter__[sz_ContextManagerMixin.__aenter__cs|dS)N)r)r
exc_typeexctbrrr	__aexit__asz_ContextManagerMixin.__aexit__N)rrrrrr
r!r"r#r$r(rrrrr/srcsJeZdZddddZfddZddZd	d
ZddZd
dZZ	S)rN)loopcCs.t|_d|_|dk	r ||_n
t|_dS)NF)collectionsdeque_waiters_locked_looprget_event_loop)r
r)rrrrs

z
Lock.__init__csLt}|jrdnd}|jr2|dt|j}d|ddd|dS)	Nlockedunlockedz
, waiters:<rz [z]>)super__repr__r-r,len)r
resextra)	__class__rrr5s

z
Lock.__repr__cCs|jS)N)r-)r
rrrr0szLock.lockedc	s|js$tdd|jDr$d|_dS|j}|j|y"z|IdHWd|j|XWn&tjk
r|js||	YnXd|_dS)Ncss|]}|VqdS)N)	cancelled).0wrrr	<genexpr>szLock.acquire.<locals>.<genexpr>T)
r-allr,r.
create_futureappendremover	CancelledError_wake_up_first)r
futrrrr s
zLock.acquirecCs"|jrd|_|ntddS)NFzLock is not acquired.)r-rCr)r
rrrrs
zLock.releasecCs>ytt|j}Wntk
r&dSX|s:|ddS)NT)nextiterr,
StopIterationdone
set_result)r
rDrrrrCszLock._wake_up_first)
rrrrr5r0r rrC
__classcell__rr)r9rres6rcsJeZdZddddZfddZddZd	d
ZddZd
dZZ	S)rN)r)cCs.t|_d|_|dk	r ||_n
t|_dS)NF)r*r+r,_valuer.rr/)r
r)rrrrs

zEvent.__init__csLt}|jrdnd}|jr2|dt|j}d|ddd|dS)	NsetZunsetz
, waiters:r2rr3z [z]>)r4r5rKr,r6)r
r7r8)r9rrr5s

zEvent.__repr__cCs|jS)N)rK)r
rrris_setszEvent.is_setcCs2|js.d|_x |jD]}|s|dqWdS)NT)rKr,rHrI)r
rDrrrrLs
z	Event.setcCs
d|_dS)NF)rK)r
rrrclearszEvent.clearc	sB|jr
dS|j}|j|z|IdHdS|j|XdS)NT)rKr.r?r,r@rA)r
rDrrrwaits

z
Event.wait)
rrrrr5rMrLrNrOrJrr)r9rrs	rcsNeZdZdddddZfddZddZd	d
Zddd
ZddZZ	S)rN)r)cCsp|dk	r||_n
t|_|dkr0t|jd}n|j|jk	rDtd||_|j|_|j|_|j|_t	
|_dS)N)r)z"loop argument must agree with lock)r.rr/r
ValueErrorrr0r rr*r+r,)r
rr)rrrr5s
zCondition.__init__csNt}|rdnd}|jr4|dt|j}d|ddd|dS)	Nr0r1z
, waiters:r2rr3z [z]>)r4r5r0r,r6)r
r7r8)r9rrr5Hs

zCondition.__repr__cs|std|z8|j}|j|z|IdHdS|j|XWdd}x4y|IdHPWqXt	j
k
rd}YqXXqXW|rt	j
XdS)Nzcannot wait on un-acquired lockTF)r0rrr.r?r,r@rAr r	rB)r
rDr:rrrrOOs&

zCondition.waitcs(|}x|s"|IdH|}qW|S)N)rO)r
Z	predicateresultrrrwait_forts

zCondition.wait_forrcCsL|stdd}x2|jD](}||kr*P|s|d7}|dqWdS)Nz!cannot notify on un-acquired lockrrF)r0rr,rHrI)r
nidxrDrrrnotifyszCondition.notifycCs|t|jdS)N)rUr6r,)r
rrr
notify_allszCondition.notify_all)N)r)
rrrrr5rOrRrUrVrJrr)r9rr+s
%
rcsLeZdZdddddZfddZdd	Zd
dZdd
ZddZZ	S)rrN)r)cCs>|dkrtd||_t|_|dk	r0||_n
t|_dS)Nrz$Semaphore initial value must be >= 0)rPrKr*r+r,r.rr/)r
valuer)rrrrs
zSemaphore.__init__csVt}|rdn
d|j}|jr<|dt|j}d|ddd|dS)	Nr0zunlocked, value:z
, waiters:r2rr3z [z]>)r4r5r0rKr,r6)r
r7r8)r9rrr5s

zSemaphore.__repr__cCs0x*|jr*|j}|s|ddSqWdS)N)r,popleftrHrI)r
Zwaiterrrr
_wake_up_nexts


zSemaphore._wake_up_nextcCs
|jdkS)Nr)rK)r
rrrr0szSemaphore.lockedcsxxd|jdkrd|j}|j|y|IdHWq||jdkrZ|sZ|YqXqW|jd8_dS)NrrT)rKr.r?r,r@Zcancelr:rY)r
rDrrrr s	
zSemaphore.acquirecCs|jd7_|dS)Nr)rKrY)r
rrrrszSemaphore.release)r)
rrrrr5rYr0r rrJrr)r9rrs
rcs0eZdZdddfddZfddZZS)	rrN)r)cs||_tj||ddS)N)r))_bound_valuer4r)r
rWr))r9rrrszBoundedSemaphore.__init__cs"|j|jkrtdtdS)Nz(BoundedSemaphore released too many times)rKrZrPr4r)r
)r9rrrszBoundedSemaphore.release)r)rrrrrrJrr)r9rrsr)__all__r*rrr	Z
coroutinesr
rrrrrrrrrrr<module>s"6AwK