• File: lock.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/virtualenv/util/__pycache__/lock.cpython-37.pyc
  • Date Modified: 05/26/2022 11:30 AM
  • File size: 6.05 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

a@sdZddlmZmZddlZddlZddlmZmZddl	m
Z
ddlmZm
Z
ddlmZmZddlmZdd	lmZGd
ddeZiZeZeeGdd
d
eZGdddeZGdddeZdZdS)z7holds locking functionality that works across processes)absolute_importunicode_literalsN)ABCMetaabstractmethod)contextmanager)LockRLock)FileLockTimeout)
add_metaclass)Pathcs8eZdZfddZd
fdd	Zdfdd		ZZS)_CountedFileLockcs^tj|}tj|s<yt|Wntk
r:YnXtt||d|_	t
|_dS)Nr)ospathdirnameisdirmakedirsOSErrorsuperr
__init__countrthread_safe)self	lock_fileparent)	__class__E/opt/alt/python37/lib/python3.7/site-packages/virtualenv/util/lock.pyrsz_CountedFileLock.__init__N皙?c	s@|j0|jdkr$tt||||jd7_WdQRXdS)Nr)rrrr
acquire)rZtimeoutZ
poll_interval)rrrr s
z_CountedFileLock.acquireFc	sD|j4|jdkr$tt|j|dt|jdd|_WdQRXdS)Nr)forcer)rrrr
releasemax)rr!)rrrr""s
z_CountedFileLock.release)Nr)F)__name__
__module____qualname__rr r"
__classcell__rr)rrr
sr
c@sfeZdZddZddZddZddZed	d
ZeddZ	ee
dddZee
ddZdS)PathLockBasecCs"t|}|r|n||_dS)N)rexistsZresolver)rfolderrrrrr/szPathLockBase.__init__cCsd|jj|jS)Nz{}({}))formatrr$r)rrrr__repr__3szPathLockBase.__repr__cCst||j|S)N)typer)rotherrrr__div__6szPathLockBase.__div__cCs
||S)N)r/)rr.rrr__truediv__9szPathLockBase.__truediv__cCstdS)N)NotImplementedError)rrrr	__enter__<szPathLockBase.__enter__cCstdS)N)r1)rexc_typeexc_valexc_tbrrr__exit__@szPathLockBase.__exit__FcCstdS)N)r1)rnameno_blockrrrlock_for_keyDszPathLockBase.lock_for_keycCstdS)N)r1)r7rrrnon_reentrant_lock_for_keyIsz'PathLockBase.non_reentrant_lock_for_keyN)F)
r$r%r&rr,r/r0rr2r6rr9r:rrrrr(-sr(cszeZdZfddZdddZeddZdd	Zd
dZdd
Z	dddZ
eddZedddZ
eddZZS)ReentrantFileLockcstt||d|_dS)N)rr;r_lock)rr*)rrrrPszReentrantFileLock.__init__c	Cs@t|jd|}t|tkr.t|t|<t|SQRXdS)Nz{}.lock)strrr+_store_lock_lock_storer
)rr7rrrr_create_lockTs
zReentrantFileLock._create_lockc
CsF|dk	rBt0|j|jdkr.t|jdWdQRXWdQRXdS)Nr)r?rrr@popr)lockrrr	_del_lock[s

zReentrantFileLock._del_lockcCs||jdS)N)rDr<)rrrr__del__cszReentrantFileLock.__del__cCs||_||jdS)N)rAr<
_lock_file)rrrrr2fs
zReentrantFileLock.__enter__cCs"||j||jd|_dS)N)_releaser<rD)rr3r4r5rrrr6jszReentrantFileLock.__exit__FcCsvytt|jWntk
r(YnXy|dWn8tk
rp|rNtd|j	|
|YnXdS)Ng-C6?z/lock file %s present, will block until released)rrr>rrr r
loggingdebugrr")rrCr8rrrrFoszReentrantFileLock._lock_filecCs|dS)N)r")rCrrrrGszReentrantFileLock._releasec	csH||}z(z|||dVWd||XWd||d}XdS)N)rArFrGrD)rr7r8rCrrrr9s


zReentrantFileLock.lock_for_keyc	cs.tt|jd|dVWdQRXdS)Nz{}.lock)r
r>rr+)rr7rrrr:sz,ReentrantFileLock.non_reentrant_lock_for_key)r=)F)F)r$r%r&rrAstaticmethodrDrEr2r6rFrGrr9r:r'rr)rrr;Os

r;c@s6eZdZddZddZedddZedd	Zd
S)NoOpFileLockcCstdS)N)r1)rrrrr2szNoOpFileLock.__enter__cCstdS)N)r1)rr3r4r5rrrr6szNoOpFileLock.__exit__Fccs
dVdS)Nr)rr7r8rrrr9szNoOpFileLock.lock_for_keyccs
dVdS)Nr)rr7rrrr:sz'NoOpFileLock.non_reentrant_lock_for_keyN)F)r$r%r&r2r6rr9r:rrrrrKs
rK)rKr;r
)__doc__Z
__future__rrrHrabcrr
contextlibrZ	threadingrrZfilelockr	r
ZsixrZvirtualenv.util.pathrr
r@r?objectr(r;rK__all__rrrr<module>s"!H