HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-310.pyc
o

��i�
@s|ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZddlmZmZmZddlmZddlmZded	efd
d�Zedede
d	eeddffd
d��Zeded�ed�d�Zeej�Zded	efdd�Zded	efdd�Zdeded	e
efdd�Z ded	ee!e"ffdd�Z#ded	efdd�Z$ded	ee!e"ffdd�Z%ded	efd d!�Z&dS)"�N)�contextmanager)�NamedTemporaryFile)�Any�BinaryIO�	Generator�List�Union�cast)�retry�stop_after_delay�
wait_fixed)�get_path_uid)�format_size�path�returncCs�tjdks
ttd�sdStj�|�sJ�d}||krNtj�|�rAt��dkr:z	t|�}W|dkSt	y9YdSwt�
|tj�S|tj�|�}}||ksdS)N�win32�geteuidTrF)
�sys�platform�hasattr�osr�isabs�lexistsrr
�OSError�access�W_OK�dirname)r�previous�path_uid�r�I/usr/local/lib/python3.10/site-packages/pip/_internal/utils/filesystem.py�check_path_owners"
���r!�kwargscks��tddtj�|�tj�|�dd�|���+}tt|�}z|VW|��t�|�	��n|��t�|�	��wWd�dS1sCwYdS)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�suffixNr)
rrrr�basenamer	r�flush�fsync�fileno)rr"�f�resultrrr �adjacent_tmp_file+s$�


��
�"�r-T�g�?)�reraise�stop�waitcCsRtj�|�stj�|�}||krn|}tj�|�rtjdkr%t�|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�parentrrr �test_writable_dirLs�
r7c	s�d}d�td�D]H}|d��fdd�td�D��}tj�||�}zt�|tjtjBtjB�}Wnty9Yqt	yCYdSwt�
|�t�|�d	Std
��)N�(accesstest_deleteme_fishfingers_custard_�$abcdefghijklmnopqrstuvwxyz0123456789�
�c3s�|]}t���VqdS�N)�random�choice)�.0�_��alphabetrr �	<genexpr>ds�z)_test_writable_dir_win.<locals>.<genexpr>�FTz3Unexpected condition testing for writable directory)
�range�joinrr�open�O_RDWR�O_CREAT�O_EXCL�FileExistsError�PermissionError�close�unlinkr)rr'r@r4�file�fdrrAr r5^s  �

r5�patterncsBg}t�|�D]\�}}t�||�}|��fdd�|D��q|S)z�Returns a list of absolute paths of files beneath path, recursively,
    with filenames which match the UNIX-style shell glob pattern.c3s�|]
}tj��|�VqdSr<)rrrF)r?r+��rootrr rC�s�zfind_files.<locals>.<genexpr>)r�walk�fnmatch�filter�extend)rrQr,r@�files�matchesrrRr �
find_fileszs
rZcCstj�|�rdStj�|�S)Nr)rr�islink�getsize�rrrr �	file_size�sr^cC�tt|��Sr<)rr^r]rrr �format_file_size��r`cCsBd}t�|�D]\}}}|D]}tj�||�}|t|�7}qq|S)Ng)rrTrrFr^)r�sizerS�_dirsrX�filename�	file_pathrrr �directory_size�s�rfcCr_r<)rrfr]rrr �format_directory_size�rarg)'rUrZos.pathr=r�
contextlibr�tempfiler�typingrrrrrr	�pip._vendor.tenacityr
rr�pip._internal.utils.compatr
�pip._internal.utils.miscr�str�boolr!r-�_replace_retry�replacer7r5rZ�int�floatr^r`rfrgrrrr �<module>s. "