https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/filelock/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/filelock/__pycache__/_api.cpython-310.pyc
o

;�b� �@s�ddlmZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZddlm
Z
ddlmZddlmZe�d	�ZGd
d�d�ZGdd
�d
eej�Zd
dgZdS)�)�annotationsN)�ABC�abstractmethod)�Lock)�
TracebackType)�Any�)�Timeout�filelockc@s.eZdZdZddd�Zddd	�Zddd�ZdS)�AcquireReturnProxyzDA context aware object that will release the lock file when exiting.�lock�BaseFileLock�return�NonecCs
||_dS�N�r)�selfr�r�//usr/lib/python3/dist-packages/filelock/_api.py�__init__s
zAcquireReturnProxy.__init__cC�|jSrr�rrrr�	__enter__szAcquireReturnProxy.__enter__�exc_type�type[BaseException] | None�	exc_value�BaseException | None�	traceback�TracebackType | NonecCs|j��dSr)r�release�rrrrrrr�__exit__szAcquireReturnProxy.__exit__N)rr
rr�rr
�rrrrrrrr)�__name__�
__module__�__qualname__�__doc__rrr!rrrrrs


rc@s�eZdZdZd3d4d	d
�Zed5dd
��Zed6dd��Zejd7dd��Ze	d8dd��Z
e	d8dd��Zed9dd��Z		d:dd�d;d!d"�Z
d<d=d%d&�Zd>d'd(�Zd?d/d0�Zd8d1d2�ZdS)@r
z+Abstract base class for a file lock object.����	lock_file�str | os.PathLike[Any]�timeout�floatrrcCs*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__�strcCr)z:return: path to the lock file)r/rrrrr)DszBaseFileLock.lock_filecCr)zU
        :return: the default timeout value

        .. versionadded:: 2.0.0
        )�_timeoutrrrrr+IszBaseFileLock.timeout�value�float | strcCst|�|_dS)zX
        Change the default timeout value.

        :param value: the new value
        N)r,r4)rr5rrrr+RscC�t�)zbIf the file lock could be acquired, self._lock_file_fd holds the file descriptor of the lock file.��NotImplementedErrorrrrr�_acquire[�zBaseFileLock._acquirecCr7)z6Releases the lock and sets self._lock_file_fd to None.r8rrrr�_release`r;zBaseFileLock._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)r0rrrr�	is_lockedes

zBaseFileLock.is_lockedN皙�����?)�poll_intervall�float | None�
poll_intervalr@rcCs�|dur|j}|durd}tj|tdd�|}|j�|jd7_Wd�n1s,wYt|�}|j}t�	�}z[	|j�|j
sPt�d||�|�
�Wd�n1sZwY|j
rjt�d||�n,d	|krxt�	�|kr�nnt�d
||�t|j��d}t�||||�t�|�q>Wn$ty�|j�td	|jd�|_Wd��1s�wY�wt|d�S)
az
        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
        :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�)�
stacklevelrTz#Attempting to acquire lock %s on %szLock %s acquired on %srz"Timeout on acquiring lock %s on %sz2Lock %s not acquired on %s, waiting %s seconds ...r)r+�warnings�warn�DeprecationWarningr1r2�idr/�time�	monotonicr>�_LOGGER�debugr:r	�sleep�
BaseException�maxr)rr+rBr@�msg�lock_id�
lock_filename�
start_timerrr�acquireqsP%��� 

�
���
zBaseFileLock.acquireF�forcecCs�|j�G|jr:|jd8_|jdks|rBt|�|j}}t�d||�|��d|_t�d||�Wd�dSWd�dSWd�dS1sMwYdS)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)r1r>r2rHr/rKrLr<)rrUrQrRrrrr�s��"�zBaseFileLock.releasecCs|��|S)zE
        Acquire the lock.

        :return: the lock object
        )rTrrrrr�szBaseFileLock.__enter__rrrrrrcCs|��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)rUNrVrrrr�__del__�szBaseFileLock.__del__)r()r)r*r+r,rr)rr3)rr,)r5r6rr)rr)rr=)Nr?)r+rArBr,r@rArr)F)rUr=rrr"r#)r$r%r&r'r�propertyr)r+�setterrr:r<r>rTrrr!rWrrrrr
's0
��K

	r
)�
__future__r�
contextlib�loggingr-rIrE�abcrr�	threadingr�typesr�typingr�_errorr	�	getLoggerrKr�ContextDecoratorr
�__all__rrrr�<module>s$
H�

https://t.me/RX1948 - 2025