
    KiR                    p   % S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
JrJr  S SKJr  S SKJr  S SKJrJrJr  S SKJr  SS	KJr  S
rS\S'   \(       a/  S SKJr  S SKJr  SSKJ r   \RB                  S:  a  S SKJ"r"  OS SK#J"r"  \RH                  " S5      r%\RL                  S:X  a  \RN                  RP                  O\RN                  RR                  r* " S S\5      r+\+" 5       r, " S S5      r-\ " S S5      5       r. " S S\.\5      r/ " S S\5      r0 " S S\Rb                  \0S 9r2/ S!Qr3g)"    )annotationsN)ABCMetaabstractmethod)	dataclass)local)TYPE_CHECKINGAnycast)WeakValueDictionary   )Timeoutint_UNSET_FILE_MODE)Callable)TracebackType)ReadWriteLock)      )Selffilelockwin32c                  ,   ^  \ rS rSrSU 4S jjrSrU =r$ )_ThreadLocalRegistry+   c                0   > [         TU ]  5         0 U l        g N)super__init__held)self	__class__s    O/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/filelock/_api.pyr   _ThreadLocalRegistry.__init__,   s    $&	    )r    returnNone)__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__r"   s   @r#   r   r   +   s    ' 'r%   r   c                  F    \ rS rSrSrSS jrS	S jr        S
S jrSrg)AcquireReturnProxy7   zDA context-aware object that will release the lock file when exiting.c                    Xl         g r   lock)r!   r5   s     r#   r   AcquireReturnProxy.__init__:   s    26	r%   c                    U R                   $ r   r4   r!   s    r#   	__enter__AcquireReturnProxy.__enter__=   s    yyr%   c                8    U R                   R                  5         g r   )r5   releaser!   exc_type	exc_value	tracebacks       r#   __exit__AcquireReturnProxy.__exit__@   s     			r%   r4   N)r5   BaseFileLock | ReadWriteLockr'   r(   )r'   rC   r>   ztype[BaseException] | Noner?   zBaseException | Noner@   zTracebackType | Noner'   r(   )	r)   r*   r+   r,   __doc__r   r9   rA   r-    r%   r#   r1   r1   7   s:    N7, ( (	
 
r%   r1   c                  v    \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   S\S'   SrS\S'   SrS\S'   SrS\S'   Sr	g)FileLockContextI   zBA dataclass which holds the context for a ``BaseFileLock`` object.str	lock_filefloattimeoutr   modeboolblockingpoll_intervalNfloat | Nonelifetimez
int | Nonelock_file_fdr   lock_counterrF   )
r)   r*   r+   r,   rE   __annotations__rS   rT   rU   r-   rF   r%   r#   rH   rH   I   sM    L N N I N  "Hl!  $L*# L#r%   rH   c                      \ rS rSrSrSrg)ThreadLocalFileContexti   z8A thread local version of the ``FileLockContext`` class.rF   N)r)   r*   r+   r,   rE   r-   rF   r%   r#   rX   rX   i   s    Br%   rX   c                  v   ^  \ rS rSr% S\S'   S\S4SSSSS	.                   SU 4S
 jjjjrSrU =r$ )FileLockMetam   &WeakValueDictionary[str, BaseFileLock]
