Your IP : 18.226.166.207


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/shutil.cpython-35.opt-2.pyc



���]p��A@slddlZddlZddlZddlZddlZddlZyddlZ[dZWnek
r{dZYnXyddl	Z	[	dZ
Wnek
r�dZ
YnXyddlZ[dZWnek
r�dZYnXyddl
mZWnek
rdZYnXyddlmZWnek
rAdZYnXdddd	d
ddd
dddddddddddddddddgZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d�de�ZGd#d$�d$e�ZGd%d&�d&e�Zdd)d�Zd*d+�Zd,dd-d�Zd,dd.d�Zeed/�rzd,dd0d1�Znd2d1�Zd,dd3d	�Z d,dd4d
�Z!d,dd5d�Z"d6d�Z#dde"dd7d�Z$d8d9�Z%d:d;�Z&ej'ejej(ej)hej*ko@ej+ej,ko@ejej-kZ.ddd<d�Z/e.e/_0d=d>�Z1e"d?d
�Z2d@dA�Z3dBdC�Z4dDdE�Z5dFddddddGdH�Z6ddddIdJ�Z7dKe6d�gdMfiZ8ere6d�gdNfe8dO<e7gdPfe8dQ<e
r3e6d�gdSfe8dT<erOe6d�gdVfe8dW<dXd�Z9ddYdZd�Z:d[d�Z;dddddddd\d�Z<d]d�Z=d^d_�Z>ddYd`d�Z?dad�Z@dbdc�ZAddde�ZBdfdg�ZCdKdhgeCgdMfdQdigeBgdPfiZDerFdjdkgeCgdNfeDdO<e
rhdldmgeCgdSfeDdT<er�dndogeCgdVfeDdW<dpdq�ZEdddrd�ZFeeds�r�ejGdt�ejHdudv�ZIdwdt�ZJnFejKdxkr+ddlLZLejGdt�ejHdudv�ZIdydt�ZJdddzd�ZMd�d}d�ZNejOejPBdd~d�ZQdS)��NTF)�getpwnam)�getgrnam�copyfileobj�copyfile�copymode�copystat�copy�copy2�copytree�move�rmtree�Error�SpecialFileError�	ExecError�make_archive�get_archive_formats�register_archive_format�unregister_archive_format�get_unpack_formats�register_unpack_format�unregister_unpack_format�unpack_archive�ignore_patterns�chown�which�get_terminal_size�
SameFileErrorc@seZdZdS)r
N)�__name__�
__module__�__qualname__�r r �+/opt/alt/python35/lib64/python3.5/shutil.pyr
7sc@seZdZdS)rN)rrrr r r r!r:sc@seZdZdS)rN)rrrr r r r!r=sc@seZdZdS)rN)rrrr r r r!rAsc@seZdZdS)�	ReadErrorN)rrrr r r r!r"Dsr"c@seZdZdS)�
RegistryErrorN)rrrr r r r!r#Gsr#�icCs.x'|j|�}|sP|j|�qWdS)N)�read�write)�fsrc�fdst�length�bufr r r!rLs
cCs|ttjd�rBytjj||�SWntk
rAdSYnXtjjtjj|��tjjtjj|��kS)N�samefileF)�hasattr�os�pathr+�OSError�normcase�abspath)�src�dstr r r!�	_samefileTs
	r4�follow_symlinkscCst||�r'tdj||���x^||gD]P}ytj|�}Wntk
raYq4Xtj|j�r4td|��q4W|r�tj	j
|�r�tjtj|�|�n?t
|d��-}t
|d��}t||�WdQRXWdQRX|S)Nz{!r} and {!r} are the same filez`%s` is a named pipe�rb�wb)r4r�formatr-�statr/�S_ISFIFO�st_moderr.�islink�symlink�readlink�openr)r2r3r5�fn�str'r(r r r!r`s
cCs�|rWtjj|�rWtjj|�rWttd�rPtjtj}}q�dSn)ttd�r|tjtj}}ndS||�}||tj|j	��dS)N�lchmod�chmod)
r-r.r<r,�lstatrBr9rC�S_IMODEr;)r2r3r5�	stat_func�
chmod_funcrAr r r!r}s+�	listxattrcCs�ytj|d|�}WnGtk
rb}z'|jtjtjfkrL�dSWYdd}~XnXx�|D]�}y5tj||d|�}tj|||d|�Wqjtk
r�}z)|jtjtjtjfkr��WYdd}~XqjXqjWdS)Nr5)	r-rHr/�errno�ENOTSUP�ENODATA�getxattr�setxattr�EPERM)r2r3r5�names�e�name�valuer r r!�
_copyxattr�s	
!rScOsdS)Nr )�args�kwargsr r r!rS�sc	s�dddddd��|p@tjj|�o?tjj|�}|r^�fdd�}n�fdd�}|d�|d|�}tj|j�}|d	�|d|j|jfd|�y|d
�||d|�Wntk
r�YnXt	|d�r�y |d�||j
d|�Wnatk
r�}zAx9dD].}t	t|�r?|jt
t|�kr?Pq?W�WYdd}~XnXt||d|�dS)N�nsr5cWsdS)Nr )rVr5rTr r r!�_nop�szcopystat.<locals>._nopcstt|��S)N)�getattrr-)rQ)rWr r!�lookup�szcopystat.<locals>.lookupcs)tt|��}|tjkr%|S�S)N)rXr-�supports_follow_symlinks)rQr@)rWr r!rY�sr9�utimerC�st_flags�chflags�
EOPNOTSUPPrJ)r^rJ)r-r.r<r9rEr;�st_atime_ns�st_mtime_ns�NotImplementedErrorr,r\r/rIrXrS)	r2r3r5�followrYrA�mode�why�errr )rWr!r�s,+!
 
