File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/filelock/__pycache__/_windows.cpython-310.pyc
Back
o ;jg � @ s� d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm Z d dl mZ ddlm Z dd lmZmZ ejd krkd dlZd dlZd dlmZ dZd Zejddd�Zejgej_ejej_ddd�ZG dd� de �ZnG dd� de �ZdgZ dS )� )�annotationsN)�suppress)�EACCES)�Path)�cast� )�BaseFileLock)�ensure_directory_exists�raise_on_not_writable_file�win32)�wintypesi l �� Zkernel32T)�use_last_error�path�str�return�boolc C sB t �| �}|tkrt�� }|dkrdS |dkrdS dS t|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_point s r c @ �$ e Zd ZdZd 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 C s� t | j� t| j� t| j�rd| j� �}t|��tjtjB }zt�| j|| � � �}W n tyD } z |j tkr9� W Y d }~d S d }~ww z t� |tjd� W n tym } zt�|� |j tkrb� W Y d }~d S d }~ww || j_d S )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� exceptionr r r �_acquire; s6 �� ��� ����WindowsFileLock._acquirec C sl t d| jj�}d | j_t�|tjd� t�|� tt �� t | j��� W d � d S 1 s/w Y d S )N�intr ) r r+ r, r( r) ZLK_UNLCKr# r* r r"