HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/filelock/__pycache__/_unix.cpython-310.pyc
o

;j��	@s�ddlmZddlZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZddl
mZddlmZdd	lmZd
ZejdkrJGdd
�d
e�Zn&zddlZejejejejfZWneefyeYnwdZGdd
�d
e�Zd
dgZdS)�)�annotationsN)�suppress)�EAGAIN�ENOSYS�EWOULDBLOCK)�Path)�cast�)�BaseFileLock)�ensure_directory_existsF�win32c@s$eZdZdZd	dd�Zd	dd�ZdS)
�UnixFileLockzHUses the :func:`fcntl.flock` to hard lock the lock file on unix systems.�return�NonecC�t��N��NotImplementedError��self�r�B/opt/saltstack/salt/lib/python3.10/site-packages/filelock/_unix.py�_acquire��UnixFileLock._acquirecCrrrrrrr�_releaser�UnixFileLock._releaseN�rr)�__name__�
__module__�__qualname__�__doc__rrrrrrr
s
r
Tc@s.eZdZdZddd�Zddd�Zddd	�Zd
S)r
a0
        Uses the :func:`fcntl.flock` to hard lock the lock file on unix systems.

        Lock file cleanup: Unix and macOS delete the lock file reliably after release, even in
        multi-threaded scenarios. Unlike Windows, Unix allows unlinking files that other processes
        have open.
        rrcCs�t|j�tjtjB}ttdd�}|dur||O}|tjO}|��}z
t�|j||�}Wn@t	yB|jrAt
|j�j��rAYdS�t
ylt
|j���sP�zt�|j|tj@|�}Wnt	yiYYdSwYnw|jr�tt
��t�||jj�Wd�n1s�wYzt�|tjtjB�WnOty�}zCt�|�|jtkr�tt��t
|j���Wd�n1s�wY|��|��WYd}~dS|jtthvr܂WYd}~dSd}~wwt� |�j!dkr�t�|�dS||j_"dS)N�
O_NOFOLLOWr)#r�	lock_file�os�O_RDWR�O_TRUNC�getattr�O_CREATZ
_open_mode�open�FileNotFoundErrorr�parent�exists�PermissionErrorZhas_explicit_moder�fchmod�_context�mode�fcntl�flock�LOCK_EX�LOCK_NB�OSError�close�errnor�unlink�_fallback_to_soft_lockrrr�fstat�st_nlink�lock_file_fd)rZ
open_flagsZ
o_nofollowZ	open_mode�fd�	exceptionrrrr.s\

���	
�


����
rcCsHddlm}tjddd�ddlm}m}t||�r||_dS||_dS)Nr	)�SoftFileLockzDflock not supported on this filesystem, falling back to SoftFileLock�)�
stacklevel)�AsyncSoftFileLock�BaseAsyncFileLock)	Z_softr?�warnings�warnZasynciorBrC�
isinstance�	__class__)rr?rBrCrrrr9_sz#UnixFileLock._fallback_to_soft_lockcCs�td|jj�}d|j_tt��t|j���Wd�n1s!wYt�	|tj
�tt��t�|�Wd�dS1sBwYdS)N�int)
rr/r<rr5rr#r8r1r2�LOCK_UNr$r6)rr=rrrrgs
�
"�rNr)rrr r!rr9rrrrrr
%s


1�	has_fcntl)�
__future__rr$�sysrD�
contextlibrr7rrr�pathlibr�typingrZ_apir
Z_utilrrJ�platformr
r1r2r3r4rI�_�ImportError�AttributeError�__all__rrrr�<module>s0

�M