HEX
Server: Apache
System: Linux box5514.bluehost.com 5.14.0-162.23.1.9991722448259.nf.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 31 18:11:45 UTC 2024 x86_64
User: smqcdvmy (3893)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/filelock/__pycache__/_api.cpython-39.pyc
a

]��d�"�@s�ddlmZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZddlm
Z
ddlmZddlmZe�d	�ZGd
d�d�ZGdd
�d
eej�Zd
dgZdS)�)�annotationsN)�ABC�abstractmethod)�Lock)�
TracebackType)�Any�)�TimeoutZfilelockc@sBeZdZdZddd�dd�Zdd�dd	�Zd
dddd
�dd�ZdS)�AcquireReturnProxyzDA context aware object that will release the lock file when exiting.�BaseFileLock�None)�lock�returncCs
||_dS�N�r
)�selfr
�r�1/usr/lib/python3.9/site-packages/filelock/_api.py�__init__szAcquireReturnProxy.__init__�rcCs|jSrr�rrrr�	__enter__szAcquireReturnProxy.__enter__�type[BaseException] | None�BaseException | None�TracebackType | None��exc_type�	exc_value�	tracebackrcCs|j��dSr)r
�release�rrrrrrr�__exit__szAcquireReturnProxy.__exit__N)�__name__�
__module__�__qualname__�__doc__rrr!rrrrr
sr
c@s�eZdZdZd0dddd�dd�Zed	d
�dd��Zedd
�d
d��Zejddd�dd��Ze	dd
�dd��Z
e	dd
�dd��Zedd
�dd��Zd1ddd�dddddd�d d!�Z
d2ddd#�d$d%�Zdd
�d&d'�Zd(d)d*dd+�d,d-�Zdd
�d.d/�ZdS)3rz+Abstract base class for a file lock object.���zstr | os.PathLike[Any]�floatr)�	lock_file�timeoutrcCs*t�|�|_d|_||_t�|_d|_dS)a�
        Create a new lock object.

        :param lock_file: path to the file
        :param timeout: default timeout when acquiring the lock. 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.
        Nr)�os�fspath�
_lock_file�
_lock_file_fdr)r�_thread_lock�
_lock_counter)rr(r)rrrr*s

zBaseFileLock.__init__�strrcCs|jS)z:return: path to the lock file)r,rrrrr(DszBaseFileLock.lock_filecCs|jS)zU
        :return: the default timeout value

        .. versionadded:: 2.0.0
        )�_timeoutrrrrr)IszBaseFileLock.timeoutzfloat | str)�valuercCst|�|_dS)zX
        Change the default timeout value.

        :param value: the new value
        N)r'r1)rr2rrrr)RscCst�dS)zbIf the file lock could be acquired, self._lock_file_fd holds the file descriptor of the lock file.N��NotImplementedErrorrrrr�_acquire[szBaseFileLock._acquirecCst�dS)z6Releases the lock and sets self._lock_file_fd to None.Nr3rrrr�_release`szBaseFileLock._release�boolcCs
|jduS)z�

        :return: 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)r-rrrr�	is_lockedes
zBaseFileLock.is_lockedN皙�����?T)�poll_intervall�blockingzfloat | Noner
)r)�
poll_intervalr:r;rc	Cs�|dur|j}|dur.d}tj|tdd�|}|j�|jd7_Wd�n1sX0Yt|�}|j}t�	�}z�|j�,|j
s�t�d||�|�
�Wd�n1s�0Y|j
r�t�d||��qVqz|dur�t�d	||�t|j��qzd
|k�rt�	�|k�r6nnt�d||�t|j��qzd}t�||||�t�|�qzWnPt�y�|j�"td
|jd�|_Wd�n1�s�0Y�Yn0t|d
�S)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
        :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.
        :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()

        .. 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�)�
stacklevelrz#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 ...r)r)�warnings�warn�DeprecationWarningr.r/�idr,�time�	monotonicr8�_LOGGER�debugr5r	�sleep�
BaseException�maxr
)	rr)r<r:r;�msg�lock_id�
lock_filenameZ
start_timerrr�acquireqsB(,&$2zBaseFileLock.acquireF)�forcercCs�|j�l|jrd|jd8_|jdks*|rdt|�|j}}t�d||�|��d|_t�d||�Wd�n1sx0YdS)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/
        rrz#Attempting to release lock %s on %szLock %s released on %sN)r.r8r/rBr,rErFr6)rrNrKrLrrrr�szBaseFileLock.releasecCs|��|S)zE
        Acquire the lock.

        :return: the lock object
        )rMrrrrr�szBaseFileLock.__enter__rrrrcCs|��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�rr rrrr!�s
zBaseFileLock.__exit__cCs|jdd�dS)z'Called when the lock object is deleted.T)rNNrOrrrr�__del__�szBaseFileLock.__del__)r&)Nr9)F)r"r#r$r%r�propertyr(r)�setterrr5r6r8rMrrr!rPrrrrr's0
��Q	r)Z
__future__r�
contextlibZloggingr*rCr?�abcrr�	threadingr�typesr�typingr�_errorr	Z	getLoggerrEr
�ContextDecoratorr�__all__rrrr�<module>s"
N