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:
§

hµµhÃ0ãó8—dZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZmZmZdd	lmZmZmZdd
lmZddlmZddlmZdd
lmZer(ddl Z ddl!m"Z"ddl#m$Z$e j%dkrddlm&Z&nddl'm&Z&ej(d¦«Z)e	Gd„de¦«¦«Z*Gd„de*e
¦«Z+Gd„d¦«Z,Gd„de¦«Z-Gd„dee-¬¦«Z.Gd„dee.¦«Z/Gd „d!ee.¦«Z0Gd"„d#ee.¦«Z1gd$¢Z2dS)%z1An asyncio-based implementation of the file lock.é)ÚannotationsN)Ú	dataclass)Úiscoroutinefunction)Úlocal)Ú
TYPE_CHECKINGÚAnyÚCallableÚNoReturnÚcasté)ÚBaseFileLockÚFileLockContextÚFileLockMeta)ÚTimeout)ÚSoftFileLock)ÚUnixFileLock)ÚWindowsFileLock)Úfutures)Ú
TracebackType)éé)ÚSelfÚfilelockcó>—eZdZUdZdZded<dZded<dZded	<dS)
ÚAsyncFileLockContextzGA dataclass which holds the context for a ``BaseAsyncFileLock`` object.TÚboolÚrun_in_executorNúfutures.Executor | NoneÚexecutorú asyncio.AbstractEventLoop | NoneÚloop)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rÚ__annotations__rr!©óú;/usr/local/lib/python3.11/site-packages/filelock/asyncio.pyrr#sQ€€€€€€àQÐQð!€OÐ Ð Ð Ñ ð)-€HÐ,Ð,Ð,Ñ,ð.2€DÐ1Ð1Ð1Ñ1Ð1Ð1r(rcó—eZdZdZdS)ÚAsyncThreadLocalFileContextz8A thread local version of the ``FileLockContext`` class.N©r"r#r$r%r'r(r)r+r+1s€€€€€ØBÐBÐBÐBr(r+có*—eZdZdZdd„Zdd„Zdd„ZdS)ÚAsyncAcquireReturnProxyzDA context-aware object that will release the lock file when exiting.ÚlockÚBaseAsyncFileLockÚreturnÚNonecó—||_dS©N©r/)Úselfr/s  r)Ú__init__z AsyncAcquireReturnProxy.__init__8s
€ØˆŒ	ˆ	ˆ	r(cƒóK—|jSr4r5©r6s r)Ú
__aenter__z"AsyncAcquireReturnProxy.__aenter__;sèè€ØŒyÐr(Úexc_typeútype[BaseException] | NoneÚ	exc_valueúBaseException | NoneÚ	tracebackúTracebackType | NonecƒóHK—|j ¦«ƒd{V—†dSr4)r/Úrelease©r6r;r=r?s    r)Ú	__aexit__z!AsyncAcquireReturnProxy.__aexit__>s4èè€ðŒi×ÒÑ!Ô!Ð!Ð!Ð!Ð!Ð!Ð!Ð!Ð!Ð!r(N)r/r0r1r2)r1r0©r;r<r=r>r?r@r1r2)r"r#r$r%r7r:rDr'r(r)r.r.5sV€€€€€ØNÐNððððððððð"ð"ð"ð"ð"ð"r(r.có6‡—eZdZ			dddddddœdˆfd„ZˆxZS)ÚAsyncFileLockMetaéÿÿÿÿé¤FTN©ÚblockingÚis_singletonr!rrÚ	lock_fileústr | os.PathLike[str]ÚtimeoutÚfloatÚmodeÚintÚthread_localrrKrLr!r rrrr1r0c󢕗|r|rd}
t|
¦«‚t¦« |||||||||	¬¦	«	}td|¦«S)Nz:run_in_executor is not supported when thread_local is True)	rMrOrQrSrKrLr!rrr0)Ú
ValueErrorÚsuperÚ__call__r)
ÚclsrMrOrQrSrKrLr!rrÚmsgÚinstanceÚ	__class__s
            €r)rWzAsyncFileLockMeta.__call__Hsqø€ðð	"˜Oð	"ØNˆCݘS‘/”/Ð!Ý‘7”7×#Ò#ØØØØ%ØØ%ØØ+Øð$ñ

ô