_instancesr   TF皙?NrP   is_singletonrQ   rS   c          	     x  > U(       Ga  U R                   R                  [        U5      5      n
U
(       a  XJR                  5       4X*R                  4X:R
                  R                  4XZR                  4XzR                  4XR                  4S.nUR                  5        VVVs0 s H  u  nu  pX:w  d  M  XU4_M     nnnnU(       d  [        SU
5      $ SnUS-  nUR                  5        H  u  nu  pUSU SU SU S3-  nM     [        U5      eUUUUUUUS	.U	En[        R                  " U R                  5      R                   nUR                  5        VVs0 s H  u  nnUU;   d  M  UU_M     nnn["        TU ]H  " U40 UD6n
U(       a  XR                   [        U5      '   [        SU
5      $ s  snnnf s  snnf )
N)thread_localrM   rN   rP   rQ   rS   BaseFileLockzGSingleton lock instances cannot be initialized with differing argumentsz
Non-matching arguments: z
	z (existing lock has z but z was passed))rM   rN   rc   rP   ra   rQ   rS   )r^   getrJ   is_thread_localrM   _contextrN   rP   rQ   rS   itemsr
   
ValueErrorinspect	signaturer   
parametersr   __call__)clsrK   rM   rN   rc   rP   ra   rQ   rS   kwargsinstanceparams_to_checknamepassed_param	set_paramnon_matching_paramsmsg
param_name
all_paramspresent_paramskeyvalueinit_paramsr"   s                          r#   rm   FileLockMeta.__call__p   s    ~~))#i.9H%13K3K3M$N ')9)9:!#4#4#9#9:!)+<+< =&35K5K%L!)+<+< =# <K;P;P;R';R77|#0 4D33;R $ '
 +99 `33=P=V=V=X9J 9T*-A)ER^Q__kllC >Y o% ( (* 	
 	

 !**3<<8CC4>4D4D4F`4Fjc5#Q_J_zsEz4F`7#I==-5NN3y>*NH--M'> as   "F/4F/F6*F6rF   )rK   str | os.PathLike[str]rM   rL   rN   r   rc   rO   rP   rO   ra   rO   rQ   rL   rS   rR   ro   r	   r'   rd   )	r)   r*   r+   r,   rV   r   rm   r-   r.   r/   s   @r#   r[   r[   m   s    66
 $!?. "#!%?.)?. ?. 	?.
 ?. ?. ?. ?. ?. ?. 
?. ?.r%   r[   c                    ^  \ rS rSr% SrS\S'   S(U 4S jjrS\S4SSS	S
S.                 S)S jjjrS*S jr	\
S*S j5       r\
S+S j5       r\
S,S j5       r\R                  S-S j5       r\
S*S j5       r\R                  S.S j5       r\
S,S j5       r\R                  S/S j5       r\
S0S j5       r\R                  S1S j5       r\
S2S j5       r\
S*S j5       rS2S jrS3S jr\S3S j5       r\S3S j5       r\
S*S j5       r\
S2S j5       r\              S4S  j5       r  S5S
S
S
S!.           S6S" jjjrS7S8S# jjrS9S$ jr        S:S% jr S3S& jr!S'r"U =r#$ );rd      aH  
Abstract base class for a file lock object.

Provides a reentrant, cross-process exclusive lock backed by OS-level primitives. Subclasses implement the actual
locking mechanism (:class:`UnixFileLock <filelock.UnixFileLock>`, :class:`WindowsFileLock
<filelock.WindowsFileLock>`, :class:`SoftFileLock <filelock.SoftFileLock>`).

r]   r^   c                D   > [         TU ]  " S0 UD6  [        5       U l        g)z'Setup unique state for lock subclasses.NrF   )r   __init_subclass__r   r^   )rn   ro   r"   s     r#   r   BaseFileLock.__init_subclass__   s    !+F+,.r%   r   TFr_   Nr`   c                   X@l         X`l        [        R                  " U5      UUUUUS.n	U(       a  [        O[
        " S0 U	D6U l        g)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. When not specified, the OS controls permissions via umask and
    default ACLs, preserving POSIX default ACL inheritance in shared directories.
: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 poll_interval: default interval for polling the lock file, in seconds. It will be used as fallback value
    in the acquire method, if no poll_interval value (``None``) is given.
:param lifetime: maximum time in seconds a lock can be held before it is considered expired. When set, a waiting
    process will break a lock whose file modification time is older than ``lifetime`` seconds. ``None`` (the
    default) means locks never expire.

)rK   rM   rN   rP   rQ   rS   NrF   )_is_thread_local_is_singletonosfspathrX   rH   rg   )
r!   rK   rM   rN   rc   rP   ra   rQ   rS   ro   s
             r#   r   BaseFileLock.__init__   sR    D !-)
 9- * "
 EQ*@Ve*e)pio)pr%   c                    U R                   $ )z?:returns: a flag indicating if this lock is thread local or not)r   r8   s    r#   rf   BaseFileLock.is_thread_local   s    $$$r%   c                    U R                   $ )zY
