"JdddlZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z m Z mZmZmZmZddlmZmZmZddlmZddlmZded efd Zd ed ed dfd Zded efdZedede d ee fdZedededZ e ej!Z!ded efdZ"ded efdZ#deded eefdZ$ded ee%e&ffdZ'ded efdZ(ded ee%e&ffdZ)ded efdZ*dS)N)contextmanager)NamedTemporaryFile)AnyBinaryIOIteratorListUnioncast)retrystop_after_delay wait_fixed) get_path_uid) format_sizepathreturnctjdksttdsdSd}||krtj|r^tjdkr( t|}n#t$rYdSwxYw|dkStj |tj S|tj |}}||kdS)Nwin32geteuidTrF) sysplatformhasattrosrlexistsrrOSErroraccessW_OKdirname)rpreviouspath_uids Q/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/filesystem.pycheck_path_ownerr!s |wgb)&<&<tH (   7??4 9z||q  !+D11HH!!! 55!1}$yrw///!27??4#8#8dH (   5s'A77 BBsrcdestc tj||dS#t$rC||fD]<} t|}|rtjd|d-#t$rY9wxYwwxYw)zWrap shutil.copy2() but map errors copying socket files to SpecialFileError as expected. See also https://bugs.python.org/issue37700. `z ` is a socketN)shutilcopy2r is_socketSpecialFileError)r"r#fis_socket_files r copy2_fixedr,-s  S$    t H HA H!*1 "H 12Fa2F2F2FGGGH       s+A&AA& A!A& A!!A&cXtjtj|jSN)statS_ISSOCKrlstatst_moders r r(r(Ds =$/ 0 00kwargsc+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)rr5r*results r adjacent_tmp_filerAHs0   GOOD ! !w%%        & h"" &LLL LLNNN HV]]__ % % % % LLNNN HV]]__ % % % % % & & & & & & & & & & & & & & & & & &s*C1%B$);C1$>  gmmD!!  w'yrw''' !$ ' ''r4cd}dtdD]}|dfdtdDz}tj||} tj|tjtjztjz}tj|tj |dS#t$rYt$rYdSwxYwtd ) N(accesstest_deleteme_fishfingers_custard_$abcdefghijklmnopqrstuvwxyz0123456789 c3@K|]}tjVdSr.)randomchoice).0_alphabets r z)_test_writable_dir_win..s-!L!La&-"9"9!L!L!L!L!L!Lr4TFz3Unexpected condition testing for writable directory) rangejoinrropenO_RDWRO_CREATO_EXCLcloseunlinkFileExistsErrorPermissionErrorr)rr<rVrIfilefdrWs @r rJrJ{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'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.)rrr[)rUr*roots r rXzfind_files..s3==bgll4++======r4)rwalkfnmatchfilterextend)rrfr@rVfilesmatchesris @r find_filesrpsgF'$-->>a.00 ====W======= Mr4ctj|rdStj|S)Nr)rrislinkgetsizer3s r file_sizerts1 w~~dq 7??4  r4c:tt|Sr.)rrtr3s r format_file_sizervs y ' ''r4cd}tj|D]=\}}}|D]4}tj||}|t |z }5>|S)Ng)rrjrr[rt)rsizeri_dirsrnfilename file_paths r directory_sizer|si D gdmm))eU ) )H T844I Ii(( (DD ) Kr4c:tt|Sr.)rr|r3s r format_directory_sizer~s ~d++ , ,,r4)+rkros.pathrSr&r/r contextlibrtempfilertypingrrrrr r pip._vendor.tenacityr r r pip._internal.utils.compatrpip._internal.utils.miscrstrboolr!r,r(rA_replace_retryreplacerLrJrpintfloatrtrvr|r~r;r4r rs  %%%%%%''''''================DDDDDDDDDD333333000000346S.1C1D1111&C&3&8H3E&&&&2t*:*:1*=*=JJtDTDTUUU . $ $ (C(D(((($IIIIII8S349!C!E#u*-!!!!(3(3((((sEz!2--------r4