Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pyo

ó
“tÆ_c@sÆddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZddlmZddlmZmZerdd	lmZmZmZmZmZd
efd„ƒYZnd„Zd
„Zd„Z e	d„ƒZ!e
ddddƒZ"erte"d„ƒZ#ne"ej#ƒZ#d„Z$d„Z%d„Z&d„Z'd„Z(d„Z)d„Z*dS(iÿÿÿÿN(tcontextmanager(tNamedTemporaryFile(tretry(tPY2(tget_path_uid(tformat_size(tMYPY_CHECK_RUNNINGtcast(tAnytBinaryIOtIteratortListtUniontNamedTemporaryFileResultcBseZed„ƒZRS(cCsdS(N((tself((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pytfiles(t__name__t
__module__tpropertyR(((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pyR
scCsÂtjdksttdƒr#tSd}x’||kr½tjj|ƒr¡tjƒdkr‹yt	|ƒ}Wnt
k
r€tSX|dkStj|tj
ƒSq,|tjj|ƒ}}q,WtS(Ntwin32tgeteuidi(tsystplatformthasattrtostTruetNonetpathtlexistsRRtOSErrortFalsetaccesstW_OKtdirname(Rtprevioustpath_uid((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pytcheck_path_owners

cCs”ytj||ƒWnyttfk
rx\||gD]N}yt|ƒ}Wntk
r`q7X|r7tjdjtƒƒ‚q7q7W‚nXdS(s“Wrap shutil.copy2() but map errors copying socket files to
    SpecialFileError as expected.

    See also https://bugs.python.org/issue37700.
    s`{f}` is a socketN(tshutiltcopy2RtIOErrort	is_sockettSpecialFileErrortformattlocals(tsrctdesttftis_socket_file((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pytcopy2_fixed;s
cCstjtj|ƒjƒS(N(tstattS_ISSOCKRtlstattst_mode(R((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pyR(Tsc
ksˆtdtdtjj|ƒdtjj|ƒdd|F}td|ƒ}z	|VWd|jjƒtj	|jj
ƒƒXWdQXdS(s%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.
    tdeletetdirtprefixtsuffixs.tmpR
N(RRRRR!tbasenameRRtflushtfsynctfileno(RtkwargsR.tresult((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pytadjacent_tmp_fileYs		
tstop_max_delayièt
wait_fixediúcCsIytj||ƒWn.tk
rDtj|ƒtj||ƒnXdS(N(RtrenameRtremove(R,R-((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pytreplacevs


cCsmx>tjj|ƒs@tjj|ƒ}||kr7Pn|}qWtjdkrctj|tjƒSt|ƒS(sgCheck if a directory is writable.

    Uses os.access() on POSIX, tries creating files on Windows.
    tposix(RRtisdirR!tnameRR t_test_writable_dir_win(Rtparent((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pyttest_writable_dir…s
csd}d‰xðtdƒD]â}|dj‡fd†tdƒDƒƒ}tjj||ƒ}y'tj|tjtjBtjBƒ}WnVtk
rÜ}|j	t	j
kr®qn|j	t	jksÒ|j	t	jkrÖt
S‚qXtj|ƒtj|ƒtSqWtdƒ‚dS(Nt(accesstest_deleteme_fishfingers_custard_t$abcdefghijklmnopqrstuvwxyz0123456789i
tc3s|]}tjˆƒVqdS(N(trandomtchoice(t.0t_(talphabet(sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pys	<genexpr>Ÿsis3Unexpected condition testing for writable directory(trangetjoinRRtopentO_RDWRtO_CREATtO_EXCLRterrnotEEXISTtEPERMtEACCESRtclosetunlinkRtEnvironmentError(RR9RQRGRtfdte((RRsO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pyRH˜s$)'$

cs\g}xOtj|ƒD]>\‰}}tj||ƒ}|j‡fd†|DƒƒqW|S(s†Returns a list of absolute paths of files beneath path, recursively,
    with filenames which match the UNIX-style shell glob pattern.c3s$|]}tjjˆ|ƒVqdS(N(RRRT(RPR.(troot(sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pys	<genexpr>Ãs(Rtwalktfnmatchtfiltertextend(RtpatternR>RQtfilestmatches((RbsO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pyt
find_files¼s
!cCs&tjj|ƒrdStjj|ƒS(Ni(RRtislinktgetsize(R((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pyt	file_sizeÇscCstt|ƒƒS(N(RRm(R((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pytformat_file_sizeÏscCscd}xVtj|ƒD]E\}}}x3|D]+}tjj||ƒ}|t|ƒ7}q,WqW|S(Ng(RRcRRTRm(RtsizeRbt_dirsRhtfilenamet	file_path((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pytdirectory_sizeÔs
cCstt|ƒƒS(N(RRs(R((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pytformat_directory_sizeÞs(+RYRdRtos.pathRNR%R1Rt
contextlibRttempfileRtpip._vendor.retryingRtpip._vendor.sixRtpip._internal.utils.compatRtpip._internal.utils.miscRtpip._internal.utils.typingRRttypingRR	R
RRR
R$R0R(R?t_replace_retryRDRJRHRjRmRnRsRt(((sO/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/filesystem.pyt<module>s@(			
		$				
Back to Directory File Manager