:returns: a flag indicating if this lock is singleton or not

.. versionadded:: 3.13.0

)r   r8   s    r#   ra   BaseFileLock.is_singleton   s     !!!r%   c                .    U R                   R                  $ )z:returns: path to the lock file)rg   rK   r8   s    r#   rK   BaseFileLock.lock_file  s     }}&&&r%   c                .    U R                   R                  $ )zK
:returns: the default timeout value, in seconds

.. versionadded:: 2.0.0

)rg   rM   r8   s    r#   rM   BaseFileLock.timeout  s     }}$$$r%   c                8    [        U5      U R                  l        g)zM
Change the default timeout value.

:param value: the new value, in seconds

N)rL   rg   rM   r!   r{   s     r#   rM   r     s     !&er%   c                .    U R                   R                  $ )zM
:returns: whether the locking is blocking or not

.. versionadded:: 3.14.0

rg   rP   r8   s    r#   rP   BaseFileLock.blocking       }}%%%r%   c                $    XR                   l        g)zJ
Change the default blocking value.

:param value: the new value as bool

Nr   r   s     r#   rP   r   %       "'r%   c                .    U R                   R                  $ )zO
:returns: the default polling interval, in seconds

.. versionadded:: 3.24.0

rg   rQ   r8   s    r#   rQ   BaseFileLock.poll_interval/  s     }}***r%   c                $    XR                   l        g)zP
Change the default polling interval.

:param value: the new value, in seconds

Nr   r   s     r#   rQ   r   9  s     ',#r%   c                .    U R                   R                  $ )zj
:returns: the lock lifetime in seconds, or ``None`` if the lock never expires

.. versionadded:: 3.24.0

rg   rS   r8   s    r#   rS   BaseFileLock.lifetimeC  r   r%   c                $    XR                   l        g)zg
Change the lock lifetime.

:param value: the new value in seconds, or ``None`` to disable expiration

Nr   r   s     r#   rS   r   M  r   r%   c                n    U R                   R                  [        :X  a  S$ U R                   R                  $ )z/:returns: the file permissions for the lockfilei  rg   rN   r   r8   s    r#   rN   BaseFileLock.modeW  s+     **.>>uVDMMDVDVVr%   c                <    U R                   R                  [        :g  $ )z::returns: whether the file permissions were explicitly setr   r8   s    r#   has_explicit_modeBaseFileLock.has_explicit_mode\  s     }}!!%555r%   c                n    U R                   R                  [        :X  a  S$ U R                   R                  $ )ue   :returns: the mode for os.open() — 0o666 when unset (let umask/ACLs decide), else the explicit modei  r   r8   s    r#   
_open_modeBaseFileLock._open_modea  s)    **.>>uVDMMDVDVVr%   c                F   U R                   R                  =nc  g[        R                  " [        5         [
        R
                  " 5       [        R                  " U R                  5      R                  5       R                  -
  U:  a
   SSS5        gU R                   S[        R                  " 5        3n[        R                  " U R                  5      R                  U5        [        R                  " U5      R                  5         SSS5        g! , (       d  f       g= f)zVRemove the lock file if its modification time exceeds the configured :attr:`lifetime`.Nz.break.)rg   rS   
contextlibsuppressOSErrortimepathlibPathrK   statst_mtimer   getpidrenameunlink)r!   rS   
break_paths      r#   _try_break_expired_lock$BaseFileLock._try_break_expired_locke  s    ...H7  )yy{W\\$..9>>@IIIHT *) !NN+7299;-@JLL(//
;LL$++- *))s   ADA7D
D c                    [         e)zjIf the file lock could be acquired, self._context.lock_file_fd holds the file descriptor of the lock file.NotImplementedErrorr8   s    r#   _acquireBaseFileLock._acquirep  
     "!r%   c                    [         e)z>Releases the lock and sets self._context.lock_file_fd to None.r   r8   s    r#   _releaseBaseFileLock._releaseu  r   r%   c                2    U R                   R                  SL$ )z
