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__/_windows.cpython-310.pyc
o

;jg�@s�ddlmZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
dd	lmZmZejd
krkddlZddlZddlmZdZd
Zejddd�Zejgej_ejej_ddd�ZGdd�de
�ZnGdd�de
�ZdgZ dS)�)�annotationsN)�suppress)�EACCES)�Path)�cast�)�BaseFileLock)�ensure_directory_exists�raise_on_not_writable_file�win32)�wintypesil��Zkernel32T)�use_last_error�path�str�return�boolcCsBt�|�}|tkrt��}|dkrdS|dkrdSdSt|t@�S)a
        Check if a path is a reparse point (symlink, junction, etc.) on Windows.

        :param path: Path to check

        :returns: True if path is a reparse point, False otherwise

        :raises OSError: If GetFileAttributesW fails for reasons other than file-not-found

        �F�)�	_kernel32�GetFileAttributesW�INVALID_FILE_ATTRIBUTES�ctypesZget_last_errorr�FILE_ATTRIBUTE_REPARSE_POINT)r�attrs�err�r�E/opt/saltstack/salt/lib/python3.10/site-packages/filelock/_windows.py�_is_reparse_points
rc@�$eZdZdZd	dd�Zd	dd�ZdS)
�WindowsFileLocka~
        Uses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.

        Lock file cleanup: Windows attempts to delete the lock file after release, but deletion is
        not guaranteed in multi-threaded scenarios where another thread holds an open handle. The lock
        file may persist on disk, which does not affect lock correctness.
        r�Nonec
Cs�t|j�t|j�t|j�rd|j��}t|��tjtjB}zt�|j||�	��}WntyD}z
|j
tkr9�WYd}~dSd}~wwz
t�
|tjd�Wntym}zt�|�|j
tkrb�WYd}~dSd}~ww||j_dS)Nz1Lock file is a reparse point (symlink/junction): r)r
�	lock_filer	r�OSError�os�O_RDWR�O_CREAT�openZ
_open_mode�errnor�msvcrt�lockingZLK_NBLCK�close�_context�lock_file_fd)�self�msg�flags�fd�	exceptionrrr�_acquire;s6


��
���

����WindowsFileLock._acquirecCsltd|jj�}d|j_t�|tjd�t�|�tt	��t
|j���Wd�dS1s/wYdS)N�intr)
rr+r,r(r)ZLK_UNLCKr#r*rr"rr!�unlink)r-r0rrr�_releaseXs

"��WindowsFileLock._releaseN�rr ��__name__�
__module__�__qualname__�__doc__r2r6rrrrr2s
rc@r)
rzWUses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.rr cC�t��N��NotImplementedError�r-rrrr2f�r3cCr>r?r@rBrrrr6irCr7Nr8r9rrrrrcs
)rrrr)!�
__future__rr#�sys�
contextlibrr'r�pathlibr�typingrZ_apirZ_utilr	r
�platformrr(rrrZWinDLLrZLPCWSTRr�argtypesZDWORD�restyperr�__all__rrrr�<module>s.


1