ˆõÐ'¨Ñ2Ô2Ð2r(©rHrIF)rMrNrOrPrQrRrSrrKrrLrr!r rrrrr1r0)r"r#r$rWÚ
__classcell__)r[s@r)rGrGGshø€€€€€ðØØ"ð3ðØ"Ø15Ø $Ø,0ð3ð3ð3ð3ð3ð3ð3ð3ð3ð3ð3ð3r(rGcóà—eZdZdZ			d7ddddddœd8d„Zed9d„¦«Zed:d„¦«Zejd;d„¦«Zed<d„¦«Z			d=dd œd>d%„Z
d?d@d'„ZdAd*„ZdBd,„Z
dCd.„ZdDd5„ZdEd6„ZdS)Fr0z'Base class for asynchronous file locks.rHrIFTNrJrMrNrOrPrQrRrSrrKrLr!r rrrr1r2có—||_||_tj|¦«||||||	dœ}
|rtnt
di|
¤Ž|_dS)a"
        Create a new lock object.

        :param lock_file: path to the file
        :param timeout: default timeout when acquiring the lock, in seconds. It will be used as fallback value in             the acquire method, if no timeout value (``None``) is given. If you want to disable the timeout, set it             to a negative value. A timeout of 0 means that there is exactly one attempt to acquire the file lock.
        :param mode: file permissions for the lockfile
        :param thread_local: Whether this object's internal context should be thread local or not. If this is set to             ``False`` then the lock will be reentrant across threads.
        :param blocking: whether the lock should be blocking or not
        :param is_singleton: If this is set to ``True`` then only one instance of this class will be created             per lock file. This is useful if you want to use the lock object for reentrant locking without needing             to pass the same object around.
        :param loop: The event loop to use. If not specified, the running event loop will be used.
        :param run_in_executor: If this is set to ``True`` then the lock will be acquired in an executor.
        :param executor: The executor to use. If not specified, the default executor will be used.

        )rMrOrQrKr!rrNr')Ú_is_thread_localÚ
_is_singletonÚosÚfspathr+rÚ_context)r6rMrOrQrSrKrLr!rrÚkwargss           r)r7zBaseAsyncFileLock.__init__isu€ð@!-ˆÔØ)ˆÔõ
œ 9Ñ-Ô-ØØØ ØØ.Ø ð"
ð"
ˆð0uÈlÐ/tÕ/JÐ/JÕ`tð/
ð/
Øð/
ð/
ˆŒ
ˆ
ˆ
r(có—|jjS)z"::return: whether run in executor.)rdrr9s r)rz!BaseAsyncFileLock.run_in_executor›s€ðŒ}Ô,Ð,r(có—|jjS)z::return: the executor.©rdrr9s r)rzBaseAsyncFileLock.executor s€ðŒ}Ô%Ð%r(Úvaluecó—||j_dS)zˆ
        Change the executor.

        :param value: the new executor or ``None``
        :type value: futures.Executor | None

        Nrh)r6ris  r)rzBaseAsyncFileLock.executor¥s€ð"'ˆŒ
ÔÐÐr(có—|jjS)z::return: the event loop.)rdr!r9s r)r!zBaseAsyncFileLock.loop°s€ðŒ}Ô!Ð!r(皙™™™™©?)rKúfloat | NoneÚ
poll_intervalúbool | Noner.cƒóŒK—|€|jj}|€|jj}|jxjdz
c_t	|¦«}|j}t
j¦«}		|js<t 
d||¦«| |j¦«ƒd{V—†|jrt 
d||¦«n¹|dur+t 
d||¦«t|¦«‚d|cxkrt
j¦«|z
kr.nn+t 
d	||¦«t|¦«‚d
}t 
||||¦«tj|¦«ƒd{V—†Œ n6#t $r)t#d|jjdz
¦«|j_‚wxYwt%|¬¦«S)aW
        Try to acquire the file lock.

        :param timeout: maximum wait time for acquiring the lock, ``None`` means use the default
            :attr:`~BaseFileLock.timeout` is and if ``timeout < 0``, there is no timeout and
            this method will block until the lock could be acquired
        :param poll_interval: interval of trying to acquire the lock file
        :param blocking: defaults to True. If False, function will return immediately if it cannot obtain a lock on the
         first attempt. Otherwise, this method will block until the timeout expires or the lock is acquired.
        :raises Timeout: if fails to acquire lock within the timeout period
        :return: a context object that will unlock the file when the context is exited

        .. code-block:: python

            # You can use this method in the context manager (recommended)
            with lock.acquire():
                pass

            # Or use an equivalent try-finally construct:
            lock.acquire()
            try:
                pass
            finally:
                lock.release()

        NrTz#Attempting to acquire lock %s on %szLock %s acquired on %sFz+Failed to immediately acquire lock %s on %srz"Timeout on acquiring lock %s on %sz2Lock %s not acquired on %s, waiting %s seconds ...r5)rdrOrKÚlock_counterÚidrMÚtimeÚperf_counterÚ	is_lockedÚ_LOGGERÚdebugÚ_run_internal_methodÚ_acquirerÚasyncioÚsleepÚ
BaseExceptionÚmaxr.)r6rOrnrKÚlock_idÚ
lock_filenameÚ
start_timerYs        r)ÚacquirezBaseAsyncFileLock.acquireµsûèè€ðDˆ?Ø”mÔ+ˆGàÐØ”}Ô-ˆHð	
Œ
Ð"Ô" aÑ'Ð"Ô"åT‘(”(ˆØœˆ
ÝÔ&Ñ(Ô(ˆ
ð	ð
3Ø”~ðCÝ—M’MÐ"GÈÐR_Ñ`Ô`Ð`Ø×3Ò3°D´MÑBÔBÐBÐBÐBÐBÐBÐBÐBØ”>ðÝ—M’MÐ":¸GÀ]ÑSÔSÐSØØ˜uÐ$Ð$Ý—M’MÐ"OÐQXÐZgÑhÔhÐhÝ! -Ñ0Ô0Ð0ؘÐBÐBÒBÐB¥$Ô"3Ñ"5Ô"5¸
Ñ"BÒBÐBÐBÐBÐBÝ—M’MÐ"FÈÐQ^Ñ_Ô_Ð_Ý! -Ñ0Ô0Ð0ØJÝ—
’
˜c 7¨M¸=ÑIÔIÐIÝ”m MÑ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2Ð2ñ
3ðøõð	ð	ð	Ý),¨Q°´
Ô0JÈQÑ0NÑ)OÔ)OˆDŒMÔ&Øð	øøøõ'¨DÐ1Ñ1Ô1Ð1s
ÁD!FÆ3F3ÚforcecƒóbK—|jr£|jxjdzc_|jjdks|r~t|¦«|j}}t
 d||¦«| |j¦«ƒd{V—†d|j_t
 d||¦«dSdSdS)a+
        Releases the file lock. Please note, that the lock is only completely released, if the lock counter is 0.
        Also note, that the lock file itself is not automatically deleted.

        :param force: If true, the lock counter is ignored and the lock is released in every case/

        rrz#Attempting to release lock %s on %sNzLock %s released on %s)	rurdrqrrrMrvrwrxÚ_release)r6r‚r~rs    r)rBzBaseAsyncFileLock.releaseùsÉèè€ðŒ>ð		PØŒMÐ&Ô&¨!Ñ+Ð&Ô&àŒ}Ô)¨QÒ.Ð.°%Ð.Ý)+¨D©¬°4´>˜å—
