File: //opt/saltstack/salt/lib/python3.10/site-packages/git/index/__pycache__/util.cpython-310.pyc
o
;j\ � @ s d Z g d�ZddlZddlmZ ddlZddlmZ ddl Z ddl
Z
ddlmZ ddl
mZmZmZmZmZmZ ddlmZmZmZ erJddlmZ e jZe jZG d d
� d
�Zdedef d
edef fdd�Zdedef d
edef fdd�Zdedef d
edef fdd�ZdS )zIndex utilities.)�TemporaryFileSwap�post_clear_cache�
default_index�git_working_dir� N)�wraps)�
TracebackType)�Any�Callable�
TYPE_CHECKING�Optional�Type�cast)�Literal�PathLike�_T)� IndexFilec @ s^ e Zd ZdZdZdeddfdd�Zddd �Zd
ee e
dee
dee ded
fdd�Z
dS )r z�Utility class moving a file to a temporary location within the same directory and
moving it back on to where on object deletion.)� file_path�
tmp_file_pathr �returnNc C sr || _ t�|�\}}tj||d�\}| _t�|� t� t
�� t�| j | j� W d � d S 1 s2w Y d S )N)�prefix�dir)r �osp�split�tempfileZmkstempr �os�close�
contextlib�suppress�OSError�replace)�selfr �dirname�basename�fd� r$ �B/opt/saltstack/salt/lib/python3.10/site-packages/git/index/util.py�__init__'