[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@52.15.241.87: ~ $
U

��UV��@stdZddlmZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZGdd�de�Z
dd	�Zd
d�Zdd
�ZdS)z8 Lockfile behaviour implemented via Unix PID files.
    �)�absolute_importN�)�LockBase�
AlreadyLocked�
LockFailed�	NotLocked�	NotMyLock�LockTimeoutc@sLeZdZdZddd�Zdd�Zdd	�Zd
d�Zddd
�Zdd�Z	dd�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')
    FNcCst�||d|�|j|_dS)NF)r�__init__�pathZunique_name)�selfrZthreaded�timeout�r�/pidlockfile.pyr$szPIDLockFile.__init__cCs
t|j�S)z- Get the PID from the lock file.
            )�read_pid_from_pidfiler�r
rrr�read_pid*szPIDLockFile.read_pidcCstj�|j�S)zv Test if the lock is currently held.

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

            )�osr�existsrrrr�	is_locked/szPIDLockFile.is_lockedcCs|��ot��|��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�getpidrrrrr�i_am_locking7szPIDLockFile.i_am_lockingc
Cs�|dk	r|n|j}t��}|dk	r2|dkr2||7}zt|j�Wn�tk
r�}zt|jtjkr�t��|kr�|dk	r�|dkr�td|j��ntd|j��t�	|dk	r�|dp�d�nt
d|j��W5d}~XYq2XdSq2dS)z� Acquire the lock.

        Creates the PID file for this lock, or raises an error if
        the lock could not be acquired.
        Nrz&Timeout waiting to acquire lock for %sz%s is already locked�
g�������?zfailed to create %s)r�time�write_pid_to_pidfiler�OSError�errnoZEEXISTr	r�sleepr)r
rZend_time�excrrr�acquire?s&�� zPIDLockFile.acquirecCs:|��std|j��|��s,td|j��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)rrrrr�remove_existing_pidfilerrrr�release_s
zPIDLockFile.releasecCst|j�dS)z� Break an existing lock.

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

            N)r!rrrrr�
break_locklszPIDLockFile.break_lock)FN)N)�__name__�
__module__�__qualname__�__doc__rrrrr r"r#rrrrr
s


 
r
cCsbd}zt|d�}Wntk
r&Yn8X|����}zt|�}Wntk
rTYnX|��|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�IOError�readline�strip�int�
ValueError�close)�pidfile_path�pid�pidfile�linerrrrvsrcCsRtjtjBtjB}d}t�|||�}t�|d�}t��}|�d|�|��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_WRONLYr)�fdopenr�writer/)r0Z
open_flagsZ	open_modeZ
pidfile_fdr2r1rrrr�s	rc
CsFzt�|�Wn2tk
r@}z|jtjkr.n�W5d}~XYnXdS)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�removerrZENOENT)r0rrrrr!�sr!)r'Z
__future__rrrr�rrrrrr	r
rrr!rrrr�<module>s ]"

Filemanager

Name Type Size Permission Actions
__init__.cpython-38.opt-1.pyc File 9.49 KB 0644
__init__.cpython-38.pyc File 9.49 KB 0644
linklockfile.cpython-38.opt-1.pyc File 2.17 KB 0644
linklockfile.cpython-38.pyc File 2.17 KB 0644
mkdirlockfile.cpython-38.opt-1.pyc File 2.53 KB 0644
mkdirlockfile.cpython-38.pyc File 2.53 KB 0644
pidlockfile.cpython-38.opt-1.pyc File 4.68 KB 0644
pidlockfile.cpython-38.pyc File 4.68 KB 0644
sqlitelockfile.cpython-38.opt-1.pyc File 3.56 KB 0644
sqlitelockfile.cpython-38.pyc File 3.56 KB 0644
symlinklockfile.cpython-38.opt-1.pyc File 2.06 KB 0644
symlinklockfile.cpython-38.pyc File 2.06 KB 0644