'cCs]tjj|�r3tjj|tjj|��}t||d|�t||d|�|S)Nr5)r-r.�isdir�join�basenamerr)r2r3r5r r r!r�s
!cCs]tjj|�r3tjj|tjj|��}t||d|�t||d|�|S)Nr5)r-r.rfrgrhrr)r2r3r5r r r!r	�s

!cs�fdd�}|S)Ncs:g}x'�D]}|jtj||��q
Wt|�S)N)�extend�fnmatch�filter�set)r.rO�
ignored_names�pattern)�patternsr r!�_ignore_patterns
s
z)ignore_patterns.<locals>._ignore_patternsr )rorpr )ror!rscCsstj|�}|dk	r-|||�}n	t�}tj|�g}x�|D]�}	|	|kreqPtjj||	�}
tjj||	�}y�tjj|
�r7tj|
�}|r�tj||�t	|
|d|�qotjj
|�r�|r�wPtjj|
�r't|
||||�qo||
|�n8tjj|
�rbt|
||||�n
||
|�WqPt
k
r�}
z|j|
jd�WYdd}
~
XqPtk
r�}z!|j|
|t|�f�WYdd}~XqPXqPWyt	||�WnYtk
r\}z9t|dd�dkrJ|j||t|�f�WYdd}~XnX|rot
|��|S)Nr5r�winerror)r-�listdirrl�makedirsr.rgr<r>r=r�existsrfr
r
rirTr/�append�strrX)r2r3�symlinks�ignore�
copy_function�ignore_dangling_symlinksrOrm�errorsrQ�srcname�dstname�linktorerdr r r!r
sL$	


&3/c$Cs�y"tjj|�r!td��Wn2tk
rV|tjj|tj��dSYnXg}ytj|�}Wn+tk
r�|tj|tj��YnXx�|D]�}tjj||�}ytj|�j	}Wntk
r�d}YnXt
j|�rt||�q�ytj
|�Wq�tk
rN|tj
|tj��Yq�Xq�Wytj|�Wn+tk
r�|tj|tj��YnXdS)Nz%Cannot call rmtree on a symbolic linkr)r-r.r<r/�sys�exc_inforrrgrDr;r9�S_ISDIR�_rmtree_unsafe�unlink�rmdir)r.�onerrorrOrQ�fullnamercr r r!r�ks6
	



