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/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc
a

?�f�@sRddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZddlmZddlmZmZer�dd	lmZmZmZmZmZGd
d�de�Zdd
�Zdd�Zdd�Z e	dd��Z!e
ddd�Z"e�re"dd��Z#n
e"ej#�Z#dd�Z$dd�Z%dd�Z&dd �Z'd!d"�Z(d#d$�Z)d%d&�Z*dS)'�N)�contextmanager)�NamedTemporaryFile)�retry)�PY2)�get_path_uid)�format_size)�MYPY_CHECK_RUNNING�cast)�Any�BinaryIO�Iterator�List�Unionc@seZdZedd��ZdS)�NamedTemporaryFileResultcCsdS�N�)�selfrr�B/usr/lib/python3.9/site-packages/pip/_internal/utils/filesystem.py�fileszNamedTemporaryFileResult.fileN)�__name__�
__module__�__qualname__�propertyrrrrrrsrcCs�tjdksttd�sdStj�|�s(J�d}||kr�tj�|�r�t��dkrvzt|�}Wnt	ylYdS0|dkSt�
|tj�Sq,|tj�|�}}q,dS)NZwin32�geteuidTrF)
�sys�platform�hasattr�os�path�isabs�lexistsrr�OSError�access�W_OK�dirname)rZpreviousZpath_uidrrr�check_path_ownersr%cCsxzt�||�Wnbttfyr||fD]@}zt|�}WntyLYq*0|r*t�djfit�����q*�Yn0dS)z�Wrap shutil.copy2() but map errors copying socket files to
    SpecialFileError as expected.

    See also https://bugs.python.org/issue37700.
    z`{f}` is a socketN)�shutilZcopy2r!�IOError�	is_socketZSpecialFileError�format�locals)�src�dest�fZis_socket_filerrr�copy2_fixed;s�r.cCst�t�|�j�Sr)�stat�S_ISSOCKr�lstat�st_mode�rrrrr(Tsr(cks�tfdtj�|�tj�|�dd�|���\}td|�}z$|VW|j��t�|j�	��n|j��t�|j�	��0Wd�n1s�0YdS)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�suffixrN)
rrrr$�basenamer	r�flush�fsync�fileno)r�kwargsr-�resultrrr�adjacent_tmp_fileYs 

��

�
r>i��)Zstop_max_delayZ
wait_fixedcCs>zt�||�Wn(ty8t�|�t�||�Yn0dSr)r�renamer!�remove)r+r,rrr�replacevs

rBcCsHtj�|�s(tj�|�}||kr"q(|}qtjdkr@t�|tj�St|�S)zgCheck if a directory is writable.

    Uses os.access() on POSIX, tries creating files on Windows.
    �posix)rr�isdirr$�namer"r#�_test_writable_dir_win)r�parentrrr�test_writable_dir�s
rHcs�d}d�td�D]�}|d��fdd�td�D��}tj�||�}zt�|tjtjBtjB�}Wnfty�}zN|j	t	j
kr�WYd}~q|j	t	jks�|j	t	jkr�WYd}~dS�WYd}~qd}~00t�
|�t�|�d	Sqtd
��dS)NZ(accesstest_deleteme_fishfingers_custard_Z$abcdefghijklmnopqrstuvwxyz0123456789�
�c3s|]}t���VqdSr)�randomZchoice)�.0�_�Zalphabetrr�	<genexpr>��z)_test_writable_dir_win.<locals>.<genexpr>�FTz3Unexpected condition testing for writable directory)�range�joinrr�open�O_RDWR�O_CREAT�O_EXCLr!�errnoZEEXISTZEPERMZEACCES�close�unlink�EnvironmentError)rr8rMrEr�fd�errNrrF�s& 

�rFcsBg}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)rrrS)rLr-��rootrrrO�rPzfind_files.<locals>.<genexpr>)r�walk�fnmatch�filter�extend)r�patternr=rM�filesZmatchesrr^r�
find_files�s
rfcCstj�|�rdStj�|�S)Nr)rr�islink�getsizer3rrr�	file_size�sricCstt|��Sr)rrir3rrr�format_file_size�srjcCsBd}t�|�D].\}}}|D]}tj�||�}|t|�7}qq|S)Ng)rr`rrSri)r�sizer_Z_dirsre�filenameZ	file_pathrrr�directory_size�srmcCstt|��Sr)rrmr3rrr�format_directory_size�srn)+rXrarZos.pathrKr&r/r�
contextlibrZtempfilerZpip._vendor.retryingrZpip._vendor.sixrZpip._internal.utils.compatrZpip._internal.utils.miscrZpip._internal.utils.typingrr	�typingr
rrr
rrr%r.r(r>Z_replace_retryrBrHrFrfrirjrmrnrrrr�<module>sD
	
$