Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
ìEYc@sÇddlZddlZddlZddlmZddlZy ddlZddlmZWne	k
rdZdZnXd„Zd„Zde
fd„ƒYZejd„ƒZd	„ZdS(
iÿÿÿÿN(t_utils(tpatchercsH‡fd†}ˆs|r |St|ƒdkr@||dƒS|SdS(s<Acquires & releases a read lock around call into decorated method.

    NOTE(harlowja): if no attribute name is provided then by default the
    attribute named '_lock' is looked for (this attribute is expected to be
    a :py:class:`.ReaderWriterLock`) in the instance object this decorator
    is attached to.
    cs7ˆjddƒ‰tjˆƒ‡‡fd†ƒ}|S(Ntlockt_lockcs6t|ˆƒ}|jƒˆ|||ŽSWdQXdS(N(tgetattrt	read_lock(tselftargstkwargstrw_lock(t	attr_nametf(sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pytwrapper2s
(tgettsixtwraps(RR(R(R
RsC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyt	decorator/s!iiN(tlen(RRR((RsC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pytread_locked&s	

csH‡fd†}ˆs|r |St|ƒdkr@||dƒS|SdS(sDAcquires & releases a write lock around call into decorated method.

    NOTE(harlowja): if no attribute name is provided then by default the
    attribute named '_lock' is looked for (this attribute is expected to be
    a :py:class:`.ReaderWriterLock` object) in the instance object this
    decorator is attached to.
    cs7ˆjddƒ‰tjˆƒ‡‡fd†ƒ}|S(NRRcs6t|ˆƒ}|jƒˆ|||ŽSWdQXdS(N(Rt
write_lock(RRRR	(R
R(sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyRQs
(R
RR(RR(R(R
RsC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyRNs!iiN(R(RRR((RsC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pytwrite_lockedEs	

tReaderWriterLockcBs’eZdZdZdZed„ƒZejdd„Z
ed„ƒZe
d„Zed„ƒZd„Zejd	„ƒZejd
„ƒZRS(sA reader/writer lock.

    This lock allows for simultaneous readers to exist but only one writer
    to exist for use-cases where it is useful to have such types of locks.

    Currently a reader can not escalate its read lock to a write lock and
    a writer can not acquire a read lock while it is waiting on the write
    lock.

    In the future these restrictions may be relaxed.

    This can be eventually removed if http://bugs.python.org/issue8800 ever
    gets accepted into the python standard threading library...
    twtrcCs8tdk	r1tdk	r1tjdƒr1tjSntjS(Ntthread(teventlettNoneteventlet_patchertis_monkey_patchedt
getcurrentt	threadingtcurrent_thread(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyt_fetch_current_thread_functorzs
cCsUd|_tjƒ|_i|_|ƒ|_|dkrH|jƒ}n||_dS(N(	Rt_writertcollectionstdequet_pending_writerst_readerst_condR t_current_thread(Rt
condition_clstcurrent_thread_functor((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyt__init__‡s		cCs
t|jƒS(s@Returns if there are writers waiting to become the *one* writer.(tboolR$(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pythas_pending_writers’scCs:|jƒ}|j|krtS|r2||jkStSdS(s?Returns if the caller is the active writer or a pending writer.N(R'R!tTrueR$tFalse(Rt
check_pendingtme((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyt	is_writer—s
cCs*|jdk	r|jS|jr&|jSdS(s9Returns whether the lock is locked by a writer or reader.N(R!RtWRITERR%tREADER(R((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pytowner¡s
	cCs|jƒ}||jkS(s,Returns if the caller is one of the readers.(R'R%(RR0((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyt	is_readerªsc
cs:|jƒ}||jkr.td|ƒ‚n|j~xvtr°|jdks_|j|kr y|j|d|j|<Wntk
r›d|j|<nXPn|jj	ƒq;WWdQXz	|VWd|jgyA|j|}|dkrý|d|j|<n|jj
|ƒWntk
r!nX|jjƒWdQXXdS(sÅContext manager that grants a read lock.

        Will wait until no active or pending writers.

        Raises a ``RuntimeError`` if a pending writer tries to acquire
        a read lock.
        sFWriter %s can not acquire a read lock while waiting for the write lockiN(R'R$tRuntimeErrorR&R-R!RR%tKeyErrortwaittpopt
notify_all(RR0tme_instances((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyR¯s0	

	
	


ccs|jƒ}|jdtƒ}|jƒrD|rDtd|ƒ‚n|rR|Vn½|j|jj|ƒxgtrÕt	|j
ƒdkrÅ|jdkrÅ|jd|krÅ|jj
ƒ|_PqÅn|jjƒqoWWdQXz	|VWd|jd|_|jjƒWdQXXdS(sÙContext manager that grants a write lock.

        Will wait until no active readers. Blocks readers after acquiring.

        Raises a ``RuntimeError`` if an active reader attempts to acquire
        a lock.
        R/s4Reader %s to writer privilege escalation not allowediN(R'R1R.R5R6R&R$tappendR-RR%R!RtpopleftR8R:(RR0ti_am_writer((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyRÛs(	

	$	
	N(t__name__t
__module__t__doc__R2R3tstaticmethodR Rt	ConditionRR*tpropertyR,R-R1R4R5t
contextlibtcontextmanagerRR(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyRds	
		,ccs3|jtƒ}z	|VWd|r.|jƒnXdS(sDAttempts to acquire a lock, and auto releases if acquired (on exit).N(tacquireR.trelease(Rt
was_locked((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyttry_lockþs
	csH‡fd†}ˆs|r |St|ƒdkr@||dƒS|SdS(sA locking **method** decorator.

    It will look for a provided attribute (typically a lock or a list
    of locks) on the first argument of the function decorated (typically this
    is the 'self' object) and before executing the decorated function it
    activates the given lock or list of locks as a context manager,
    automatically releasing that lock on exit.

    NOTE(harlowja): if no attribute name is provided then by default the
    attribute named '_lock' is looked for (this attribute is expected to be
    the lock/list of locks object/s) in the instance object this decorator
    is attached to.

    NOTE(harlowja): a custom logger (which will be used if lock release
    failures happen) can be provided by passing a logger instance for keyword
    argument ``logger``.
    csIˆjddƒ‰ˆjdƒ‰tjˆƒ‡‡‡fd†ƒ}|S(NRRtloggerc	s¿t|ˆƒ}t|ttfƒr˜tjdˆƒ]}xCt|ƒD]5\}}|j|ƒsFtj	d|dƒ‚qFqFWˆ|||ŽSWdQXn#|}|ˆ|||ŽSWdQXdS(NRKsUnable to acquire lock %si(
Rt
isinstancettupletlistRt	LockStackt	enumeratetacquire_lockRtThreadError(RRRt
attr_valuetstacktiR(R
RRK(sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyR%s	(R
RR(RR(R(R
RRKsC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyR!s$iiN(R(RRR((RsC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pytlockeds
(R"RERt	fastenersRRRRRtImportErrorRRRtobjectRRFRJRV(((sC/home/tvault/.virtenv/lib/python2.7/site-packages/fasteners/lock.pyt<module>s

		š