1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
U
H=®dã@sRddlZddlZddlZddlZddlZddlZddlZddlZddlm    Z    ddl
m Z ddl m Z ddlmZddlmZddlmZddlmZmZerÈdd    lmZmZmZmZmZGd
d „d eƒ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úUD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_internal/utils/filesystem.pyÚfileszNamedTemporaryFileResult.fileN)Ú__name__Ú
__module__Ú __qualname__ÚpropertyrrrrrrsrcCs tjdksttdƒsdStj |¡s(t‚d}||krœtj |¡rˆt ¡dkrxz t    |ƒ}Wnt
k
rnYdSX|dkSt  |tj ¡Sq,|tj  |¡}}q,dS)NÚwin32ÚgeteuidTrF)ÚsysÚplatformÚhasattrÚosÚpathÚisabsÚAssertionErrorÚlexistsrrÚOSErrorÚaccessÚW_OKÚdirname)rÚpreviousÚpath_uidrrrÚcheck_path_owners   r)c Csxzt ||¡Wnbttfk
rr||fD]>}z t|ƒ}Wntk
rPYq,X|r,t djftƒŽ¡‚q,‚YnXdS)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)ÚshutilÚcopy2r#ÚIOErrorÚ    is_socketÚSpecialFileErrorÚformatÚlocals)ÚsrcÚdestÚfÚis_socket_filerrrÚ copy2_fixed;s   ÿr5cCst t |¡j¡Sr)ÚstatÚS_ISSOCKrÚlstatÚst_mode©rrrrr-Tsr-c ksjtfdtj |¡tj |¡ddœ|—Ž8}td|ƒ}z
|VW5|j ¡t |j     ¡¡XW5QRXdS)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Úkwargsr3ÚresultrrrÚadjacent_tmp_fileYs 
 
üû
 
 
rEièéú)Ústop_max_delayÚ
wait_fixedcCs@zt ||¡Wn*tk
r:t |¡t ||¡YnXdSr)rÚrenamer#Úremove)r1r2rrrÚreplacevs
 
rKcCsHtj |¡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  
rQc sæd}d‰tdƒD]È}|d ‡fdd„tdƒDƒ¡}tj ||¡}zt |tjtjBtjB¡}Wn\tk
r¼}z>|j    t    j
kr†WY¢,q|j    t    j ksž|j    t    j krªWY¢ dS‚W5d}~XYqXt  |¡t |¡d    Sqtd
ƒ‚dS) NÚ(accesstest_deleteme_fishfingers_custard_Ú$abcdefghijklmnopqrstuvwxyz0123456789é
Úc3s|]}t ˆ¡VqdSr)ÚrandomÚchoice)Ú.0Ú_©ÚalphabetrrÚ    <genexpr>Ÿsz)_test_writable_dir_win.<locals>.<genexpr>éFTz3Unexpected condition testing for writable directory)ÚrangeÚjoinrrÚopenÚO_RDWRÚO_CREATÚO_EXCLr#ÚerrnoÚEEXISTÚEPERMÚEACCESÚcloseÚunlinkÚEnvironmentError)rr?rYrNrÚfdÚerrZrrO˜s&    
 
ÿrOcsBg}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)rrr_)rXr3©Úrootrrr\Ãszfind_files.<locals>.<genexpr>)rÚwalkÚfnmatchÚfilterÚextend)rÚpatternrDrYÚfilesÚmatchesrrmrÚ
find_files¼s
 rvcCstj |¡rdStj |¡S)Nr)rrÚislinkÚgetsizer:rrrÚ    file_sizeÇs rycCs tt|ƒƒSr)rryr:rrrÚformat_file_sizeÏsrzcCsBd}t |¡D].\}}}|D]}tj ||¡}|t|ƒ7}qq|S)Ng)rrorr_ry)rÚsizernÚ_dirsrtÚfilenameÚ    file_pathrrrÚdirectory_sizeÔs rcCs tt|ƒƒSr)rrr:rrrÚformat_directory_sizeÞsr€)+rdrprÚos.pathrVr*r6rÚ
contextlibrÚtempfilerÚpip._vendor.retryingrZpip._vendor.sixrÚpip._internal.utils.compatrÚpip._internal.utils.miscrÚpip._internal.utils.typingrr    Útypingr
r r r rrr)r5r-rEÚ_replace_retryrKrQrOrvryrzrr€rrrrÚ<module>sD      
      
$