’
ÐCÀWÈmÑ\Ô\Ð\Ø×/Ò/°´
Ñ>Ô>Ð>Ð>Ð>Ð>Ð>Ð>Ð>Ø-.”
Ô*Ý—
’
Ð6¸ÀÑOÔOÐOÐOÐOð		Pð		Pð/Ð.r(ÚmethodúCallable[[], Any]cƒóèK—t|¦«r|¦«ƒd{V—†dS|jr=|jptj¦«}| |j|¦«ƒd{V—†dS|¦«dSr4)rrr!rzÚget_running_loopr)r6r…r!s   r)rxz&BaseAsyncFileLock._run_internal_methodsèè€Ý˜vÑ&Ô&ð	ؐ&‘(”(ˆNˆNˆNˆNˆNˆNˆNˆNˆNØ
Ô
!ð	Ø”9Ð:¥Ô 8Ñ :Ô :ˆDØ×&Ò& t¤}°fÑ=Ô=Ð=Ð=Ð=Ð=Ð=Ð=Ð=Ð=Ð=àˆF‰HŒHˆHˆHˆHr(r
có$—d}t|¦«‚)z¿
        Replace old __enter__ method to avoid using it.

        NOTE: DO NOT USE `with` FOR ASYNCIO LOCKS, USE `async with` INSTEAD.

        :return: none
        :rtype: NoReturn
        z>Do not use `with` for asyncio locks, use `async with` instead.)ÚNotImplementedError)r6rYs  r)Ú	__enter__zBaseAsyncFileLock.__enter__s€ðOˆÝ! #Ñ&Ô&Ð&r(rcƒó>K—| ¦«ƒd{V—†|S)zF
        Acquire the lock.

        :return: the lock object

        N)rr9s r)r:zBaseAsyncFileLock.__aenter__!s-èè€ðlŠl‰nŒnÐÐÐÐÐÐÐØˆr(r;r<r=r>r?r@cƒó>K—| ¦«ƒd{V—†dS)zÏ
        Release the lock.

        :param exc_type: the exception type if raised
        :param exc_value: the exception value if raised
        :param traceback: the exception traceback if raised

        N)rBrCs    r)rDzBaseAsyncFileLock.__aexit__+s.èè€ðlŠl‰nŒnÐÐÐÐÐÐÐÐÐr(cól—tjt¦«5|jpt	j¦«}| ¦«s*| | d¬¦«¦«n)| 	| d¬¦«¦«ddd¦«dS#1swxYwYdS)z'Called when the lock object is deleted.T)r‚N)