:returns: A boolean indicating if the lock file is holding the lock currently.

.. versionchanged:: 2.0.0

    This was previously a method and is now a property.

N)rg   rT   r8   s    r#   	is_lockedBaseFileLock.is_lockedz  s     }}))55r%   c                .    U R                   R                  $ )zQ:returns: The number of times this lock has been acquired (but not yet released).)rg   rU   r8   s    r#   rU   BaseFileLock.lock_counter  s     }})))r%   c                  USL a  [         R                  SX5        gUb#  U" 5       (       a  [         R                  SX5        gSUs=::  a  [        R                  " 5       U-
  :  a  O  g[         R                  SX5        gg)NFz+Failed to immediately acquire lock %s on %sTz(Cancellation requested for lock %s on %sr   z"Timeout on acquiring lock %s on %s)_LOGGERdebugr   perf_counter)lock_idlock_filenamerP   cancel_checkrM   
start_times         r#   _check_give_upBaseFileLock._check_give_up  ss     uMMG`#MMDg]:$++-
::  MM>Wr%   )poll_intervallrP   r   c          	        Uc  U R                   R                  nUc  U R                   R                  nUb  Sn[        R                  " U[
        SS9  UnUb  UOU R                   R                  nU R                   =R                  S-  sl        [        U 5      nU R                  n[        U5      n	U R                   R                  S:H  =(       a&    U R                  (       + =(       a    US:  =(       a    Un
U
(       aW  [        R                  R                  U	5      =nb5  X:w  a0  U R                   =R                  S-  sl        SU S3n[        U5      e[         R"                  " 5       n  U R                  (       d6  U R%                  5         [&        R)                  S	Xx5        U R+                  5         U R                  (       a  [&        R)                  S
Xx5        OTU R-                  UUUUUUS9(       a  [/        U5      eSn[&        R)                  XgX5        [         R0                  " U5        M  U R                   R                  S:X  a  U[        R                  U	'   [9        U S9$ ! [2         an    [5        SU R                   R                  S-
  5      U R                   l        U R                   R                  S:X  a   [        R                  R7                  U	S5        e f = f)a  
Try to acquire the file lock.

:param timeout: maximum wait time for acquiring the lock, ``None`` means use the default :attr:`~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, ``None`` means use the default
    :attr:`~poll_interval`
:param poll_intervall: deprecated, kept for backwards compatibility, use ``poll_interval`` instead
: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.
:param cancel_check: a callable returning ``True`` when the acquisition should be canceled. Checked on each poll
    iteration. When triggered, raises :class:`~Timeout` just like an expired timeout.

:returns: a context object that will unlock the file when the context is exited

:raises Timeout: if fails to acquire lock within the timeout period

.. 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()

.. versionchanged:: 2.0.0

    This method returns now a *proxy* object instead of *self*, so that it can be used in a with statement
    without side effects.

Nz+use poll_interval instead of poll_intervall   )
stacklevelr   r   zDeadlock: lock 'z' is already held by a different FileLock instance in this thread. Use is_singleton=True to enable reentrant locking across instances.z#Attempting to acquire lock %s on %szLock %s acquired on %s)rP   r   rM   r   z2Lock %s not acquired on %s, waiting %s seconds ...r4   )rg   rM   rP   warningswarnDeprecationWarningrQ   rU   idrK   
_canonicalr   	_registryr    re   RuntimeErrorr   r   r   r   r   r   r   r   sleepBaseExceptionmaxpopr1   )r!   rM   rQ   r   rP   r   rv   r   r   	canonicalwould_blockexistingr   s                r#   acquireBaseFileLock.acquire  s]   \ ?mm++G}}--H%?CMM#1a@*M)6)BHcHc 	""a'"T(}-	mm00A5idnn:LiQX[\Q\iai	(:(:9(EEHRW_WjMM&&!+&"=/ 2= > 
 s##&&(
	~~002MM"G`MMO>>MM":GS&&!%!-#) '  "-00JcMI

=)' 2 ==%%*(/INN9%!t,,  	),Q0J0JQ0N)ODMM&}}))Q.""9d3		s   *A/I$ AI$ $A8Kc                   U R                   (       a  U R                  =R                  S-  sl        U R                  R                  S:X  d  U(       a  [        U 5      U R                  p2[
        R                  SX#5        U R                  5         SU R                  l        [        R                  R                  [        U5      S5        [
        R                  SX#5        ggg)z
Release the file lock. The lock is only completely released when the lock counter reaches 0. 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   r   z#Attempting to release lock %s on %sNzLock %s released on %s)r   rg   rU   r   rK   r   r   r   r   r    r   r   )r!   forcer   r   s       r#   r<   BaseFileLock.release  s     >>MM&&!+&}}))Q.%)+D4>>CW\-.*"":m#<dC6O 38 r%   c                &    U R                  5         U $ )z/
Acquire the lock.

:returns: the lock object

)r   r8   s    r#   r9   BaseFileLock.__enter__  s     	r%   c                $    U R                  5         g)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r<   r=   s       r#   rA   BaseFileLock.__exit__)  s     	r%   c                "    U R                  SS9  g)z'Called when the lock object is deleted.T)r   Nr   r8   s    r#   __del__BaseFileLock.__del__9  s    4 r%   )rg   r   r   )ro   zdict[str, Any]r'   r(   )rK   r~   rM   rL   rN   r   rc   rO   rP   rO   ra   rO   rQ   rL   rS   rR   r'   r(   )r'   rO   )r'   rJ   )r'   rL   )r{   zfloat | strr'   r(   )r{   rO   r'   r(   )r{   rL   r'   r(   )r'   rR   )r{   rR   r'   r(   )r'   r   r&   )r   r   r   rJ   rP   rO   r   Callable[[], bool] | NonerM   rL   r   rL   r'   rO   )NN)rM   rR   rQ   rR   r   rR   rP   zbool | Noner   r   r'   r1   )F)r   rO   r'   r(   )r'   r   rD   )$r)   r*   r+   r,   rE   rV   r   r   r   rf   propertyra   rK   rM   setterrP   rQ   rS   rN   r   r   r   r   r   r   r   rU   staticmethodr   r   r<   r9   rA   r   r-   r.   r/   s   @r#   rd   rd      s    76/ $!/q "#!%/q)/q /q 	/q
 /q /q /q /q /q 
/qb% " " ' ' % % ^^- - & & __' ' + + , , & & __' ' W W 6 6W	. " " " " 	6 	6 * *  	
 0   
 , !%&*i-
 (, $26i-i- $i-
 %i- i- 0i- 
i-VP(, ( (	
 
 ! !r%   rd   )	metaclass)r   r1   rd   )4
__future__r   r   rj   loggingr   r   sysr   r   abcr   r   dataclassesr   	threadingr   typingr   r	   r
   weakrefr   _errorr   r   rV   collections.abcr   typesr   _read_writer   version_infor   typing_extensions	getLoggerr   platformpathabspathrealpathr   r   r   r1   rH   rX   r[   ContextDecoratorrd   __all__rF   r%   r#   <module>r     s   "    	  
   ' !  + + ' 
  # (#*
7"* 

J
' !$ 7RWW__RWW=M=M
'5 ' !"	 $   >C_e CB.7 B.JI!:.., I!Xr%   