"
r�c
0Cs@g}ytj|�}WnGtk
rb}z'||_|tj|tj��WYdd}~XnXx�|D]�}tjj||�}y(tj|d|dd�}|j	}Wntk
r�d}YnXtj
|�r�ytj|tjd|�}	Wn+tk
r#|tj|tj��Yq8Xz�tjj
|tj|	��r�t|	||�ytj|d|�Wq�tk
r�|tj|tj��Yq�XnAytd��Wn.tk
r�|tjj|tj��YnXWdtj|	�Xqjytj|d|�Wqjtk
r7|tj|tj��YqjXqjWdS)N�dir_fdr5Frz%Cannot call rmtree on a symbolic link)r-rrr/�filenamerr�r.rgr9r;r�r?�O_RDONLY�samestat�fstat�_rmtree_safe_fdr�r<�closer�)
�topfdr.r�rOrerQr��orig_strc�dirfdr r r!r��sD	,




!
%
r�c!Cs�|rdd�}n|dkr-dd�}tr�t|t�rQtj|�}ytj|�}Wn/tk
r�|tj|tj��dSYnXytj	|tj
�}Wn/tk
r�|tj|tj��dSYnXz�tjj|tj
|��rTt|||�ytj|�Wq�tk
rP|tj|tj��Yq�XnAytd��Wn.tk
r�|tjj|tj��YnXWdtj|�Xn
t||�SdS)NcWsdS)Nr )rTr r r!r��szrmtree.<locals>.onerrorcWs�dS)Nr )rTr r r!r��sz%Cannot call rmtree on a symbolic link)�_use_fd_functions�
isinstance�bytesr-�fsdecoderD�	Exceptionrr�r?r�r.r�r�r�r�r/r<r�r�)r.�
ignore_errorsr�r��fdr r r!r�s<
	
	
!
%cCs5tjjtjjpd}tjj|j|��S)N�)r-r.�sep�altseprh�rstrip)r.r�r r r!�	_basename�sr�c
Cs]|}tjj|�rxt||�r;tj||�dStjj|t|��}tjj|�rxtd|��ytj||�Wn�t	k
rXtjj
|�r�tj|�}tj||�tj
|�nwtjj|�r:t||�rtd||f��t||d|dd�t|�n|||�tj
|�YnX|S)Nz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.ryrwT)r-r.rfr4�renamergr�rtr
r/r<r>r=r��
_destinsrcr
r)r2r3ry�real_dstr~r r r!r�s2


cCs{tjj|�}tjj|�}|jtjj�sI|tjj7}|jtjj�sn|tjj7}|j|�S)N)r-r.r1�endswithr��
startswith)r2r3r r r!r�2sr�cCs_tdks|dkrdSyt|�}Wntk
rFd}YnX|dk	r[|dSdS)N�)r�KeyError)rQ�resultr r r!�_get_gid;s
r�cCs_tdks|dkrdSyt|�}Wntk
rFd}YnX|dk	r[|dSdS)Nr�)rr�)rQr�r r r!�_get_uidGs
r��gzipc
s�|dkrd}nftr0|dkr0d}nKtrK|dkrKd}n0trf|dkrfd}ntdj|���ddl}	|r�d	|nd}
|d
|
}tjj|�}|rtjj	|�r|dk	r�|j
d|�|stj|�|dk	r|j
d�t���t
�������fd
d�}
|s�|	j|d|�}z|j|d|
�Wd|j�X|S)Nr�r��gz�bzip2�bz2�xzzCbad value for 'compress', or compression format not supported : {0}r�.z.tarzcreating %szCreating tar archivecs@�dk	r�|_�|_�dk	r<�|_�|_|S)N)�gid�gname�uid�uname)�tarinfo)r��group�ownerr�r r!�_set_uid_gid�s				z#_make_tarball.<locals>._set_uid_gidzw|%srk)�_ZLIB_SUPPORTED�_BZ2_SUPPORTED�_LZMA_SUPPORTED�
ValueErrorr8�tarfiler-r.�dirnamert�inforsr�r�r?�addr�)�	base_name�base_dir�compress�verbose�dry_runr�r��logger�tar_compressionr��compress_ext�archive_name�archive_dirr��tarr )r�r�r�r�r!�
_make_tarballSs<					

	r�c
