7fV ddlZddlZddlZddlZddlZddlmZddlmZddl m Z m Z m Z m Z mZmZddlmZddlmZddlmZded efd Zeded e d e e ddffd Zed dejZded efdZded efdZdeded e efdZded eeeffdZ ded efdZ!ded eeeffdZ"ded efdZ#dS)N)contextmanager)NamedTemporaryFile)AnyBinaryIO GeneratorListUnioncast) get_path_uid) format_size)retrypathreturnctjdksttdsdStj|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.3.5/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&kwargsc+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 rflushfsyncfileno)rr!fresults radjacent_tmp_filer.*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..`s-!L!La&-"9"9!L!L!L!L!L!Lr9TFz3Unexpected condition testing for writable directory) rangejoinrropenO_RDWRO_CREATO_EXCLcloseunlinkFileExistsErrorPermissionErrorr)rr(rDr5filefdrEs @rr6r6Zs:H5H 2YY"''!L!L!L!L588!L!L!LLLLw||D$'' ry2:5 ABBB HRLLL IdOOO44    D    555   G H HHs)9C  C' C'&C'patterncg}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%dSr@)rrrI)rCr,roots rrFzfind_files..|s3==bgll4++======r9)rwalkfnmatchfilterextend)rrTr-rDfilesmatchesrWs @r find_filesr^vsgF'$-->>a.00 ====W======= Mr9ctj|rdStj|S)Nr)rrislinkgetsizers r file_sizercs1 w~~dq 7??4  r9c:tt|Sr@)r rcrbs rformat_file_sizeres y ' ''r9cd}tj|D]=\}}}|D]4}tj||}|t |z }5>|S)Ng)rrXrrIrc)rsizerW_dirsr\filename file_paths rdirectory_sizerksi D gdmm))eU ) )H T844I Ii(( (DD ) Kr9c:tt|Sr@)r rkrbs rformat_directory_sizerms ~d++ , ,,r9)$rYros.pathrAr contextlibrtempfilertypingrrrrr r pip._internal.utils.compatr pip._internal.utils.miscr pip._internal.utils.retryr strboolr r.replacer8r6r^intfloatrcrerkrmr'r9rrzs\  %%%%%%''''''>>>>>>>>>>>>>>>>333333000000++++++346&C&3&9XtT=Q3R&&&&0 /%% . . .rz : : (C(D(((($IIIIII8S349!C!E#u*-!!!!(3(3((((sEz!2--------r9