| Server IP : 198.38.94.13 / Your IP : 216.73.217.33 Web Server : Apache System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : revivere ( 1140) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/saltstack/salt/lib/python3.10/site-packages/filelock/__pycache__/ |
Upload File : |
o
;j�! � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm Z m
Z
mZmZ d dl
mZ ddlmZ ddlmZmZ d Zd
ZdZdZd
ZG dd� de�Zddd�ZdgZdS )� )�annotationsN)�suppress)�EACCES�EEXIST�EPERM�ESRCH)�Path� )�BaseFileLock)�ensure_directory_exists�raise_on_not_writable_filei �W i g @i c @ s� e Zd ZdZd dd�Zd dd�Zd dd �Zed!d
d��Zed"dd��Z ed#dd��Z
ed$dd��Zed%dd��Z
d dd�Zd dd�Zd dd�ZdS )&�SoftFileLocka�
Portable file lock based on file existence.
Unlike :class:`UnixFileLock <filelock.UnixFileLock>` and :class:`WindowsFileLock <filelock.WindowsFileLock>`, this
lock does not use OS-level locking primitives. Instead, it creates the lock file with ``O_CREAT | O_EXCL`` and
treats its existence as the lock indicator. This makes it work on any filesystem but leaves stale lock files behind
if the process crashes without releasing the lock.
To mitigate stale locks, the lock file contains the PID and hostname of the holding process. On contention, if the
holder is on the same host and its PID no longer exists, the stale lock is broken automatically.
�return�Nonec
C s� t | j� t| j� tjtjB tjB tjB }ttdd � }d ur$||O }zt� | j|| �
� �}W n' tyW } z|jt
ksH|jtkrGtjdksH� | �� W Y d }~d S d }~ww | �|� || j_d S )N�
O_NOFOLLOW�win32)r � lock_filer �os�O_WRONLY�O_CREAT�O_EXCL�O_TRUNC�getattr�openZ
_open_mode�OSError�errnor r �sys�platform�_try_break_stale_lock�_write_lock_info�_context�lock_file_fd)�self�flagsZ
o_nofollowZfile_handler� exception� r&