Csddl}|d}tjj|�}|rptjj|�rp|dk	r]|jd|�|sptj|�|dk	r�|jd||�|s�|j|dd|j��K}tjj	|�}	|	tj
kr|j|	|	�|dk	r|jd|	�x�tj|�D]�\}
}}xat
|�D]S}
tjj	tjj|
|
��}	|j|	|	�|dk	r,|jd|	�q,Wxm|D]e}
tjj	tjj|
|
��}	tjj|	�r�|j|	|	�|dk	r�|jd|	�q�WqWWdQRX|S)Nrz.zipzcreating %sz#creating '%s' and adding '%s' to it�w�compressionzadding '%s')�zipfiler-r.r�rtr�rs�ZipFile�ZIP_DEFLATED�normpath�curdirr&�walk�sortedrg�isfile)r�r�r�r�r�r��zip_filenamer��zfr.�dirpath�dirnames�	filenamesrQr r r!�
_make_zipfile�s@

	
!
!r�r�r�zuncompressed tar filezgzip'ed tar-file�gztarzZIP file�zipr�zbzip2'ed tar-file�bztarr�zxz'ed tar-file�xztarcCs'dd�tj�D�}|j�|S)NcSs&g|]\}}||df�qS)r�r )�.0rQ�registryr r r!�
<listcomp>�s	z'get_archive_formats.<locals>.<listcomp>)�_ARCHIVE_FORMATS�items�sort)�formatsr r r!r�s	
r�cCs�|dkrg}t|�s.td|��t|ttf�sOtd��xB|D]:}t|ttf�s�t|�dkrVtd��qVW|||ft|<dS)NzThe %s object is not callablez!extra_args needs to be a sequencer�z+extra_args elements are : (arg_name, value))�callable�	TypeErrorr��tuple�list�lenr�)rQ�function�
extra_args�description�elementr r r!r�s	
(cCst|=dS)N)r�)rQr r r!r�sc	CsUtj�}	|dk	rY|dk	r4|jd|�tjj|�}|sYtj|�|dkrntj}d|d|i}
yt|}Wn"tk
r�t	d|��YnX|d}x"|dD]\}
}||
|
<q�W|dkr||
d<||
d	<z||||
�}Wd|dk	rP|dk	rC|jd
|	�tj|	�X|S)Nzchanging into '%s'r�r�zunknown archive format '%s'r�r�r�r�zchanging back to '%s')
r-�getcwd�debugr.r1�chdirr�r�r�r�)r�r8�root_dirr�r�r�r�r�r��save_cwdrU�format_info�func�arg�valr�r r r!r�s6
	



cCs'dd�tj�D�}|j�|S)NcSs-g|]#\}}||d|df�qS)r�r )r�rQr�r r r!r�0s	z&get_unpack_formats.<locals>.<listcomp>)�_UNPACK_FORMATSr�r�)r�r r r!r*s	
c	Cs�i}x9tj�D]+\}}x|dD]}|||<q*WqWx:|D]2}||krId}t||||f��qIWt|�s�td��dS)Nrz!%s is already registered for "%s"z*The registered function must be a callable)r�r�r#r�r�)	�
extensionsr�r��existing_extensionsrQr��ext�	extension�msgr r r!�_check_unpack_options5s
	r�cCs<|dkrg}t|||�||||ft|<dS)N)r�r�)rQr�r�r�r�r r r!rGscCst|=dS)N)r�)rQr r r!r]scCs5tjj|�}tjj|�s1tj|�dS)N)r-r.r�rfrs)r.r�r r r!�_ensure_directoryasr�c	Csddl}|j|�s+td|��|j|�}z�x�|j�D]�}|j}|jd�sJd|krwqJtjj	||j
d��}|s�qJt|�|jd�sJ|j
|j�}t|d�}z|j|�Wd|j�~XqJWWd|j�XdS)Nrz%s is not a zip file�/z..r7)r��
is_zipfiler"r��infolistr�r�r-r.rg�splitr�r�r%r?r&r�)	r��extract_dirr�r�r�rQ�target�data�fr r r!�_unpack_zipfilegs*	

