ok

Mini Shell

Direktori : /opt/imunify360/venv/lib/python3.11/site-packages/lockfile/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib/python3.11/site-packages/lockfile/__pycache__/pidlockfile.cpython-311.pyc

�

>�Dg���|�dZddlmZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZGd�de��Z
d�Zd	�Zd
�ZdS)z8 Lockfile behaviour implemented via Unix PID files.
    �)�absolute_importN�)�LockBase�
AlreadyLocked�
LockFailed�	NotLocked�	NotMyLock�LockTimeoutc�@�eZdZdZdd�Zd�Zd�Zd�Zdd�Zd	�Z	d
�Z
dS)
�PIDLockFileaA Lockfile implemented as a Unix PID file.

    The lock file is a normal file named by the attribute `path`.
    A lock's PID file contains a single line of text, containing
    the process ID (PID) of the process that acquired the lock.

    >>> lock = PIDLockFile('somefile')
    >>> lock = PIDLockFile('somefile')
    FNc�L�tj||d|��|j|_dS)NF)r�__init__�path�unique_name)�selfr�threaded�timeouts    �K/opt/imunify360/venv/lib64/python3.11/site-packages/lockfile/pidlockfile.pyrzPIDLockFile.__init__$s+��	��$��e�W�5�5�5��9�����c�*�t|j��S)z- Get the PID from the lock file.
            )�read_pid_from_pidfiler�rs r�read_pidzPIDLockFile.read_pid*s��%�T�Y�/�/�/rc�J�tj�|j��S)zv Test if the lock is currently held.

            The lock is held if the PID file for this lock exists.

            )�osr�existsrs r�	is_lockedzPIDLockFile.is_locked/s���w�~�~�d�i�(�(�(rc�|�|���o(tj��|���kS)z� Test if the lock is held by the current process.

        Returns ``True`` if the current process ID matches the
        number stored in the PID file.
        )rr�getpidrrs r�i_am_lockingzPIDLockFile.i_am_locking7s,���~�~���B�B�I�K�K�4�=�=�?�?�$B�Brc���|�|n|j}tj��}|�|dkr||z
}		t|j��dS#t$r�}|jt
jkrktj��|kr6|�|dkrtd|jz���td|jz���tj	|dur|dzpd��ntd|jz���Yd}~nd}~wwxYw��)	z� Acquire the lock.

        Creates the PID file for this lock, or raises an error if
        the lock could not be acquired.
        NrTz&Timeout waiting to acquire lock for %sz%s is already locked�
g�������?zfailed to create %s)r�time�write_pid_to_pidfiler�OSError�errno�EEXISTr
r�sleepr)rr�end_time�excs    r�acquirezPIDLockFile.acquire?s@��%�0�'�'�d�l���9�;�;����7�Q�;�;����H�	�
�$�T�Y�/�/�/� ����

H�

H�

H��9���,�,��y�{�{�X�-�-�"�.�7�Q�;�;�"-�/=�.2�i�/8�#9�#9�9�#0�0F�04�	�1:�#;�#;�;��J�w�d�2�C�w��|�J�s�K�K�K�K�$�%:�T�Y�%F�G�G�G�L�K�K�K�K�����

H����	s�A�
C/�BC*�*C/c���|���std|jz���|���st	d|jz���t|j��dS)z� Release the lock.

            Removes the PID file to release the lock, or raises an
            error if the current process does not hold the lock.

            z%s is not lockedz%s is locked, but not by meN)rrrr r	�remove_existing_pidfilers r�releasezPIDLockFile.release_sm���~�~���	<��.���:�;�;�;�� � �"�"�	G��9�D�I�E�F�F�F���	�*�*�*�*�*rc�.�t|j��dS)z� Break an existing lock.

            Removes the PID file if it already exists, otherwise does
            nothing.

            N)r-rrs r�
break_lockzPIDLockFile.break_lockls��	 ��	�*�*�*�*�*r)FN)N)�__name__�
__module__�__qualname__�__doc__rrrr r+r.r0�rrrrs���������%�%�%�%�0�0�0�
)�)�)�C�C�C�����@+�+�+�+�+�+�+�+rrc��d}	t|d��}|������}	t|��}n#t$rYnwxYw|���n#t$rYnwxYw|S)z� Read the PID recorded in the named PID file.

        Read and return the numeric PID recorded as text in the named
        PID file. If the PID file cannot be read, or if the content is
        not a valid PID, return ``None``.

        N�r)�open�readline�strip�int�
ValueError�close�IOError)�pidfile_path�pid�pidfile�lines    rrrvs����C���|�S�)�)�����!�!�'�'�)�)��	��d�)�)�C�C���	�	�	��D�	�����
�
������%�
�
�
���
����(�Js"�A0�A�
A�A�0
A=�<A=c�*�tjtjztjz}d}tj|||��}tj|d��}tj��}|�d|z��|���dS)u� Write the PID in the named PID file.

        Get the numeric process ID (“PID”) of the current process
        and write it to the named file as a line of text.

        i��wz%s
N)	r�O_CREAT�O_EXCL�O_WRONLYr8�fdopenr�writer=)r?�
open_flags�	open_mode�
pidfile_fdrAr@s      rr$r$�sv���*�r�y�(�2�;�6�J��I����z�9�=�=�J��i�
�C�(�(�G�
�)�+�+�C��M�M�&�3�,�����M�M�O�O�O�O�Orc��	tj|��dS#t$r"}|jtjkrn�Yd}~dSd}~wwxYw)z� Remove the named PID file if it exists.

        Removing a PID file that doesn't already exist puts us in the
        desired state, so we ignore the condition if the file does not
        exist.

        N)r�remover%r&�ENOENT)r?r*s  rr-r-�s`���
�	�,������������9���$�$���
�D�D�D�D�D��������s��
A�?�A)r4�
__future__rr&rr#�rrrrr	r
rrr$r-r5rr�<module>rRs�����'�&�&�&�&�&�����	�	�	�	���������������������Z+�Z+�Z+�Z+�Z+�(�Z+�Z+�Z+�z���D���0����r

Zerion Mini Shell 1.0