File: D:/Python311/Lib/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-311.pyc
�
�miy � �, � d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ d dl m
Z
d dlmZ d dl
mZmZmZ d dlmZ d dlmZ d d lmZ d%d�Ze
d&d�� � Z edd�� � ej � � Zd%d�Zd%d�Zd'd�Zd(d�Zd)d�Zd(d�Zd)d�Z d*d$�Z!dS )+� )�annotationsN)� Generator)�contextmanager)�NamedTemporaryFile)�Any�BinaryIO�cast)�get_path_uid)�format_size)�retry�path�str�return�boolc �� � t j dk st t d� � sdS t j � | � � sJ �d }| |k r�t j � | � � r^t j � � dk r( t | � � }n# t $ r Y dS w xY w|dk S t j
| t j � � S | t j � | � � } }| |k ��dS )N�win32�geteuidTr F)
�sys�platform�hasattr�osr
�isabs�lexistsr r
�OSError�access�W_OK�dirname)r
�previous�path_uids �@D:\Python311\Lib\site-packages\pip/_internal/utils/filesystem.py�check_path_ownerr! s� � � �|�w�� �g�b�)�&<�&<� ��t�
�7�=�=��������H�
�(�
� 9�
�7�?�?�4� � �
9��z�|�|�q� �
0�!�+�D�1�1�H�H��� !� !� !� �5�5�!�����1�}�$��y��r�w�/�/�/�!�2�7�?�?�4�#8�#8�d�H� �(�
� 9� �5s �B �
B&�%B&�kwargsr �Generator[BinaryIO, None, None]c + � K � t ddt j � | � � t j � | � � dd�|��5 }t t |� � } |V � |� � � t j |� � � � � n?# |� � � t j |� � � � � w xY w ddd� � dS # 1 swxY w Y dS )a% Return a file-like object pointing to a tmp file next to path.
The file is created securely and is ensured to be written to disk
after the context reaches its end.
kwargs will be passed to tempfile.NamedTemporaryFile to control
the way the temporary file will be opened.
Fz.tmp)�delete�dir�prefix�suffixN� )
r r r
r �basenamer r �flush�fsync�fileno)r
r"