Edit File: _api.cpython-311.pyc
� ����q�d�'����������������������@����d�dl�mZ�d�dlZd�dlZd�dlZd�dlZd�dlZd�dlmZm Z �d�dl mZ�d�dlm Z �d�dlmZmZ�ddlmZ�erd�d lmZ��ej��������d ������������Z�G�d��d������������Ze�G�d ��d��������������������������Z�G�d��dee ������������Z�G�d��deej��������������������ZddgZdS�)�����)�annotationsN)�ABC�abstractmethod)� dataclass)�local)� TYPE_CHECKING�Any����)�Timeout)� TracebackType�filelockc�������������������*�����e�Zd�ZdZdd�Zdd�Zdd�ZdS�)�AcquireReturnProxyzDA context aware object that will release the lock file when exiting.�lock�BaseFileLock�return�Nonec����������������������||�_���������d�S��N�r���)�selfr���s��� �^/builddir/build/BUILD/cloudlinux-venv-1.0.2/venv/lib/python3.11/site-packages/filelock/_api.py�__init__zAcquireReturnProxy.__init__���s �������� � � �����c����������������������|�j���������S�r���r����r���s��� r���� __enter__zAcquireReturnProxy.__enter__���s �������y�r����exc_type�type[BaseException] | None� exc_value�BaseException | None� traceback�TracebackType | Nonec�����������������8�����|�j���������������������������������������������d�S�r���)r����release�r���r���r ���r"���s��� r����__exit__zAcquireReturnProxy.__exit__!���s������� � �������r���N)r���r���r���r����r���r����r���r���r ���r!���r"���r#���r���r���)�__name__� __module__�__qualname__�__doc__r���r���r'�����r���r���r���r������sV��������������N�N�������������������������r���r���c�������������������N�����e�Zd�ZU�dZded<���ded<���ded<���dZd ed <���dZded<���dS�) �FileLockContextzBA dataclass which holds the context for a ``BaseFileLock`` object.�str� lock_file�float�timeout�int�modeNz int | None�lock_file_fdr����lock_counter)r*���r+���r,���r-����__annotations__r7���r8���r.���r���r���r0���r0���*���s_����������������L�L���N�N�N���N�N�N���I�I�I�� $�L�#�#�#�#���L������r���r0���c������������������������e�Zd�ZdZdS�)�ThreadLocalFileContextz8A thread local version of the ``FileLockContext`` class.N)r*���r+���r,���r-���r.���r���r���r;���r;���A���s��������������B�B�B�Br���r;���c�����������������������e�Zd�ZdZ � � �d0d1d�Zd2d�Zed3d���������������Zed4d���������������Zej ��������d5d���������������Ze d6d���������������Ze d6d���������������Zed2d���������������Z ed7d���������������Z � �d8ddd�d9d#�Zd:d;d&�Zd<d'�Zd=d.�Zd6d/�ZdS�)>r���z+Abstract base class for a file lock object.������Tr2����str | os.PathLike[Any]r4���r3���r6���r5����thread_local�boolr���r���c�����������������z�����||�_���������t����������j��������|������������||d�}�|rt����������nt����������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. )r2���r4���r6���Nr.���)�_is_thread_local�os�fspathr;���r0����_context)r���r2���r4���r6���r@����kwargss��� r���r���zBaseFileLock.__init__H���sX������$�!-��� ���9�-�-���" ��" �� �+f�L�*e�*@�*@�Ve�)p�)p�io�)p�)p�� � � r���c����������������������|�j���������S�)z>:return: a flag indicating if this lock is thread local or not)rC���r���s��� r����is_thread_localzBaseFileLock.is_thread_locale���s�������$�$r���r1���c����������������������|�j���������j��������S�)z:return: path to the lock file)rF���r2���r���s��� r���r2���zBaseFileLock.lock_filei���s��������}�&�&r���c����������������������|�j���������j��������S�)za :return: the default timeout value, in seconds .. versionadded:: 2.0.0 )rF���r4���r���s��� r���r4���zBaseFileLock.timeoutn���s��������}�$�$r����value�float | strc�����������������8�����t����������|������������|�j��������_��������dS�)zd Change the default timeout value. :param value: the new value, in seconds N)r3���rF���r4���)r���rL���s��� r���r4���zBaseFileLock.timeoutw���s�������!&�e���� ���r���c����������������������t������������)zjIf the file lock could be acquired, self._context.lock_file_fd holds the file descriptor of the lock file.��NotImplementedErrorr���s��� r����_acquirezBaseFileLock._acquire����� �������"�!r���c����������������������t������������)z>Releases the lock and sets self._context.lock_file_fd to None.rP���r���s��� r����_releasezBaseFileLock._release����rS���r���c����������������������|�j���������j��������duS�)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)rF���r7���r���s��� r���� is_lockedzBaseFileLock.is_locked����s��������}�)��5�5r���c����������������������|�j���������j��������S�)zP:return: The number of times this lock has been acquired (but not yet released).)rF���r8���r���s��� r���r8���zBaseFileLock.lock_counter����s��������}�)�)r���N皙�����?)�poll_intervall�blocking�float | None� poll_intervalrZ���r[���r���c��������������������|�|�j���������j��������}|� d}t����������j��������|t����������d��������������|}|�j���������xj��������dz ��c_��������t ����������|�������������}|�j��������}t����������j ����������������������} � �|�j ��������s0t�������������������������������d||�������������|�� �����������������������������������|�j ��������rt�������������������������������d||�������������n�|d u�r+t�������������������������������d ||�������������t����������|�������������d|cxk����rt����������j ����������������������|z ��k�����r.n�n+t�������������������������������d||�������������t����������|�������������d }t�������������������������������||||�������������t����������j��������|���������������n6#�t ����������$�r)�t#����������d|�j���������j��������dz ��������������|�j���������_����������w�xY�wt%����������|��������������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����)� stacklevelr ���Tz#Attempting to acquire lock %s on %szLock %s acquired on %sFz+Failed to immediately acquire lock %s on %sr���z"Timeout on acquiring lock %s on %sz2Lock %s not acquired on %s, waiting %s seconds ...r���)rF���r4����warnings�warn�DeprecationWarningr8����idr2����time�perf_counterrW����_LOGGER�debugrR���r����sleep� BaseException�maxr���) r���r4���r]���rZ���r[����msg�lock_id� lock_filename� start_times ��� r����acquirezBaseFileLock.acquire����s������P��?��m�+�G��%�?�C��M�#�1�a�@�@�@�@�*�M�� � �"�"�a�'�"�"��T�(�(���� ��&�(�(� � � *��~��$��M�M�"G��R_�`�`�`��M�M�O�O�O��>����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�� �=�)�)�)� *������� �� �� �),�Q�� �0J�Q�0N�)O�)O�D�M�&�� �����"�t�,�,�,�,s ����0DF����3F3F�forcec�����������������F����|�j���������r�|�j��������xj��������dz��c_��������|�j��������j��������dk����s|rrt����������|�������������|�j��������}}t �������������������������������d||�������������|�������������������������������������d|�j��������_��������t �������������������������������d||�������������dS�dS�dS�)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 ���r���z#Attempting to release lock %s on %szLock %s released on %sN)rW���rF���r8���rd���r2���rg���rh���rU���)r���rq���rm���rn���s��� r���r%���zBaseFileLock.release����s���������>�� P��M�&�&�!�+�&�&��}�)�Q�.�.�%�.�)+�D���4�>���� � �C�W�m�\�\�\�� � ����-.�� �*�� � �6���O�O�O�O�O� P�� P��/�.r���c�����������������.�����|��������������������������������������|�S�)zE Acquire the lock. :return: the lock object )rp���r���s��� r���r���zBaseFileLock.__enter__����s������� �������r���r���r���r ���r!���r"���r#���c�����������������.�����|��������������������������������������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�r%���r&���s��� r���r'���zBaseFileLock.__exit__��s������� �������r���c�����������������2�����|�����������������������d��������������dS�)z'Called when the lock object is deleted.T)rq���Nru���r���s��� r����__del__zBaseFileLock.__del__��s���������4�� � � � � r���)r=���r>���T) r2���r?���r4���r3���r6���r5���r@���rA���r���r���)r���rA���)r���r1���)r���r3���)rL���rM���r���r���)r���r���)r���r5���)NrY���) r4���r\���r]���r3���rZ���r\���r[���rA���r���r���)F)rq���rA���r���r���r(���r)���)r*���r+���r,���r-���r���rI����propertyr2���r4����setterr���rR���rU���rW���r8���rp���r%���r���r'���rw���r.���r���r���r���r���E���s��������������5�5� ���!�q��q��q��q��q�:%��%��%��%���'��'��'���X�'���%��%��%���X�%�� �^�-��-��-���^�-���"��"��"���^�"���"��"��"���^�"��� 6�� 6�� 6���X� 6���*��*��*���X�*��!%�#�J-� �(,�� J-��J-��J-��J-��J-��J-�XP��P��P��P��P�$������� �� �� �� �!��!��!��!��!��!r���r���)� __future__r���� contextlib�loggingrD���re���ra����abcr���r����dataclassesr���� threadingr����typingr���r ����_errorr����typesr���� getLoggerrg���r���r0���r;����ContextDecoratorr����__all__r.���r���r����<module>r�������s������"��"��"��"��"��"��������������� � � � ������������#��#��#��#��#��#��#��#��!��!��!��!��!��!��������������%��%��%��%��%��%��%��%���������������$�#�#�#�#�#�#� �'� �J� '� '�����������������$�������������������,C��C��C��C��C�_�e��C��C��C�N!��N!��N!��N!��N!�3� �3��N!��N!��N!�d������r���