Ú
contextlibÚsuppressÚRuntimeErrorr!rzrˆÚ
is_runningÚrun_until_completerBÚcreate_task)r6r!s  r)Ú__del__zBaseAsyncFileLock.__del__;så€å
Ô
 ¥Ñ
.Ô
.ð	;ð	;Ø”9Ð:¥Ô 8Ñ :Ô :ˆDØ—?’?Ñ$Ô$ð
;Ø×'Ò'¨¯ª¸4¨Ñ(@Ô(@ÑAÔAÐAÐAà× Ò  §¢°D Ñ!9Ô!9Ñ:Ô:Ð:ð	;ð	;ð	;ñ	;ô	;ð	;ð	;ð	;ð	;ð	;ð	;ð	;øøøð	;ð	;ð	;ð	;ð	;ð	;sšBB)Â)B-Â0B-r\)rMrNrOrPrQrRrSrrKrrLrr!r rrrrr1r2)r1r)r1r)rirr1r2)r1r )Nrl)rOrmrnrPrKror1r.)F)r‚rr1r2)r…r†r1r2)r1r
)r1rrE)r1r2)r"r#r$r%r7ÚpropertyrrÚsetterr!rrBrxr‹r:rDr•r'r(r)r0r0fs–€€€€€Ø1Ð1ð
ØØ"ð0
ðØ"Ø15Ø $Ø,0ð0
ð0
ð0
ð0
ð0
ð0
ðdð-ð-ð-ñ„Xð-ðð&ð&ð&ñ„Xð&ð„_ð'ð'ð'ñ„_ð'ðð"ð"ð"ñ„Xð"ð!%Ø#ðB2ð
!%ðB2ðB2ðB2ðB2ðB2ðB2ðHPðPðPðPðPð&ðððð
'ð
'ð
'ð
'ððððððððð ;ð;ð;ð;ð;ð;r(r0)Ú	metaclasscó—eZdZdZdS)ÚAsyncSoftFileLockz.Simply watches the existence of the lock file.Nr,r'r(r)ršršEs€€€€€Ø8Ð8Ð8Ð8r(ršcó—eZdZdZdS)ÚAsyncUnixFileLockzHUses the :func:`fcntl.flock` to hard lock the lock file on unix systems.Nr,r'r(r)rœrœIs€€€€€ØRÐRÐRÐRr(rœcó—eZdZdZdS)ÚAsyncWindowsFileLockzNUses the :func:`msvcrt.locking` to hard lock the lock file on windows systems.Nr,r'r(r)ržržMs€€€€€ØXÐXÐXÐXr(rž)r.ršrœržr0)3r%Ú
__future__rrzrÚloggingrbrsÚdataclassesrÚinspectrÚ	threadingrÚtypingrrr	r
rÚ_apir
rrÚ_errorrÚ_softrÚ_unixrÚ_windowsrÚsysÚ
concurrentrÚtypesrÚversion_inforÚtyping_extensionsÚ	getLoggerrvrr+r.rGr0ršrœržÚ__all__r'r(r)ú<module>r±s6ðØ7Ð7à"Ð"Ð"Ð"Ð"Ð"à€€€ØÐÐÐØ€€€Ø	€	€	€	Ø€€€Ø!Ð!Ð!Ð!Ð!Ð!Ø'Ð'Ð'Ð'Ð'Ð'ØÐÐÐÐÐØ?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?à=Ð=Ð=Ð=Ð=Ð=Ð=Ð=Ð=Ð=ØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØ%Ð%Ð%Ð%Ð%Ð%àð+Ø€J€J€JØ"Ð"Ð"Ð"Ð"Ð"Ø#Ð#Ð#Ð#Ð#Ð#à
Ô˜7Ò"Ð"ØÐÐÐÐÐÐà*Ð*Ð*Ð*Ð*Ð*ðˆ'Ô
˜JÑ
'Ô
'€ðð
2ð
2ð
2ð
2ð
2˜?ñ
2ô
2ñ„ð
2ðCðCðCðCðCÐ"6¸ñCôCðCð"ð"ð"ð"ð"ñ"ô"ð"ð$3ð3ð3ð3ð3˜ñ3ô3ð3ð>\;ð\;ð\;ð\;ð\;˜Ð0Að\;ñ\;ô\;ð\;ð~9ð9ð9ð9ð9˜Ð&7ñ9ô9ð9ðSðSðSðSðS˜Ð&7ñSôSðSðYðYðYðYðY˜?Ð,=ñYôYðYððð€€€r(