| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /proc/thread-self/root/lib/python3.9/site-packages/lockfile/__pycache__/ |
Upload File : |
a
��UV\
� @ sP d dl mZ d dlZd dlZddlmZmZmZmZm Z m
Z
G dd� de�ZdS )� )�absolute_importN� )�LockBase�
LockFailed� NotLocked� NotMyLock�LockTimeout�
AlreadyLockedc @ s: e Zd ZdZd
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)
Nc C s zt | jd��� W n ty4 td| j ��Y n0 |d urB|n| j}t�� }|d urh|dkrh||7 }zt�| j| j � W n� t
�y t�| j�j}|dkr�Y d S |d ur�t�� |kr�t�
| j� |dkr�td| j ��ntd| j ��t�|d u�r|d �pd� Y qh0 d S qhd S ) 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 �sleep)�selfr Zend_timeZnlinks� r �9/usr/lib/python3.9/site-packages/lockfile/linklockfile.py�acquire s2 ��$zLinkLockFile.acquirec C sP | � � std| j ��ntj�| j�s4td| j ��t�| j� t�| j� d S )Nz%s is not lockedz%s is locked, but not by me) � is_lockedr r r �existsr r r r �r r r r �release7 s zLinkLockFile.releasec C s t j�| j�S �N)r r r"