HEX
Server: nginx/1.24.0
System: Linux webserver 6.8.0-87-generic #88-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 09:28:41 UTC 2025 x86_64
User: wpuser (1002)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_internal/utils/__pycache__/filesystem.cpython-312.pyc
�

��h�
��ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZddlmZmZmZddlmZddlmZded	efd
�Zedede
d	eeddffd��Zed
ed�ed���Zeej:�Zded	efd�Zded	efd�Zdeded	e
efd�Z ded	ee!e"ffd�Z#ded	efd�Z$ded	ee!e"ffd�Z%ded	efd�Z&y)�N)�contextmanager)�NamedTemporaryFile)�Any�BinaryIO�	Generator�List�Union�cast)�retry�stop_after_delay�
wait_fixed)�get_path_uid)�format_size�path�returnc���tjdk(sttd�sytjj|�sJ�d}||k7r�tjj
|�rLtj�dk(r	t|�}|dk(Stj|tj�S|tjj|�}}||k7r��y#t$rYywxYw)N�win32�geteuidTrF)
�sys�platform�hasattr�osr�isabs�lexistsrr�OSError�access�W_OK�dirname)r�previous�path_uids   �@/usr/lib/python3/dist-packages/pip/_internal/utils/filesystem.py�check_path_ownerr"s����|�|�w��g�b�)�&<��
�7�7�=�=������H�
�(�
�
�7�7�?�?�4� ��z�z�|�q� �!�+�D�1�H� �1�}�$��y�y��r�w�w�/�/�!�2�7�7�?�?�4�#8�d�H��(�
����!� �!�s�C � 	C,�+C,�kwargsc+��K�tddtjj|�tjj	|�dd�|��5}tt|�}	|��|j�tj|j��	ddd�y#|j�tj|j��wxYw#1swYyxYw�w)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�)
rrrr�basenamer
r�flush�fsync�fileno)rr#�f�results    r!�adjacent_tmp_filer0+s�����
�
���G�G�O�O�D�!��w�w����%��	
�
�
�&�
��h��"��	&��L��L�L�N��H�H�V�]�]�_�%�&�&��
�L�L�N��H�H�V�]�]�_�%��&�&�s6�AC$�
C�B �#3C�	C$� 5C�C�C!�C$T�g�?)�reraise�stop�waitc�R�tjj|�sGtjj|�}||k(rn"|}tjj|�s�Gtjdk(r$tj
|tj�St|�S)zgCheck if a directory is writable.

    Uses os.access() on POSIX, tries creating files on Windows.
    �posix)rr�isdirr�namerr�_test_writable_dir_win)r�parents  r!�test_writable_dirr;Lsu���g�g�m�m�D�!�������&���T�>����	�g�g�m�m�D�!�
�w�w�'���y�y��r�w�w�'�'�!�$�'�'�c����d}d�td�D]�}|dj�fd�td�D��z}tjj||�}	tj|tj
tjztjz�}tj|�tj|�ytd	��#t$rY��t$rYywxYw)
N�(accesstest_deleteme_fishfingers_custard_�$abcdefghijklmnopqrstuvwxyz0123456789�
�c3�H�K�|]}tj�����y�w�N)�random�choice)�.0�_�alphabets  �r!�	<genexpr>z)_test_writable_dir_win.<locals>.<genexpr>ds�����!L�a�&�-�-��"9�!L�s�"�TFz3Unexpected condition testing for writable directory)
�range�joinrr�open�O_RDWR�O_CREAT�O_EXCL�close�unlink�FileExistsError�PermissionErrorr)rr*rGr8�file�fdrHs      @r!r9r9^s����:�H�5�H�
�2�Y����"�'�'�!L�5��8�!L�L�L���w�w�|�|�D�$�'��	�����r�y�y�2�:�:�5��	�	�A�B�B�
�H�H�R�L��I�I�d�O��#�(�G�
H�H���	���	��
	�s�AC�	C0�$C0�/C0�patternc���g}tj|�D]6\�}}tj||�}|j	�fd�|D���8|S)z�Returns a list of absolute paths of files beneath path, recursively,
    with filenames which match the UNIX-style shell glob pattern.c3�^�K�|]$}tjj�|����&y�wrC)rrrL)rFr.�roots  �r!rIzfind_files.<locals>.<genexpr>�s �����=��b�g�g�l�l�4��+�=�s�*-)r�walk�fnmatch�filter�extend)rrWr/rG�files�matchesrZs      @r!�
find_filesrazsP����F��'�'�$�-�>���a���.�.���0���
�
�=�W�=�=�>��Mr<c��tjj|�rytjj|�S)Nr)rr�islink�getsize�rs r!�	file_sizerf�s(��	�w�w�~�~�d���
�7�7�?�?�4� � r<c�*�tt|��SrC)rrfres r!�format_file_sizerh�s���y���'�'r<c��d}tj|�D];\}}}|D]0}tjj||�}|t	|�z
}�2�=|S)Ng)rr[rrLrf)r�sizerZ�_dirsr_�filename�	file_paths       r!�directory_sizern�s^���D� �g�g�d�m�)���e�U��	)�H������T�8�4�I��I�i�(�(�D�	)�)��Kr<c�*�tt|��SrC)rrnres r!�format_directory_sizerp�s���~�d�+�,�,r<)'r\r�os.pathrDr�
contextlibr�tempfiler�typingrrrrr	r
�pip._vendor.tenacityrrr
�pip._internal.utils.compatr�pip._internal.utils.miscr�str�boolr"r0�_replace_retry�replacer;r9ra�int�floatrfrhrnrpr)r<r!�<module>r~sB���	��
�
�%�'�>�>�D�D�3�0��3��4��6�&�C�&�3�&�9�X�t�T�=Q�3R�&��&�2�t�*:�1�*=�J�t�DT�U��
����
$��
(�C�(�D�(�$I��I��I�8�S��3��4��9��!�C�!�E�#�u�*�-�!�(�3�(�3�(�����s�E�z�!2��-��-��-r<