Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/pip/_vendor/lockfile/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/pip/_vendor/lockfile/__pycache__/linklockfile.cpython-36.pyc

3

�Pf\
�@sPddlmZddlZddlZddlmZmZmZmZm	Z	m
Z
Gdd�de�ZdS)�)�absolute_importN�)�LockBase�
LockFailed�	NotLocked�	NotMyLock�LockTimeout�
AlreadyLockedc@s:eZdZdZd
dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)�LinkLockFilez�Lock access to a file using atomic property of link(2).

    >>> lock = LinkLockFile('somefile')
    >>> lock = LinkLockFile('somefile', threaded=False)
    NcCs"yt|jd�j�Wn"tk
r6td|j��YnX|dk	rD|n|j}tj�}|dk	rj|dkrj||7}x�ytj|j|j	�Wn�t
k
�rtj|j�j}|dkr�dS|dk	r�tj�|kr�tj
|j�|dkr�td|j��ntd|j��tj|dk	�r
|d�pd�YqlXdSqlWdS)	N�wbzfailed to create %sr�z&Timeout waiting to acquire lock for %sz%s is already locked�
g�������?)�open�unique_name�close�IOErrorr�timeout�time�os�link�	lock_file�OSError�stat�st_nlink�unlinkr�pathr	Zsleep)�selfrZend_timeZnlinks�r�"/usr/lib/python3.6/linklockfile.py�acquires0
$zLinkLockFile.acquirecCsP|j�std|j��ntjj|j�s4td|j��tj|j�tj|j�dS)Nz%s is not lockedz%s is locked, but not by me)	�	is_lockedrrr�existsrrrr)rrrr�release7szLinkLockFile.releasecCstjj|j�S)N)rrr!r)rrrrr ?szLinkLockFile.is_lockedcCs(|j�o&tjj|j�o&tj|j�jdkS)Nr)r rrr!rrr)rrrr�i_am_lockingBszLinkLockFile.i_am_lockingcCstjj|j�rtj|j�dS)N)rrr!rr)rrrr�
break_lockGszLinkLockFile.break_lock)N)	�__name__�
__module__�__qualname__�__doc__rr"r r#r$rrrrr

s
&r
)Z
__future__rrr�rrrrrr	r
rrrr�<module>s 

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists