n`:_RSTddlmZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZddlmZmZmZmZddlmZdd lmZdd lmZd,dZe d-dZeddejZd,dZd,dZd.dZd/dZ d0dZ!d/dZ"d0d Z#d1d%Z$d2d)Z%d3d*Z&d3d+Z'dS)4) annotationsN) Generator)contextmanager)Path)NamedTemporaryFile)AnyBinaryIOCallablecast) get_path_uid) format_size)retrypathstrreturnboolctjdksttdsdStj|sJd}||krtj|r^tjdkr( t|}n#t$rYdSwxYw|dkStj |tj S|tj |}}||kdS)Nwin32geteuidTrF) sysplatformhasattrosrisabslexistsrr OSErroraccessW_OKdirname)rpreviouspath_uids ~/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/utils/filesystem.pycheck_path_ownerr#s |wgb)&<&<t 7==   H (   7??4 9z||q  !+D11HH!!! 55!1}$yrw///!27??4#8#8dH (   5sB B&%B&kwargsrGenerator[BinaryIO, None, None]c+Ktddtj|tj|dd|5}t t |} |V|tj| n?#|tj| wxYw ddddS#1swxYwYdS)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)deletedirprefixsuffixN) rrrrbasenamer r flushfsyncfileno)rr$fresults r"adjacent_tmp_filer2.s0   GOOD ! !w%%        & h"" &LLL LLNNN HV]]__ % % % % LLNNN HV]]__ % % % % % & & & & & & & & & & & & & & & & & &s*C1%B$);C1$>  gmmD!!  w'yrw''' !$ ' ''cd}dtdD]}|dfdtdDz}tj||} tj|tjtjztjz}tj|tj |dS#t$rYt$rYdSwxYwtd ) N(accesstest_deleteme_fishfingers_custard_$abcdefghijklmnopqrstuvwxyz0123456789 c3@K|]}tjVdSN)randomchoice).0_alphabets r" z)_test_writable_dir_win..ds-!L!La&-"9"9!L!L!L!L!L!Lr=TFz3Unexpected condition testing for writable directory) rangejoinrropenO_RDWRO_CREATO_EXCLcloseunlinkFileExistsErrorPermissionErrorr)rr,rHr9filefdrIs @r"r:r:^s:H5H 2YY"''!L!L!L!L588!L!L!LLLLw||D$'' ry2:5 ABBB HRLLL IdOOO44    D    555   G H HHs)9C  C' C'&C'pattern list[str]cg}tj|D]<\}}tj||}|fd|D=|S)zReturns a list of absolute paths of files beneath path, recursively, with filenames which match the UNIX-style shell glob pattern.c3XK|]$}tj|V%dSrD)rrrM)rGr0roots r"rJzfind_files..s3==bgll4++======r=)rwalkfnmatchfilterextend)rrXr1rHfilesmatchesr\s @r" find_filesrczsgF'$-->>a.00 ====W======= Mr= int | floatctj|rdStj|SNr)rrislinkgetsizers r" file_sizerjs1 w~~dq 7??4  r=c:tt|SrD)r rjris r"format_file_sizerls y ' ''r=cd}tj|D]=\}}}|D]4}tj||}|t |z }5>|S)Ng)rr]rrMrj)rsizer\_dirsrafilename file_paths r"directory_sizerrsi D gdmm))eU ) )H T844I Ii(( (DD ) Kr=c:tt|SrD)r rrris r"format_directory_sizerts ~d++ , ,,r= directory target_filer Nonec2tj|jdzdz}tjtjvr)tj||dStjtjvrtj|j|ddSdS)NiiF)follow_symlinks)rstatst_modechmod supports_fdr/supports_follow_symlinksr9)rurvmodes r"copy_directory_permissionsrs  "U*    x2>!! ##%%t,,,,, R0 0 0 !4?????? 1 0r= predicate Callable[[str, list[str]], bool]Generator[Path]c#Kg}t}tjt|D]z\}}}t|}|||rD|t |jdd||| |{t|dD] }||vr|V dS)zZYields every subdirectory of +path+ that has no files matching the predicate under it.NT)reverse) setrr]rresolveupdatelistparentsaddappendsorted) rr directoriesexcludedroot_strrH filenamesr\ds r"_subdirs_without_genericrs KuuH"$'$t***<*<*>*>"?"? ! !!YH~~ 9Xy ) )  OOD..ss3 4 4 4 LL   4    K . . . H  GGGr=c$t|dS)z?Yields every subdirectory of +path+ that has no files under it.c(t|dkSrf)lenr\rs r"z'subdirs_without_files..s#i..STBTr=rris r"subdirs_without_filesrs #D*T*T U UUr=c$t|dS)zDYields every subdirectory of +path+ that has no .whl files under it.c4td|DS)Nc3@K|]}|dVdS)z.whlN)endswith)rGxs r"rJz;subdirs_without_wheels....s.)P)P!**V*<*<)P)P)P)P)P)Pr=)anyrs r"rz(subdirs_without_wheels..sc)P)Pi)P)P)P&P&Pr=rris r"subdirs_without_wheelsrs # PP  r=)rrrr)rrr$rrr%)rrrXrrrY)rrrrd)rrrr)rurrvr rrw)rrrrrr)rrrr)( __future__rr^ros.pathrErcollections.abcr contextlibrpathlibrtempfilertypingrr r r pip._internal.utils.compatr pip._internal.utils.miscr pip._internal.utils.retryrr#r2replacer<r:rcrjrlrrrtrrrrr+r=r"rs.""""""  %%%%%%%%%%%%''''''000000000000333333000000++++++6&&&&0 /%% . . .rz : : (((($IIII8!!!!((((---- @ @ @ @4VVVV r=