rcCsjddl}y|j|�}Wn%|jk
rFtd|��YnXz|j|�Wd|j�XdS)Nrz/%s is not a compressed or uncompressed tar file)r�r?�TarErrorr"�
extractallr�)r�rr��tarobjr r r!�_unpack_tarfile�srz.tarz.zipz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCsIxBtj�D]4\}}x%|dD]}|j|�r$|Sq$Wq
WdS)Nr)r�r�r�)r�rQr�r�r r r!�_find_unpack_format�s
r
cCs�|dkrtj�}|dk	r�yt|}Wn'tk
r[tdj|���YnX|d}|||t|d��n_t|�}|dkr�tdj|���t|d}tt|d�}||||�dS)NzUnknown unpack format '{0}'r�r�zUnknown archive format '{0}')	r-r�r�r�r�r8�dictr
r")r�rr8r�r�rUr r r!r�s

�statvfs�
disk_usage�usageztotal used freecCsVtj|�}|j|j}|j|j}|j|j|j}t|||�S)N)r-r�f_bavail�f_frsize�f_blocks�f_bfree�_ntuple_diskusage)r.rA�free�total�usedr r r!r�s
�ntcCs/tj|�\}}||}t|||�S)N)rZ
_getdiskusager)r.rrrr r r!r�s
cCs�|dkr$|dkr$td��|}|}|dkrEd}n<t|t�r�t|�}|dkr�tdj|���|dkr�d}n<t|t�s�t|�}|dkr�tdj|���tj	|||�dS)Nzuser and/or group must be setr�zno such user: {!r}zno such group: {!r}���r)
r�r�rvr��LookupErrorr8�intr�r-r)r.�userr��_user�_groupr r r!r�s"		�P�cCsyttjd�}Wnttfk
r7d}YnXyttjd�}Wnttfk
rod}YnX|dks�|dkr�ytjtjj��}Wn*t	tt
fk
r�tj|�}YnX|dkr�|j}|dkr�|j
}tj||f�S)N�COLUMNSr�LINES)rr-�environr�r�rr�
__stdout__�fileno�AttributeErrorr/�
terminal_size�columns�lines)�fallbackr*r+�sizer r r!rs$		cs�dd�}tjj��r5|�|�r1�SdS|dkrYtjjdtj�}|scdS|jtj�}tj	dkrtj
|kr�|jdtj
�tjjdd�jtj�}t�fdd	�|D��r��g}q�fd
d�|D�}n	�g}t
�}xr|D]j}tjj|�}||kr'|j|�x6|D].}	tjj||	�}
||
|�r_|
Sq_Wq'WdS)NcSs5tjj|�o4tj||�o4tjj|�S)N)r-r.rt�accessrf)r@rcr r r!�
_access_checkOs$zwhich.<locals>._access_check�PATH�win32r�PATHEXTr�c3s*|] }�j�j|j��VqdS)N)�lowerr�)r�r�)�cmdr r!�	<genexpr>lszwhich.<locals>.<genexpr>csg|]}�|�qSr r )r�r�)r4r r!r�os	zwhich.<locals>.<listcomp>)r-r.r�r%�get�defpathr�pathsepr�platformr��insert�anyrlr0r�rg)r4rcr.r/�pathext�files�seen�dir�normdir�thefilerQr )r4r!rBs8
!		


i@)r�N)r�r�)r�r�)r�r�)r!r")Rr-rr9rj�collectionsrI�zlibr��ImportErrorr�r��lzmar��pwdr�grpr�__all__r/r
rrrr"r�r#rr4rrr,rSrrr	rr
r�r�r?r�r��supports_dir_fdrr�supports_fdrZr�r�avoids_symlink_attacksr�rr�r�r�r�r�r�rrrrrr�rrr�rrr�r
rru�
namedtuplerrrQrrr�F_OK�X_OKrr r r r!�<module>s�







		6	Y!,5	8		@-	
	
	

	6"


%

-

?>